09.10.2014, 01:05
Foreach Extended
I recently had the need to optimize vehicle loops so I thought the best way to do that would be to use foreach so that I wouldn't loop through vehicles that didn't exist. I thought other developers might need to do this sometime so I figured I'd put together an include that creates an iterator to store valid vehicle IDs by hooking CreateVehicle, AddStaticVehicle, etc.
If people like this and wish for me to add iterators for things such as objects, pickups, etc to the include I'd be happy to do so but I don't have a need for it currently so it is only vehicles.
Functions
This include does not add any new functions but does add a new iterator called "Vehicle" for use with foreach or y_iterate.
Usage
You use this include as you would any other foreach loop.
Dependencies
Since this include is made for foreach it requires either foreach or y_iterate to be included before it.
Foreach
OR
YSI (Specifically y_iterate)
Credits
****** for foreach and y_iterate
Download
Github
I recently had the need to optimize vehicle loops so I thought the best way to do that would be to use foreach so that I wouldn't loop through vehicles that didn't exist. I thought other developers might need to do this sometime so I figured I'd put together an include that creates an iterator to store valid vehicle IDs by hooking CreateVehicle, AddStaticVehicle, etc.
If people like this and wish for me to add iterators for things such as objects, pickups, etc to the include I'd be happy to do so but I don't have a need for it currently so it is only vehicles.
Functions
This include does not add any new functions but does add a new iterator called "Vehicle" for use with foreach or y_iterate.
Usage
You use this include as you would any other foreach loop.
pawn Код:
foreach(new v : Vehicle)
{
ChangeVehicleColor(v, 123, 123);
}
Since this include is made for foreach it requires either foreach or y_iterate to be included before it.
Foreach
OR
YSI (Specifically y_iterate)
Credits
****** for foreach and y_iterate
Download
Github