Raised This Month: $32 Target: $400
 8% 

Sort order is mixing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 02-23-2020 , 07:34   Sort order is mixing
Reply With Quote #1

I have this code but sometimes sort order is mixing for public displayasdls(id).
Example:

Nick1 - 10 Goal
Nick2 - 9 Goal
Nick3 - 8 Goal
Nick4 - 7 Goal
Nick5 - 6 Goal

But sometime showing this type:
Nick5 - 6 Goal
Nick4 - 7 Goal
Nick1 - 10 Goal
Nick3 - 8 Goal
Nick2 - 9 Goal

how do i fix this problem?

new MadeRecord[MAX_PLAYER + 1][RECORDS+1]

PHP Code:
Event_Record(idrecordtypeamtexp) {
    if(
amt == -1)
        
MadeRecord[id][recordtype]++
    else
        
MadeRecord[id][recordtype] = amt

    
new playerRecord MadeRecord[id][recordtype]
    if(
playerRecord TopPlayer[1][recordtype])
    {
        
TopPlayer[0][recordtype] = id
        TopPlayer
[1][recordtype] = playerRecord
        
new name[MAX_PLAYER+1]
        
get_user_name(id,name,MAX_PLAYER)
        
format(TopPlayerName[recordtype],MAX_PLAYER,"%s",name)
    }
    
g_Experience[id] += exp
}


////......
if(distshot MadeRecord[ballowner][DISTANCE])
            
Event_Record(ballownerDISTANCEdistshot0)// record distance, and make that distance exp

        
Event_Record(ballownerGOAL, -1gainedxp)
////.... 

Last edited by tepegoz; 02-26-2020 at 02:35.
tepegoz is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-23-2020 , 11:03   Re: Sort order is mixing
Reply With Quote #2

Don't use bubblesort for sorting. Use SortCustom1D(plus this way you are sure the algorithm works properly and there's no further need to debug).
__________________
HamletEagle is offline
tepegoz
Senior Member
Join Date: Apr 2019
Old 02-23-2020 , 19:24   Re: Sort order is mixing
Reply With Quote #3

Can you give me an example about this code?
tepegoz is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-24-2020 , 13:55   Re: Sort order is mixing
Reply With Quote #4

https://www.amxmodx.org/api/sorting/SortCustom1D
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 22:48.


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