Quicksort gets lowest score first instead of highest
#3

how is that possible with for instance:

pawn Code:
CMD:teamrank(playerid)
{
    new TRANK, AUSED, BUSED, CUSED, DUSED;
    TRANK = 1;
    AUSED = 0;
    BUSED = 0;
    CUSED = 0;
    DUSED = 0;
    new array[4];
    array[0] = ALPHASCORE;
    array[1] = BRAVOSCORE;
    array[2] = CHARLIESCORE;
    array[3] = DELTASCORE;
   
    quickSort(array, 0, sizeof(array) - 1);
    new dialog[512], stats[128];
    strcat(dialog, "{FFFFFF}..::  "COLOR_LIME"Team Rankings:{FFFFFF} ::..\n");
    strcat(dialog, "\n");
    for(new i; i != sizeof(array); ++i)
    {
        if (array[i] == ALPHASCORE && AUSED == 0)
        {
            format(stats, sizeof stats, "%d: Alpha: "COLOR_GREEN"%d"COLOR_WHITE"\n", TRANK, ALPHASCORE);
            strcat(dialog, stats);
            TRANK = TRANK+1;
            AUSED = 1;
        }
        if (array[i] == BRAVOSCORE && BUSED == 0)
        {
            format(stats, sizeof stats, "%d: Bravo: "COLOR_GREEN"%d"COLOR_WHITE"\n", TRANK, BRAVOSCORE);
            strcat(dialog, stats);
            TRANK = TRANK+1;
            BUSED = 1;
        }
        if (array[i] == CHARLIESCORE && CUSED == 0)
        {
            format(stats, sizeof stats, "%d: Charlie: "COLOR_GREEN"%d"COLOR_WHITE"\n", TRANK, CHARLIESCORE);
            strcat(dialog, stats);
            TRANK = TRANK+1;
            CUSED = 1;
        }
        if (array[i] == DELTASCORE && DUSED == 0)
        {
            format(stats, sizeof stats, "%d: Delta: "COLOR_GREEN"%d"COLOR_WHITE"\n", TRANK, DELTASCORE);
            strcat(dialog, stats);
            TRANK = TRANK+1;
            DUSED = 1;
        }
    }
    ShowPlayerDialog(playerid, D_TEAMRANK, DIALOG_STYLE_MSGBOX, "  ", dialog, "Close", "");
    return 1;
}
Reply


Messages In This Thread
Quicksort gets lowest score first instead of highest - by HireMe - 14.12.2012, 21:50
Re: Quicksort gets lowest score first instead of highest - by Vince - 14.12.2012, 21:52
Re: Quicksort gets lowest score first instead of highest - by HireMe - 15.12.2012, 11:37
Re: Quicksort gets lowest score first instead of highest - by Sinner - 15.12.2012, 12:40

Forum Jump:


Users browsing this thread: 1 Guest(s)