SA-MP Forums Archive
The code for ending a match. - 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)
+--- Thread: The code for ending a match. (/showthread.php?tid=379851)



The code for ending a match. - KingyKings - 23.09.2012

First can you just breifly tell me how i can do a Textdraw countdown for 5 Mins at the top left of the screen. Thanks

The main thing i need help with is ending the match. I need the match to end if all of one team is dead. I have made it so when someone dies they will be put into spectate mode. I now need to make it so when everyone on that team is dead it will freeze everyone and say match over (red/blue) team has won!

I will be grateful and +rep if you can help me out on this.

Thanks


Re: The code for ending a match. - Squirrel - 23.09.2012

Check if all players are dead

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    new 
j,klid;
    for(new 
i=0MAX_PLAYERSi++) // Loop through players (foreach Recommended)
    
{
        if(
cantspawn[i] == 0) {j++; klid=i;} // If someone is alive, increase j by 1; Save playerid in klid.
        
if(1) break; // If j is more than 1, break loop (for efficiency)
    
}
    
    if(
== 1// Check that there is only 1 player alive
    
{
        
// klid is the winner.
    
}
    return 
1;

I hope it helps


Re: The code for ending a match. - Audi_Quattrix - 23.09.2012

nvm*