Raised This Month: $ Target: $400
 0% 

[solved] SortCustom2D with more than 3000values


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
noname\
Junior Member
Join Date: Jun 2007
Old 06-23-2007 , 05:06   [solved] SortCustom2D with more than 3000values
Reply With Quote #1

problem solved by sawce by adding #pragma dynamic 32768


i have used this script before, and it works fine. but now there is a stack error.
if i change the array_size to 3000 it will be executed.
Code:
SortCustom2D(sort,countn,"stats_custom_compare");/*countn=~4000*//*wont work*/ SortCustom2D(sort,3000,"stats_custom_compare");/*works*/


is there any way to fix it?


part of the script:
Code:
#include <amxmodx> #include <amxmisc> public bbrank_topx() {     static sortn[5000][2]     new lines[256], countn, hashidlvls[32], xppntlvls[32]     new configsdirs[256], playerslvls[256]     get_configsdir(configsdirs,255)     format(playerslvls,255,"players.lvl")     new playerslvlfp=fopen(playerslvls,"r")     if(playerslvlfp)     {         while(fgets(playerslvlfp,lines,255))         {             parse(lines,hashidlvls,31,xppntlvls,31)             if(!equal(xppntlvls,""))             {                 sortn[countn][0] = str_to_num(hashidlvls)                 sortn[countn][1] = str_to_num(xppntlvls)                 countn++             }         }         fseek(playerslvlfp,0,0)     }     SortCustom2D(sortn,countn,"stats_custom_compare");     /*[...]*/     return PLUGIN_CONTINUE } // 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; }


players.lvl (~4000lines)
Code:
1177353836
18244 0.000000
45408503 0.000000
85855008 9669010.000000
184481526 111581.671875
131327360 59691.257812
190911329 31731.560547
162650882 2714077.000000
[...]
__________________

\\brainbread server with live ranking system and webstatistics

Last edited by noname\; 06-24-2007 at 00:08. Reason: problem solved
noname\ is offline
 



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 21:34.


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