This code shows only current online player and sorts data according, how can i fix it to show top15 from vault not online players xp.
PHP Code:
public show_top(id){
static Sort[33][2];
new players[32],num,count,index;
get_players(players,num);
for(new i = 0; i < num; i++){
index = players[i];
Sort[count][0] = index;
Sort[count][1] = g_XP[index];
count++;
}
SortCustom2D(Sort,count,"compare_xp");
new motd[1501],iLen;
iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%s %-22.22s %3s^n", "#", "Name", "XP Top10");
new y = clamp(count,0,10);
new name[32],kindex;
for(new x = 0; x < y; x++){
kindex = Sort[x][0];
get_user_name(kindex,name,sizeof name - 1);
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%d %-22.22s %d^n", x + 1, name, Sort[x][1]);
}
iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"</body></font></pre>");
show_motd(id,motd, "XP Top 10");
}
public compare_xp(elem1[], elem2[])
{
if(elem1[1] > elem2[1])
return -1;
else if(elem1[1] < elem2[1])
return 1;
return 0;
}
__________________