help with loop for(new loop
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
That's still wrong. It will list all jailed players and if the last slot isn't used it will also send the "no jailed" message. You need to keep a counter inside the loop which increments each time a jailed player is found. Then check if the counter is 0 when the loop is finished.
Like this ?
pawn Код:
new counter;
for(new x; x<MAX_PLAYERS; x++)
{
    if(PlayerInfo[x][pjailed] == 1)
    {
        counter ++;
        //list jailed players
    }
    if(x == MAX_PLAYERS -1 && !counter)
    {
        //no players in jail
    }
}
Reply


Messages In This Thread
help with loop for(new loop - by danish007 - 14.01.2015, 13:22
Re: help with loop for(new loop - by xVIP3Rx - 14.01.2015, 13:29
Re: help with loop for(new loop - by Vince - 14.01.2015, 14:19
Re: help with loop for(new loop - by xVIP3Rx - 14.01.2015, 14:29
Re: help with loop for(new loop - by Threshold - 14.01.2015, 15:39
Re: help with loop for(new loop - by danish007 - 14.01.2015, 16:09
Re: help with loop for(new loop - by danish007 - 18.01.2015, 07:40

Forum Jump:


Users browsing this thread: 2 Guest(s)