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


Messages In This Thread
Top CMD Help - by Akbaig - 02.06.2016, 10:32
Re: Top CMD Help - by Akbaig - 02.06.2016, 17:05
Re: Top CMD Help - by CSLangdale - 03.06.2016, 02:49
Re: Top CMD Help - by RapRap - 03.06.2016, 02:53
Re: Top CMD Help - by Akbaig - 03.06.2016, 04:05

Forum Jump:


Users browsing this thread: 1 Guest(s)