19.02.2013, 10:54
hello guys i am new to foreach so its my first time i made this, and i decided to use foreach as many people say its easy and much better than and much less CPU Usage
so i am asking how to loop a vehicle using foreach? i've tried using ****** code on example but it give's me error
here's my code
and give's me warning
pawn Код:
for (new i = 0; i <MAX_VEHICLES; i++)
or
for (new i = 0; i <MAX_PLAYERS; i++)
here's my code
pawn Код:
new Iterator:Vehicles<MAX_VEHICLES>; // global variable
foreach(new vehicleid : Vehicles)
{
//Loop through all the vehicles and set their fuel levels at DEF_GAS
CarFuel[vehicleid] = DEF_GAS;//gives 100% gas to all vehicles
}
pawn Код:
warning 203: symbol is never used: "Vehicles@YSII_Cg"