serverConfig.lua
WEBHOOK = "https://discord.com/api/webhooks/1407668529603543154/K-lIDR7lQPcK1HTrPFBAPLqgp9Lz59KVB_XoIkznMVDr9OCOf0rR_sk8Vc-lb2Yj2DQH"
CreateThread(function()
if WEBHOOK == "ENTER WEBHOOK" then
print("^1[ak4y-Camera]^7 [^3WEBHOOK NOT CONFIGURATED^7] Please configure the webhook in the shared/serverConfig.lua file.")
end
end)
function SendLog(playerId, action, message, photoUrl)
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
}
}
}
if photoUrl and photoUrl ~= "" then
embed["image"] = {
["url"] = photoUrl
}
end
sendWebhook(WEBHOOK, {embed})
end
function sendWebhook(webhook, data)
PerformHttpRequest(webhook, function() end, 'POST', json.encode({ username = 'AK4Y LOGS', embeds = data}), { ['Content-Type'] = 'application/json' })
endLast updated