Top CMD Help
#1

I was making a /top CMD, through which players can see the name of the player who got highest score/kills/spree in recent 12 hours.

But, somehow, bugs kept coming, and kept making a new logic, more effective each time, and I think I'm close enough, but a bug is still remaining.

Here's the code, I hope you guys can help me (p.s my first time requesting help on samp forums so take it easy )

PHP код:
if(killerid != INVALID_PLAYER_ID)
    {
            new 
PlayerScore[5], PlayerName[5][MAX_PLAYER_NAME];
            for(new 
i=05i++)
            {
                 if(!
strcmp(TopScore[i][pPlayer], GetName(killerid)))
                {
                    if(
TopInfo[killerid][Score] > TopScore[i][pScore])
                    {
                        if(
!= && != 0)
                        {
                            new 
i;
                            for(new 
j=k> -1j--)
                            {
                                new 
lj-1;
                                if(
TopInfo[killerid][Score] > TopScore[l][pScore])
                                {
                                    
l;
                                    
PlayerScore[l] = TopScore[l][pScore];
                                    
PlayerName[l] = TopScore[l][pPlayer];
                                }
                            }
                            for(new 
j=k> -1j--)
                            {
                                new 
lj-1;
                                if(
TopInfo[killerid][Score] > TopScore[l][pScore])
                                {
                                    
TopScore[l-1][pScore] = PlayerScore[l];
                                    
TopScore[l-1][pPlayer] = PlayerName[l];
                                }
                            }
                        }
                        
TopScore[i][pScore] = TopInfo[killerid][Score];
                        
TopScore[i][pPlayer] = GetName(killerid);
                    }
                    break;
                }
                else continue;
            }                            
            for(new 
y=05y++)
            {
                        if(
strcmp(TopScore[y][pPlayer], GetName(killerid)) && TopInfo[killerid][Score] > TopScore[y][pScore])
                        {
                                if(
!= && != 0)
                                {
                                    new 
y;
                                    for(new 
j=k5j++)
                                    {
                                        
//new l= j+1;
                                         
PlayerScore[j] = TopScore[j][pScore];
                                        
PlayerName[j] = TopScore[j][pPlayer];
                                    }
                                    for(new 
j=k5j++)
                                    {
                                        
TopScore[j+1][pScore] = PlayerScore[j];
                                           
TopScore[j+1][pPlayer] = PlayerName[j];
                                    }
                                }
                                
TopScore[y][pScore] = TopInfo[killerid][Score];
                                
TopScore[y][pPlayer] = GetName(killerid);
                                break;
                        }
                        else continue;
            }
        } 
Reply
#2

bump
Reply
#3

What is the bug? What's going wrong with it?
Reply
#4

Quote:
Originally Posted by CSLangdale
Посмотреть сообщение
What is the bug? What's going wrong with it?
CSLangdale can you help me ? This is my problem

Quote:

Script[gamemodes/WCRP.amx]: Run time error 19: "File or function is not found"

Reply
#5

Known bug: When first time someone's get a kill, it appears on the top list, but when someone else kills someone, it doesn't add his/her kill (the second person's kill) and so on, so only the first one seems to be saving.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)