Show the top ten richest people.
#8

Well, if you don't mind using third party includes, using this: https://sampforum.blast.hk/showthread.php?tid=343172
you could outperform the code above at the cost of memory.

pawn Code:
new RichList[MAX_PLAYERS][2];

stock FindRichest()
{
     RichList = {{0,0}...}; // Reset the array in case you only want online players to show up, u probs gotta rely on a loop there.. this doesn't work I am sure but you get the point.
    foreach(new p : Player) // obv if u dont have foreach, yanno
    {
        RichList[p][0] = GetPlayerMoney(p);
        RichList[p][1] = p;
    }
    SortDeepArray(RichList, 0);
    // richest are:
    RichList[200][1], RichList[199][1], RichList[198][1], RichList[197][1]
}
The code above is more or less pseudo code and probably doesn't work the way I wrote it but I am sure you get the picture =).

Regards.
Reply


Messages In This Thread
Show the top ten richest people. - by Arca - 17.08.2012, 01:16
Re: Show the top ten richest people. - by Ranama - 17.08.2012, 01:58
Re: Show the top ten richest people. - by Steven82 - 17.08.2012, 02:44
Re: Show the top ten richest people. - by Arca - 17.08.2012, 03:25
Re: Show the top ten richest people. - by Deal-or-die - 17.08.2012, 03:48
Re: Show the top ten richest people. - by kbalor - 17.08.2012, 05:09
Re: Show the top ten richest people. - by Arca - 17.08.2012, 05:11
Re: Show the top ten richest people. - by Extremo - 23.08.2012, 09:53

Forum Jump:


Users browsing this thread: 1 Guest(s)