12.08.2010, 20:51
Код:
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; }