fix(functions.lua): IsPlayerAdmin group fix

Function failed to properly detect is player admin or not, while GetPlayerFromId function was receiving a string instead of number.
This commit is contained in:
iSentrie
2025-03-02 11:49:04 +02:00
committed by GitHub
parent 74e76ed613
commit 9083a71526
+7 -4
View File
@@ -612,11 +612,14 @@ end
---@param playerId string | number
---@return boolean
function Core.IsPlayerAdmin(playerId)
playerId = tostring(playerId)
if (IsPlayerAceAllowed(playerId, "command") or GetConvar("sv_lan", "") == "true") then
local playerSrc = tostring(playerId)
if IsPlayerAceAllowed(playerSrc, "command") or GetConvar("sv_lan", "") == "true" then
return true
end
local xPlayer = ESX.Players[playerId]
return (xPlayer and Config.AdminGroups[xPlayer.group] and true) or false
local xPlayer = ESX.GetPlayerFromId(tonumber(playerId))
if not xPlayer then return false end
return Config.AdminGroups[xPlayer.getGroup()] or false
end