29.05.2015, 11:55
It can be improved a lot by using foreach.
"Player" iterator is still much faster than using GetPlayerPoolSize.
About the vehicles, I create/destroy vehicles only in the gamemode so I've created an iterator called "Vehicle" and everytime a vehicle is created, I add it to the iterator and remove it when it's get destroyed. By that, if the server has 5 created vehicles, it will just loop 5 times ONLY instead of 2000.
"Player" iterator is still much faster than using GetPlayerPoolSize.
About the vehicles, I create/destroy vehicles only in the gamemode so I've created an iterator called "Vehicle" and everytime a vehicle is created, I add it to the iterator and remove it when it's get destroyed. By that, if the server has 5 created vehicles, it will just loop 5 times ONLY instead of 2000.