on all players death once restart game mode?
#1

script so when all players die atleast once (1) the game mode restarts and it says all players have died restarting now all help appreciated!
Reply
#2

pawn Код:
forward Restart();

public OnPlayerDeath(playerid, killerid, reason)
{
    SetPVarInt(playerid, "HasDied", 1);
   
    if(DeadPlayers == TotalPlayers)
    {
        SetTimer("Restart", 5000, 0);
        SendClientMessageToAll(0xFFFAFA, "All the players have died, server will restart in 5 seconds!");
    }
    return 1;
}

public Restart()
{
    SendRconCommand("gmx");
    return 1;
}

stock DeadPlayers()
{
    new deadplayers;
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        if(GetPVarInt(x, "HasDied") == 1)
        {
            deadplayers++;
        }
    }
    return deadplayers;
}

stock TotalPlayers()
{
    new players;
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        players++;
    }
    return players;
}
Reply
#3

Quote:
Originally Posted by PotH3Ad
Посмотреть сообщение
pawn Код:
forward Restart();

public OnPlayerDeath(playerid, killerid, reason)
{
    SetPVarInt(playerid, "HasDied", 1);
   
    if(DeadPlayers == TotalPlayers)
    {
        SetTimer("Restart", 5000, 0);
        SendClientMessageToAll(0xFFFAFA, "All the players have died, server will restart in 5 seconds!");
    }
    return 1;
}

public Restart()
{
    SendRconCommand("gmx");
    return 1;
}

stock DeadPlayers()
{
    new deadplayers;
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        if(GetPVarInt(x, "HasDied") == 1)
        {
            deadplayers++;
        }
    }
    return deadplayers;
}

stock TotalPlayers()
{
    new players;
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        players++;
    }
    return players;
}
doesnt work has alot of errors cant compile it
Reply
#4

Quote:
Originally Posted by Aztecking
Посмотреть сообщение
what are the errors
undefined crap and warnings that setpvart has no effect idk can someone just help me make a script that restarts the game once TEAM_HIDER 0 has no people in it? i tried making a HiderCount but it failed maybe its just me
Reply
#5

Код:
forward Restart();

public OnPlayerDeath(playerid, killerid, reason)
{
    SetPVarInt(playerid, "HasDied", 1);
   new dead = DeadPlayers();
   new total = TotalPlayers();
    if(dead == total)
    {
        SetTimer("Restart", 5000, 0);
        SendClientMessageToAll(0xFFFAFA, "All the players have died, server will restart in 5 seconds!");
    }
    return 1;
}

public Restart()
{
    SendRconCommand("gmx");
    return 1;
}

stock DeadPlayers()
{
    new deadplayers;
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        if(GetPVarInt(x, "HasDied") == 1) deadplayers++;
    }
    return deadplayers;
}

stock TotalPlayers()
{
    new players;
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        if(IsPlayerConnected(x))
        players++;
    }
    return players;
}
This should work fine
Reply
#6

Quote:
Originally Posted by wups
Посмотреть сообщение
Код:
forward Restart();

public OnPlayerDeath(playerid, killerid, reason)
{
    SetPVarInt(playerid, "HasDied", 1);
   new dead = DeadPlayers();
   new total = TotalPlayers();
    if(dead == total)
    {
        SetTimer("Restart", 5000, 0);
        SendClientMessageToAll(0xFFFAFA, "All the players have died, server will restart in 5 seconds!");
    }
    return 1;
}

public Restart()
{
    SendRconCommand("gmx");
    return 1;
}

stock DeadPlayers()
{
    new deadplayers;
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        if(GetPVarInt(x, "HasDied") == 1) deadplayers++;
    }
    return deadplayers;
}

stock TotalPlayers()
{
    new players;
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        if(IsPlayerConnected(x))
        players++;
    }
    return players;
}
This should work fine
is it possible to restart when TEAM_HIDER 0 has no people in it because onplayer death it sets the people to another team and i want it to restart when all die and are set to the other team?
Reply
#7

Quote:
Originally Posted by Aztecking
Посмотреть сообщение
do you have the lastest includes.
But I think it would be easier to restart when TEAM_HIDER 0 has no people in it.
Reply
#8

pawn Код:
forward RestartCheck();
OnGameModeInit()
{
  SetTimer("RestartCheck" 5000, true);


}

public RestartCheck()
{
new x;
 for(new i;i<MAX_PLAYERS;i++)
 {
    if(IsPlayerConnected(i))
    {
       if(PUT YOUR FUNCTION HERE TO CHECK TEAM(i) == TEAM_HIDER) x++


    }


 }
if(x == 0) SendRconCommand("gmx");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)