SA-MP Forums Archive
How to detect a winner if killerid is invalid? - 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: How to detect a winner if killerid is invalid? (/showthread.php?tid=504868)



How to detect a winner if killerid is invalid? - rangerxxll - 06.04.2014

I'm trying to detect the winner if the second to last player kills himself. I want to get the remaining players name, etc. How would I go about doing this? I've attempted to create it, but I'm not too sure how to create it.

Here's the code I have.

pawn Код:
if(killerid == INVALID_PLAYER_ID)
        {
            if(IsPlayerReady[playerid] == 1 && GameProgress == 1)
            {
                PlayerCount --;
            }
            else if(IsPlayerReady[playerid] == 1 && GameProgress == 1 && PlayerCount == 2)
            {
                PlayerCount --;
                foreach(Player, i)
                {
                    EndRound(i);
                }
            }
        }