19.08.2013, 09:54
You need to ****** how to traverse arrays! For this, you need the "for loop"
counter is a variable that gets incremented at each iteration until it reaches the maximum value of the array limit (here, 22) and it will stop (THAT ITERATION won't get executed.) Make sure you use 'break;' after your statement to get OUT of the loop. If you want to skip a particular run (iteration) use continue.
pawn Код:
for(new counter = 0; counter < sizeof(CGLSVehicles); counter++)
{
if(GetPlayerVehicleID(playerid) == CGLSVehicles[counter])
{
// code
}
}