//Top of script
enum e_wanted_level_sort_data {E_WANTED_PLAYERID, E_WANTED_LEVEL};
new WantedLevel2[MAX_PLAYERS][e_wanted_level_sort_data];
//Command
WantedLevel2[0][E_WANTED_LEVEL]=66;
WantedLevel2[1][E_WANTED_LEVEL]=22;
WantedLevel2[2][E_WANTED_LEVEL]=33;
WantedLevel2[3][E_WANTED_LEVEL]=11;
WantedLevel2[4][E_WANTED_LEVEL]=35;
SortDeepArray(WantedLevel2, E_WANTED_LEVEL);
for (new i = 0; i < 5; i++) {
printf("e_wanted_level_sort_data[%d] = {%d,%d}", i, WantedLevel2[i][E_WANTED_PLAYERID],WantedLevel2[i][E_WANTED_LEVEL]);
}
[19:40:08] e_wanted_level_sort_data[0] = {0,0}
[19:40:08] e_wanted_level_sort_data[1] = {0,0}
[19:40:08] e_wanted_level_sort_data[2] = {0,0}
[19:40:08] e_wanted_level_sort_data[3] = {0,0}
[19:40:08] e_wanted_level_sort_data[4] = {0,0}
|
You're only printing the first 5 cells in that loop but the array is 500 cells big (or whatever MAX_PLAYERS is)
Run it with this loop: pawn Код:
Spoiler: Since you sorted by the default sort (ascending) the list will go from the lowest value to the highest. Since you only set the first 5 cells, the rest will be 0 and thus be at the top when you sort it. Try sorting the list descending and then the highest value will be in cell 0. |