Quote:
Originally Posted by moadi
Hey,
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Thanks in advance .
|
This is a
'For Loop' where
' i ' is your starting value ,
MAX_PLAYERS is till where u want ur loop to run.. that means.. if max players is 10... this loop will run 10 times.. 0 to 10 .. and value of i changes by 1 because of
' i++ ' which is shorter form of
i = i+1
eg:-
ur loop has started NOW
i = 0
it checks if 0< Max players.. if true
then i++
now i = 1
check again.. if true
i++
in short this loop will go on till 'i' = Max Players
u can use this at many places in pawno like if you want check for player being admin u run this loop.. since i<maxplayers.. Ids of players start from 0 will go on till Maxplayers.. that is total players on ur server..
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(i)) SendClientMessage(blhablha);
}
i = 0 goes to id 0 checks if hes admin.. answer no but i is < maxplayers is true so i++
i=1 goest to id 1 checks if hes admin.. answer yes,, send client message , i < maxplayers is true so i++
in short this is a 'LOOP'
i = starting point
i<'x' = limit of loop
i++ = increase counter