08.09.2012, 17:47
Could anyone help make a simple online players, with timer that shows every 10 minutes. then sendclienttoall like this
"Online players 42"
"Online players 42"
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;
}