Fix crash when searching npc

This commit is contained in:
Jérémie N'gadi
2017-09-14 21:16:56 +02:00
parent 5c4ca0168e
commit 3eb7d27761
+6 -2
View File
@@ -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()