Merge pull request #1618 from iSentrie/patch-12

fix(es_extended/server/functions.lua): IsPlayerAdmin group fix
This commit is contained in:
Kenshin13
2025-03-09 23:15:46 +01:00
committed by GitHub
3 changed files with 11 additions and 12 deletions
+1 -3
View File
@@ -3,9 +3,7 @@ name: Bug report
about: Create a report to help us improve
title: "[Bug] - esx_script - Issue"
labels: bug
assignees:
- TheFantomas
- Gellipapa
assignees: Arctos2win, Kenshiin13
---
+1 -3
View File
@@ -3,9 +3,7 @@ name: Feature Request
about: Help us improve esx with your ideas
title: "[Feature Request] - esx_script - Add better configuration"
labels: enhancement
assignees:
- TheFantomas
- Gellipapa
assignees: Arctos2win, Kenshiin13
---
+9 -6
View File
@@ -626,16 +626,19 @@ function ESX.DoesJobExist(job, grade)
return (ESX.Jobs[job] and ESX.Jobs[job].grades[tostring(grade)] ~= nil) or false
end
---@param playerId string | number
---@param playerSrc number
---@return boolean
function Core.IsPlayerAdmin(playerId)
playerId = tostring(playerId)
if (IsPlayerAceAllowed(playerId, "command") or GetConvar("sv_lan", "") == "true") then
function Core.IsPlayerAdmin(playerSrc)
if type(playerSrc) ~= "number" then
return false
end
if IsPlayerAceAllowed(playerSrc --[[@as string]], "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(playerSrc)
return xPlayer and Config.AdminGroups[xPlayer.getGroup()] or false
end
---@param owner string