sv_utils.lua
local myframework = nil
WEBHOOK = ""
local Framework = nil
CreateThread(function()
if not myframework then
if GetResourceState("qbx_core") == "started" then
myframework = "qb"
Framework = exports["qb-core"] and exports["qb-core"]:GetCoreObject() or exports["qbx_core"]:GetCoreObject()
elseif GetResourceState("es_extended") == "started" then
myframework = "esx"
Framework = exports["es_extended"]:getSharedObject()
elseif GetResourceState("qb-core") == "started" then
myframework = "qb"
Framework = exports["qb-core"] and exports["qb-core"]:GetCoreObject() or exports["qbx_core"]:GetCoreObject()
else
myframework = "standalone"
end
end
end)
function IsPlayerAdmin(playerid)
for _, identifier in pairs(GetPlayerIdentifiers(playerid)) do
for _, allowed in ipairs(Config.Permissions) do
if string.lower(identifier) == string.lower(allowed) then
return true
end
end
end
if myframework == "qb" then
local QBCore = exports["qb-core"] and exports["qb-core"]:GetCoreObject() or exports["qbx_core"]:GetCoreObject()
if QBCore then
if Framework.Functions.HasPermission(playerid, "admin") or Framework.Functions.HasPermission(playerid, "god") then
return true
end
end
return false
elseif myframework == "esx" then
local xPlayer = Framework.GetPlayerFromId(playerid)
if xPlayer and (xPlayer.getGroup() == "admin" or xPlayer.getGroup() == "superadmin") then
return true
end
return false
else
return IsPlayerAceAllowed(playerid, "admin")
end
end
function SendDiscordLog(playerid, action, objname, objid)
local src = playerid
local playerName = CORE:GetPlayerName(src)
embed = {{
["color"] = 373247,
["fields"] = {
[1] = {
["name"] = "Player Name",
["value"] = playerName,
["inline"] = true
},
[2] = {
["name"] = "Action",
["value"] = action,
["inline"] = true
},
[3] = {
["name"] = Config.locales[Config.Locale].log.obj_name,
["value"] = objname,
["inline"] = true
},
[4] = {
["name"] = Config.locales[Config.Locale].log.obj_id,
["value"] = objid,
["inline"] = true
},
},
}}
PerformHttpRequest(WEBHOOK, function() end, 'POST', json.encode({ username = 'HASO LOGS', embeds = embed}), { ['Content-Type'] = 'application/json' })
endLast updated