SA-MP Forums Archive
Top CMD Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Top CMD Help (/showthread.php?tid=608526)



Top CMD Help - Akbaig - 02.06.2016

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;
            }
        } 



Re: Top CMD Help - Akbaig - 02.06.2016

bump


Re: Top CMD Help - CSLangdale - 03.06.2016

What is the bug? What's going wrong with it?


Re: Top CMD Help - RapRap - 03.06.2016

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"




Re: Top CMD Help - Akbaig - 03.06.2016

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.