Raised This Month: $ Target: $400
 0% 

Rank sorting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 02-18-2007 , 13:19   Re: Rank sorting
Reply With Quote #1

http://www.amxmodx.org/funcwiki.php?go=func&id=1115
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 02-18-2007 , 13:29   Re: Rank sorting
Reply With Quote #2

Quote:
Originally Posted by P34nut View Post
It's done by ID numbers, and i need alot more then that i already know that command
Deviance is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-18-2007 , 13:54   Re: Rank sorting
Reply With Quote #3

This is how GunGame does it.

Code:
 public get_sorted_players()  {     new i, count;     static sort[33][2], maxPlayers;     if(!maxPlayers) maxPlayers = get_maxplayers();     for(i=1;i<=maxPlayers;i++)     {         sort[count][0] = i;         sort[count][1] = score[i];         count++;     }     SortCustom2D(sort,count,"stats_custom_compare");  }  // our custom sorting function (check second dimension for score)  public stats_custom_compare(elem1[],elem2[])  {     if(elem1[1] > elem2[1]) return -1;     else if(elem1[1] < elem2[1]) return 1;     return 0;  }

Assuming that "score" is the variable that you want to sort by. When it's done, sort[0][0] = highest scoring player's id, sort[0][1] = highest scoring player's score; sort[1][0] = second highest scoring player's id, sort[1][1] = second highest scoring player's score; etcetera.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode