From 9083a7152645632cb2e84616e2a300d5aa3dabfb Mon Sep 17 00:00:00 2001 From: iSentrie Date: Sun, 2 Mar 2025 11:49:04 +0200 Subject: [PATCH] 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. --- [core]/es_extended/server/functions.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/[core]/es_extended/server/functions.lua b/[core]/es_extended/server/functions.lua index 12417065..2a57fc0f 100644 --- a/[core]/es_extended/server/functions.lua +++ b/[core]/es_extended/server/functions.lua @@ -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