refactor: simplify the GetExtendedPlayers function

This commit is contained in:
MoskalykA
2023-06-26 13:26:24 +02:00
parent fca0756c65
commit 5e44373d80
+3 -5
View File
@@ -214,13 +214,11 @@ end
ESX.GetPlayers = GetPlayers
function ESX.GetExtendedPlayers(key, val)
if not key then return ESX.Players end
local xPlayers = {}
for k, v in pairs(ESX.Players) do
if key then
if (key == 'job' and v.job.name == val) or v[key] == val then
xPlayers[#xPlayers + 1] = v
end
else
if (key == 'job' and v.job.name == val) or v[key] == val then
xPlayers[#xPlayers + 1] = v
end
end