[Include] Foreach Extended
#1

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.

pawn Код:
foreach(new v : Vehicle)
{
    ChangeVehicleColor(v, 123, 123);
}
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
Reply


Messages In This Thread
Foreach Extended - by Chenko - 09.10.2014, 01:05
Re: Foreach Extended - by Pottus - 09.10.2014, 02:35
Re: Foreach Extended - by Crayder - 09.10.2014, 02:53
Re: Foreach Extended - by Pottus - 09.10.2014, 02:56
Re: Foreach Extended - by Crayder - 09.10.2014, 02:57
Re: Foreach Extended - by Chenko - 09.10.2014, 10:52

Forum Jump:


Users browsing this thread: 1 Guest(s)