Help with getting all players
#2

Make a global variable which you increase when there's a new survivor (or a player connects) and decrease when a survivor dies (or disconnects).

Easy example:
pawn Код:
new TotalSurvivors=0;

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

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

public OnPlayerDeath(playerid, killerid, reason)
{
    new string[124], PlayerName[MAX_PLAYERNAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName);
    TotalSurvivors--;
    format(string, sizeof(string), "%s has died, there are %i survivors remaining.", PlayerName, TotalSurvivors);
    return 1;
}
Reply


Messages In This Thread
Help with getting all players - by Kudoz - 25.01.2013, 21:43
Re: Help with getting all players - by DrDoom151 - 25.01.2013, 22:13

Forum Jump:


Users browsing this thread: 3 Guest(s)