View Single Post
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 04-12-2021 , 11:28   Sort order is mixing sometimes
Reply With Quote #1

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

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

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

can you fix this problem or can you convert this script ?
PHP Code:
public displayasdls(id)
{
        new 
teals[1025];
        new 
len 0ix;
        new 
temp_name[64];
        new 
tealrecord[33];
        new 
namerecord[64][64];
        
tealrecord[0]=0;
        for(
i=1;i<=maxplayers;i++)
        {
            if(!
is_user_bot(i) &&  !is_user_hltv(i) && is_user_connected(i)){        
                
tealrecord[i]=MaleRecord[i][TEAL];
                
get_user_name(inamerecord[i], 13)
            }
        }
        
            for(
i=1;i<=maxplayers;i++)
            {
                if(
tealrecord[i]>tealrecord[i-1])
                {
                    
x=tealrecord[i];
                    
tealrecord[i]=tealrecord[i-1];
                    
tealrecord[i-1]=x;
                    
temp_name=namerecord[i];
                    
namerecord[i]=namerecord[i-1];
                    
namerecord[i-1]=temp_name;
                }

        }
        
len += format(steals[len], 512-len"TOP TEAL^n^n")
        
len += format(steals[len], 512-len"%s  -  %i^n",namerecord[0], tealrecord[0])
        
len += format(steals[len], 512-len"%s  -  %i^n",namerecord[1], tealrecord[1])
        
len += format(steals[len], 512-len"%s  -  %i^n",namerecord[2], tealrecord[2])
        
len += format(steals[len], 512-len"%s  -  %i^n",namerecord[3], tealrecord[3])
        
len += format(steals[len], 512-len"%s  -  %i",namerecord[4], tealrecord[4])
        
        
set_dhudmessage(02550,  0.380.000.23.00.20.1)
        
show_dhudmessage(id"%s"teals)

PHP Code:
new MaleRecord[MAX_PLAYER 1][RECORDS+1

Last edited by tepegoz; 04-16-2021 at 13:59.
tepegoz is offline