[Tutorial] [BASIC]How to make a command not work without enough players.
#3

pawn Код:
GetPlayersOnServer()
{
    new count;
    for(new x=0; x< MAX_PLAYERS; x++)
    {
        if(IsPlayerConnected(x))
        {
            count++;
        }
    }
    return count;
}
I don't see how this is going to work. You're not giving 'count' any value, and then you're actually doing:
count = count+1 (count++), but count doesn't have any value, it contains junk.
Just assign a value to count while defining it:
pawn Код:
new count = 0;
Reply


Messages In This Thread
[BASIC]How to make a command not work without enough players. - by RandomDude - 20.04.2013, 13:16
Re: [BASIC]How to make a command not work without enough players. - by Isolated - 20.04.2013, 16:40
Re: [BASIC]How to make a command not work without enough players. - by [XST]O_x - 20.04.2013, 16:54
Re: [BASIC]How to make a command not work without enough players. - by Ash. - 20.04.2013, 17:15
Re: [BASIC]How to make a command not work without enough players. - by RandomDude - 20.04.2013, 17:36

Forum Jump:


Users browsing this thread: 1 Guest(s)