Jump to content

Pedestrians loop


Drakath

Recommended Posts

Posted

When I do:

for i, ped in ipairs(getElementsByType("ped")) do 
end 

Is it possible that ped won't exist? Should I check it with isElement like so:

for i, ped in ipairs(getElementsByType("ped")) do 
if isElement(ped) then 
end 
end 

?

  • MTA Team
Posted
you must replace it

Stop that nonsense.

@Drakath:

The ped should exist in that server tick, when you script runs the loop.

You can always use a isElement check if you want to be 100% sure.

Posted

in a milisecond it gets executed it will get all valid ped elements so you don't have to check if ped is element since chances of getting a ped which isn't an element are 0.0000000000000000000000001%

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...