Using arrays?
#2

You need to ****** how to traverse arrays! For this, you need the "for loop"

pawn Код:
for(new counter = 0; counter < sizeof(CGLSVehicles); counter++)
{
      if(GetPlayerVehicleID(playerid) == CGLSVehicles[counter])
      {
              // code
      }
}
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.
Reply


Messages In This Thread
Using arrays? - by arjanforgames - 19.08.2013, 09:50
Re: Using arrays? - by RajatPawar - 19.08.2013, 09:54
Re: Using arrays? - by Ash. - 19.08.2013, 09:55
Re: Using arrays? - by Pottus - 19.08.2013, 13:23
Re: Using arrays? - by Cypress - 19.08.2013, 13:30
Re: Using arrays? - by Edix - 19.08.2013, 14:37
Re: Using arrays? - by Vince - 19.08.2013, 15:40
Re: Using arrays? - by Jefff - 19.08.2013, 16:56
Re: Using arrays? - by Ash. - 21.08.2013, 23:58

Forum Jump:


Users browsing this thread: 2 Guest(s)