Creating a webhook for logging

Step 1

Create a webhook on your discord channel

Step 2

Go into s_webook.lua inside editable folder and set the url of your webhook in the KOJA.Webhook string

s_webhook.lua
KOJA.Webhook = 'PASTE YOUR URL HERE' -- URL of the webhook

And you are all set!


If the webhook embed doesn't meet your preferences, feel free to edit it!

s_webhook.lua
KOJA.LogMessage = function(data)
    local xPlayer = data.player -- Player data
    local vehicle = data.vehicle -- Vehicle data
    -- Formatted log message with player and vehicle details
    local logMessage = string.format("**Player:** %s\n**Purchased Vehicle**\n**Vehicle Model:** %s\n**License Plate:** %s\n**Price:** %s", GetPlayerName(xPlayer.source), vehicle.name, vehicle.plate, vehicle.price)
    -- Creating an embed to send to the webhook
    local embed = {
        title = "Vehicle Purchase",
        description = logMessage,
        color = 65280, -- Green color for success (hexadecimal)
        footer = {
            text = "Vehicle System", -- Footer text
        },
    }
    webhook(embed) -- Sending the embed to the webhook
end

Last updated