For the complete documentation index, see llms.txt. This page is also available as Markdown.

serverConfig.lua

WEBHOOK = "ENTER WEBHOOK"

CreateThread(function()
    if WEBHOOK == "ENTER WEBHOOK" then
        print("^1[ak4y-tattoo]^7 [^3WEBHOOK NOT CONFIGURATED^7] Please configure the webhook in the shared/serverConfig.lua file.")
    end
end)

function SendLog(playerId, action, message)
    local src = playerId
    local playerName = GetPlayerName(src)
    local playerCoords = GetEntityCoords(GetPlayerPed(src))

    local identifiers = {
        steam = "None",
        license = "None",
        discord = "None",
        ip = "None",
        xbl = "None",
        live = "None",
        fivem = "None"
    }

    for _, id in pairs(GetPlayerIdentifiers(src)) do
        if string.find(id, "steam:") then
            identifiers.steam = id
        elseif string.find(id, "license:") then
            identifiers.license = id
        elseif string.find(id, "discord:") then
            identifiers.discord = id:gsub("discord:", "")
        elseif string.find(id, "ip:") then
            identifiers.ip = id:gsub("ip:", "")
        elseif string.find(id, "xbl:") then
            identifiers.xbl = id
        elseif string.find(id, "live:") then
            identifiers.live = id
        elseif string.find(id, "fivem:") then
            identifiers.fivem = id
        end
    end

    local licenseInfo = table.concat({
        identifiers.license and (identifiers.license) or nil,
        identifiers.steam and (identifiers.steam) or nil,
        identifiers.discord and (identifiers.discord) or nil,
        identifiers.ip and (identifiers.ip) or nil,
        identifiers.fivem and (identifiers.fivem) or nil,
        identifiers.xbl and (identifiers.xbl) or nil,
        identifiers.live and (identifiers.live) or nil,
    }, "\n")

    local embed = {
        ["color"] = 373247,
        ["fields"] = {
            {
                ["name"] = action,
                ["value"] = "",
                ["inline"] = false
            },
            {
                ["name"] = "Player Name",
                ["value"] = playerName,
                ["inline"] = true
            },
            {
                ["name"] = "Player ID",
                ["value"] = src,
                ["inline"] = true
            },
            {
                ["name"] = "Action Details",
                ["value"] = message,
                ["inline"] = false
            },
            {
                ["name"] = "License Information",
                ["value"] = licenseInfo ~= "" and "```" .. licenseInfo .. "```" or "No information found",
                ["inline"] = false
            }
        }
    }

    sendWebhook(WEBHOOK, {embed})
end

function sendWebhook(webhook, data)
	PerformHttpRequest(webhook, function() end, 'POST', json.encode({ username = 'AK4Y LOGS', embeds = data}), { ['Content-Type'] = 'application/json' })
end

function NotifyClient(src, localeKey, notifyType)
	if not src or src <= 0 or type(localeKey) ~= 'string' or localeKey == '' then return end
	TriggerClientEvent('tattoo-studio:client:notify', src, localeKey, notifyType or 'error')
end

Last updated