Help with getting all players
#1

Hello! I'm making a gamemode, and I need help.
When a player dies, I need it to announce how many people which is still going.

So like, ".: ( %s ) has died! There are ( numbers of surviviors ) opponents left! :."
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)