hoekay, i have an array that i want to sort from highest to lowest. And in an attempt to do so i ran into 2 questions.
1: why can't i declare an array as such:
Spoiler
Code:
// global
new gMaxPlayers
// init
gMaxPlayers = get_maxplayers()
// function
new list[gMaxPlayers+1][2]
I want to make the list array as small as possible....
2: is this right, and efficient? The wiki was kinda vague.
Spoiler
How do i get the array size of a non-string?
What is the function of array[][]? just to show the function what is oging on in the array?
What is data[] in SortCustom2D?
Code:
public cmdRank(id)// Possibly replace nVault with SQL, makes sorting easier and more efficient{if(get_pcvar_num(toggle_pcvar)==0 || get_pcvar_num(frags_pcvar))return PLUGIN_CONTINUE
// devlop to MOTD listing of server-wide rank (connected players// list [playerID] [playerFrags]new list[32][2], players[32], num
get_players(players, num, "ch")// Put the player's frags into list[] to sort later.for(new i=0, id; i < num; i++){
id = players[i]
list[i][0]= id
list[i][1]= gi_playerFrags[id]}
SortCustom2D(list, 32, "sortHelper")return PLUGIN_HANDLED
}public sortHelper(const index1[], const index2[]){static o, t
o = index1[0]
t = index2[0]log_to_file(debugLogFile, "index1[0]: %d, index2[0]: %d", o, t)if(o > t)return-1elseif(o == t)return0return1}
__________________
What an elegant solution to a problem that doesn't need solving....