SA-MP Forums Archive
How to identify the winner?? - 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 identify the winner?? (/showthread.php?tid=515255)



How to identify the winner?? - Ali98 - 25.05.2014

Hello,
I was trying to make last man standing event recently
I just have faced a problem,How can I get the winner ? (the remaining player)


Re: How to identify the winner?? - biker122 - 25.05.2014

Make a new function "CheckLMS" and check it once when someone disconnects/leaves the event.
It would be good if you could post your codes. We can't guess your codes..


Re: How to identify the winner?? - SyntaxQ - 25.05.2014

I'm already working on a Last Man Standing filterscript..

I do it like this:
I make a variable that counts the total players, increment it on joining and decrement on leaving and OnPlayerDeath. I check it on OnPlayerDeath callback:
- rough code
pawn Код:
//OnPlayerDeath
if (playerCount == 1)
{
     //loop through all the players present in last man standing and get the name & id (it will get the name and id   of the remaining player because there is only 1 player present in LMS (which was found by our playerCount variable)
     // send message to all
}
I still have to test it, but i don't think there is any other way..


Re: How to identify the winner?? - Ali98 - 25.05.2014

It seems the simplest and easier way
thanks.