codeExports

Exported functions for managing business data including XP, levels, money, stock, and warnings. All functions include parameter validation and error handling.

Server-Side

All exports are server-side only and must be used in server-side scripts.


chevron-rightCreateLoghashtag

Description: Creates a Discord webhook log entry for server events. Supports player identification, framework detection (QBX, QB-Core, ESX), screenshot capture, and organized data sections with customizable colors and categories.

Parameters:

  • data (table): Configuration table containing log details

Data Structure:

  • category = string, -- Required: Webhook category (must match Webhooks table key)

  • title = string, -- Required: Log title

  • action = string, -- Optional: Action description

  • color = string, -- Optional: Color name (default, red, green, blue, orange, grey, darkred, gold, purple, yellow)

  • players = table, -- Optional: Array of {id = source, role = "Role Name"}

  • info = table, -- Optional: Array of {name = "Key", value = "Value"}

  • extra = table, -- Optional: Array of sections with {title = "Section", data = {...}}

  • takeScreenshot = bool, -- Optional: Capture screenshot (default: false)

  • screenshotTargetId = number -- Optional: Specific player to screenshot

Usage:

Basic Log:

exports['R6-Logs']:CreateLog({
    category = 'chat',
    title = 'Chat Logs',
    action = 'Message Sent',
    color = 'grey',
    players = {
        { id = source, role = 'Sender' }
    },
    info = {
        { name = 'Message', value = message }
    }
})

Advanced Log with Extra Sections:

exports['R6-Logs']:CreateLog({
    category = 'admin',
    title = 'Admin Logs',
    action = 'Player Kicked',
    color = 'orange',
    players = {
        { id = adminId, role = 'Admin' },
        { id = targetId, role = 'Target' }
    },
    info = {
        { name = 'Reason', value = kickReason }
    },
    extra = {
        {
            title = 'Additional Info',
            data = {
                { name = 'Timestamp', value = os.date('%Y-%m-%d %H:%M:%S') },
                { name = 'Previous Kicks', value = '2' }
            }
        }
    },
    takeScreenshot = true
}

Last updated