mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
Fix crash when searching npc
This commit is contained in:
+6
-2
@@ -71,16 +71,20 @@ function GetRandomWalkingNPC()
|
||||
|
||||
print('Using fallback code to find walking ped')
|
||||
|
||||
while true do
|
||||
for i=1, 250, 1 do
|
||||
|
||||
local ped = GetRandomPedAtCoord(0.0, 0.0, 0.0, math.huge + 0.0, math.huge + 0.0, math.huge + 0.0, 26)
|
||||
|
||||
if DoesEntityExist(ped) and IsPedHuman(ped) and IsPedWalking(ped) and not IsPedAPlayer(ped) then
|
||||
return ped
|
||||
table.insert(search, ped)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if #search > 0 then
|
||||
return search[GetRandomIntInRange(1, #search)]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ClearCurrentMission()
|
||||
|
||||
Reference in New Issue
Block a user