Show online players...
#1

Could anyone help make a simple online players, with timer that shows every 10 minutes. then sendclienttoall like this
"Online players 42"
Reply
#2

just make a loop.
Reply
#3

you make simple variable that tracks numer of players...
everytime someone join you incremet it and vice versa.
then you create timer that reapet it self and sends a message
Reply
#4

pawn Код:
public OnGameModeInit()
{
    SetTimer("OnlinePlayersAnnounce", 600000, 1);
    return 1;
}

forward OnlinePlayersAnnounce();
public OnlinePlayersAnnounce()
{
    new playersOnlineString[30];
    format(playersOnlineString, sizeof(playersOnlineString), "Online players: %d", GetTotalPlayerCount());
    SendClientMessageToAll(-1, playersOnlineString);
    return 1;
}

GetTotalPlayerCount()
{
    new playerCount;
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            playerCount++;
        }
    }

    return playerCount;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)