[Help] Simple LITTLE question.
#7

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
Reply


Messages In This Thread
[Help] Simple LITTLE question. - by moadi - 06.10.2011, 17:50
Re: [Help] Simple LITTLE question. - by IstuntmanI - 06.10.2011, 18:24
Re: [Help] Simple LITTLE question. - by moadi - 06.10.2011, 18:28
Re: [Help] Simple LITTLE question. - by System64 - 06.10.2011, 18:52
Re: [Help] Simple LITTLE question. - by [HiC]TheKiller - 06.10.2011, 19:16
Re: [Help] Simple LITTLE question. - by Kingunit - 06.10.2011, 19:27
Re: [Help] Simple LITTLE question. - by spd_sahil - 06.10.2011, 19:41
Re: [Help] Simple LITTLE question. - by MoroDan - 06.10.2011, 19:55

Forum Jump:


Users browsing this thread: 5 Guest(s)