Help with foreach
#1

Hi, having problems with converting this:

pawn Код:
for(new i = 1; i < MAX_BUYABLE_VEH; i++)
to foreach. Anyone who can show it?
Reply
#2

Код:
new Iterator:BVeh<MAX_BUYABLE_VEH>;

Itter_Add(BVeh, vehicleid1);
Itter_Add(BVeh, vehicleid2);
Itter_Add(BVeh, vehicleid3);
Itter_Add(BVeh, vehicleid4);

foreach(BVeh, i) printf("vehicle: %d",i); // this is : for(new i = 1; i < MAX_BUYABLE_VEH; i++)

Itter_Remove(BVeh, vehicleid3);
Reply
#3

pawn Код:
stock GetNewVehID()
{

    for(new i = 1; i < MAX_BUYABLE_VEH; i++)
    {
        if(!vInfo[ivCreated[i]][vPrice]) return i;
    }
    return 255;

}
I want to use foreach in this function, but when i use your's example i get errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)