Count how many players are connected
#1

Hello,

I'd need to count how many players are ingame(for a tp command ) , but can't figure out how to do it. I'm pretty sure there is a simple function doing this, can you help me to find it ?

Thanks,
Reply
#2

pawn Код:
new playersC;

public OnPlayerConnect(playerid)
{
    playersC ++;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    playersC --;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/playersC", true))
    {
        static string[21];
        format(string, 21, "players in-game: %02i", playersC);
        return SendClientMessage(playerid, -1, string);
    }
    return 0;
}
Reply
#3

Use foreach include and:
Код:
Iter_Count(Player);
Reply
#4

Ok(falcon) thats the way i do it, but i asked in case there is an other way to do it.
I'll look at the foreach include

Thanks guys,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)