ACP QBCore
Logs
Create User Logs

Create User Logs

When you use the createLog function, the created logs will be inserted into the database only when the number of logs created in the TOTAL will exceed or be equal to 10.

local details = {
    amount = 1,
    item = 'phone',
    item_name = 'Mobile Phone',
    name = GetPlayerName(player),
    price = 150,
}
 
exports['syn-acp']:createLog(citizenid, details, 'MarketBuy')

If you want to instantly insert a log in the database, you can use the insertLog function

local details = {
    amount = 1,
    item = 'phone',
    item_name = 'Mobile Phone',
    name = GetPlayerName(player),
    price = 150,
}
 
exports['syn-acp']:insertLog(citizenid, details, 'MarketBuy')

Parameters Descriptions

details (table) => Parameter Description
A table containing detailed information about the event being logged. The structure and content of this table depend on the type of event and what information you need to capture.

type (string) => Parameter Description

  • A string that categorizes the type of log entry. This helps in identifying the nature of the log, such as a purchase, login, error, or other types of events.
  • Example: 'MarketBuy', 'Login', 'Achievement', 'Crafting', 'ServerError'

Example Entries:

  • Market Purchase:
{
    amount = 1,
    item = 'phone',
    item_name = 'Mobile Phone',
    name = 'John Doe',
    price = 150,
}
  • amount (number): Quantity of the item purchased.

  • item (string): Internal name or identifier of the item.

  • item_name (string): User-friendly name of the item.

  • name (string): Name of the user making the purchase.

  • price (number): Cost of the item.

  • Achievement Unlocked:
{
    achievement_id = 101,
    achievement_name = 'First Kill',
    reward = '100 XP',
}
  • achievement_id (number): Unique identifier for the achievement.
  • achievement_name (string): Name or description of the achievement.
  • reward (string): Reward given for unlocking the achievement.