mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 03:01:31 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user