refactor(client/functions): ESX.Game.GetPeds

This commit is contained in:
Csoki
2023-01-22 18:29:06 +01:00
parent 94c36df947
commit cd8bb8b1f7
+7 -2
View File
@@ -537,10 +537,15 @@ function ESX.Game.GetObjects() -- Leave the function for compatibility
end
function ESX.Game.GetPeds(onlyOtherPeds)
local peds, myPed, pool = {}, ESX.PlayerData.ped, GetGamePool('CPed')
local myPed, pool = ESX.PlayerData.ped, GetGamePool('CPed')
if not onlyOtherPeds then
return pool
end
local peds = {}
for i = 1, #pool do
if ((onlyOtherPeds and pool[i] ~= myPed) or not onlyOtherPeds) then
if pool[i] ~= myPed then
peds[#peds + 1] = pool[i]
end
end