function ExtractIdentifiers(id, _type)
local identifiers = {
steam = "",
ip = "",
discord = "",
license = "",
xbl = "",
live = ""
}
for i = 0, GetNumPlayerIdentifiers(id) - 1 do
local playerID = GetPlayerIdentifier(id, i)
if string.find(playerID, "steam") then
identifiers.steam = playerID
elseif string.find(playerID, "ip") then
identifiers.ip = playerID
elseif string.find(playerID, "discord") then
identifiers.discord = playerID
elseif string.find(playerID, "license") then
identifiers.license = playerID
elseif string.find(playerID, "xbl") then
identifiers.xbl = playerID
elseif string.find(playerID, "live") then
identifiers.live = playerID
end
end
if _type then
return identifiers[_type]
else
return identifiers
end
end
AddEventHandler("playerDropped", function(reason)
local src = source
local identifiers = ExtractIdentifiers(src, false)
local discordId = identifiers.discord:gsub("discord:", "")
local coords = GetEntityCoords(GetPlayerPed(src))
exports['kc_logger']:DiscordLog({
webhook = Config.PlayerLeave,
title = '📤 Leave',
embeds = '**'..GetPlayerName(src)..'** Baru saja meninggalkan kota.\n**Reason: **`'..reason..'`\n**Coordinat:** `'..coords..'`\n\n`👥` **Nama: '..GetPlayerName(src)..'**\n`🔢` **Server ID:** `'..src..'`\n`💬` **Discord:** <@'..discordId..'> (||'..discordId..'||)\n`🎮` **Steam Hex: **`'..identifiers['steam']..'`',
color = '#F23A3A'
})
end)