SA-MP Forums Archive
Getting The Player With The Highest Kills? - 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: Getting The Player With The Highest Kills? (/showthread.php?tid=96527)



Getting The Player With The Highest Kills? - GTA967 - 08.09.2009

My friend asked me if i could help him finish his script but i cant figure out what the problem with it is. I have got this http://pastebin.com/m44cbdb97 so far but it is only return id 0 as shown here > i have a timer that uses the function every minute and bots to test this on but it is only returning id 0


Re: Getting The Player With The Highest Kills? - Jefff - 08.09.2009

Код:
stock GetWinner()
{
	new bestkills = 0;
	new id = INVALID_PLAYER_ID;
	for(new i = 0; i < GetMaxPlayers(); i++)
	{
		if(Kills[i] > bestkills) {
			bestkills = Kills[i];
			id = i;
		}
	}
	return id;
}