help with foreach!

hello, im using for each functions in my command /vehicle.
i want to ask that should i use Iter_SafeRemove(.. .. ..) when vehicle destroy?
if yes can anyone tell me why?

i create car like..
Iter_Add(NormalVeh,CreateVehicle(veh, X+3, Y, Z, angle, -1, -1, -1));

but when i use iter_add(vehiclecode then itercount gets ++ and on destroy vehicles it doesnt get --
so thats why i thought to use iter_SafeRemove. to decrease count for vehicles.

[EDIT]: and i made 2 more types of vehicles. adminvehicles and donator vehicles.
sometimes it get mixed.
when i spawn donator vehicle. it becomes admin vehicle. on enter in vehicle it says to me admin vehicle. even i spawned by using donator vehicle spawn command

i have to use Iter_Remove in a loop? (Foreach Loop)?
and i used like this

under OnVehicleDeath

if(Iter_Contains(AdminVeh, vehicleid))Iter_Remove(AdminVeh, vehicleid);

it will work fine?

[EDIT]: Please read my Reply again i've edited something again!

can you read my replies again?

That should work, even if you haven't used Iter_Contains, Iter_Remove removes values only if they're found.

so Iter_Remove will decrease number of vehicles from given iterator like? we use AnyVariable--;

Forum Jump:

Users browsing this thread: 1 Guest(s)