[Include] inline-sort.inc - The solution to all your sorting needs
#5

I've updated the include with player helpers now. It's now very easy (and more efficient) to sort players!

Here's an example how to sort players based on the value in g_Money:
pawn Код:
new g_Money[MAX_PLAYERS];

public OnSomething()
{
    // Sort all players based on the value in g_Money
    new PlayerArray<top_money>;

    sortPlayersInline top_money => (R = l > r) {
        R = g_Money[l] > g_Money[r];
    }

    forPlayerArray (top_money => playerid) {
        printf("%d has $%d", playerid, g_Money[playerid]);
    }
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)