Checking how much players are currently online
#2

pawn Код:
stock GetOnlinePlayers()
{
    new amount;
    foreach(Player, i)
    {
        //if(IsPlayerConnected(i))
        amount++;
    }
    return amount;
}
This wasn't tested, though I assume it would work how you want.
I can't remember if foreach checks if the ploayer is connected manually itself. If not, just uncomment that line.

Example of use;
pawn Код:
if(GetOnlinePlayers() < 20) return SendClientMessage(playerid, -1, "There are not enough players online to do this!");
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)