SA-MP Forums Archive
Top 5 ? - 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: Top 5 ? (/showthread.php?tid=421541)



Top 5 ? - Saw® - 09.03.2013

Hey , I'm looking for a tutorial or code getting top 5 players with the best amount in a variable like 'Kills' so the first is for ex 10000kills second 9000 Kills....

I already know how to get the Top player but not top 5 or 4...


thank you


Re: Top 5 ? - Hoda - 09.03.2013

here is a psedu code to start with :
Quote:

Array players[MAX_PLAYERS]
Sort players with key=kills
Top 5 first cell of your array would be biggest ones.
Least 5 cell of your array would be smallest ones.




Re: Top 5 ? - Glad2BeHere - 09.03.2013

http://pastebin.com/XAJS8nqK

Here is something


Re: Top 5 ? - Saw® - 09.03.2013

Thank you ! gonna try it

EDIT : works amazing ! thanks again +rep.