SA-MP Forums Archive
Show online players... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Show online players... (/showthread.php?tid=375969)



Show online players... - kbalor - 08.09.2012

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


Re: Show online players... - leonardo1434 - 08.09.2012

just make a loop.


Re: Show online players... - detter - 08.09.2012

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


Re: Show online players... - SuperViper - 08.09.2012

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;
}