11.08.2010, 05:04
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;
}