SA-MP Forums Archive
How to detect when all players are death - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to detect when all players are death (/showthread.php?tid=104708)



How to detect when all players are death - samtmaster - 25.10.2009

I need to detect when all players are death for my gamemode

i will use that to make all players spectate alive players when only a player are alive i make a textdraw announcing the winner
in my gm http://forum.sa-mp.com/index.php?topic=129532.0


Re: How to detect when all players are death - Battleskull - 25.10.2009

I made a script like this but idk if I want to give it out. Crap I don't even know if it works or not xD
But here is detect if all players are dead.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
   new dead,alive;
   for(new i=0; i<MAX_PLAYERS; i++){
     if(spectating[i] == 0) alive++;
   }
   else dead++
}
if(alive == 0)
{
//blah
}
idk something like that