21.03.2010, 23:24
How to put number of player currently playing ?
Exemple : %s joined the server. currently playing (Number Of Player)
Exemple : %s joined the server. currently playing (Number Of Player)
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "%s (%d) Has joined the server", name, playerid);
SendClientMessageToAll(0x808080FF, str);
return 1;
}
new PlayersCount;
public OnPlayerConnect(playerid)
{
PlayersCount++;
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "%s (%d) Has joined the server. [Current Players: %d]", name, playerid, PlayersCount);
SendClientMessageToAll(0x808080FF, str);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayersCount--;
return 1;
}
Originally Posted by Noredine
Doesn't work
I have error with PlayerCounts++ |
Originally Posted by the_chaoz
thy this:
pawn Код:
|
new count;
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
count++;
}
Originally Posted by GTAIV2008
pawn Код:
|
Originally Posted by GTAIV2008
Add it where you want to use it
![]() In cmds or something like that, the code above is NOT an actual function working on its own. |