Quote:
Originally Posted by Exolent[jNr]
1. Array sizes have to be constant and cannot be dependent on a variable.
If you need to have a dynamic array size, look into cell arrays.
2. You don't even need that list.
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
new players[32], num
get_players(players, num, "ch")
SortCustom1D(players, num, "sortHelper")
// players are sorted
return PLUGIN_HANDLED
}
public sortHelper(const index1, const index2, const players[], const data[], const data_size)
{
new diff = gi_playerFrags[players[index2]] - gi_playerFrags[players[index1]]
return (diff < 0) ? -1 : (diff ? 1 : 0)
}
|
1. I only wanted it dynamic like that so i wouldn't have to have more cells then needed. But if its not possible, screw it.
2. wouldn't that change the frags for the players? because frags are stored in the cell index that correlates to their playerID, this would rearrange values, but not IDs. I need to keep both numbers together.
Though i must say....that return statement gives me a nerd-on.
__________________