SA-MP Forums Archive
How to get most Score earned. - 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: How to get most Score earned. (/showthread.php?tid=653610)



How to get most Score earned. - TadePoleMG - 08.05.2018

Hi mates

Can anyone help me to get highest score earned in the last of round end.
Thank You guys, help me.

rep++.


Re: How to get most Score earned. - Amads - 08.05.2018

PHP Code:
new topscoretopplayer;
for(new 
idid MAX_PLAYERSid++) if(GetPlayerScore(id) > topscoretopscore GetPlayerScore(id), topplayer id
topplayer is the ID of a player with the most score.


Re: How to get most Score earned. - TadePoleMG - 08.05.2018

I wanted it with a variable like Score[MAX_PLAYERS] which set to 0 OnPlayerConnect then it can be set to most scored earned by playerid in one round, then at round ends it showed with a message and resetted.


Re: How to get most Score earned. - Dayrion - 08.05.2018

Quote:
Originally Posted by TadePoleMG
View Post
I wanted it with a variable like Score[MAX_PLAYERS] which set to 0 OnPlayerConnect then it can be set to most scored earned by playerid in one round, then at round ends it showed with a message and resetted.
So do it


Re: How to get most Score earned. - TadePoleMG - 08.05.2018

I can't can you pls


Re: How to get most Score earned. - Dayrion - 08.05.2018

Quote:
Originally Posted by TadePoleMG
View Post
I can't can you pls
Unfortunately, no. That' "Scripting help" section, not "I'll script 4 u" section.
The answer has been given previsouly (I guess, I didn't checked it). Try to understand it and, if needed, post your questions here.


Re: How to get most Score earned. - ItsRobinson - 08.05.2018

PHP Code:
new MyScore[MAX_PLAYERS];
public 
OnPlayerDeath(playeridkilleridreason) {
    
MyScore[killerid]++;
    return 
1;
}
CMD:gameover(playeridparams[])
{
    new 
currentwinnerscorefinalwinner[24], string[128];
    foreach(
Playeri)
    {
        if(
MyScore(i) > score)
        {
            
score MyScore(i);
            
currentwinner i;
        }
    }
    
GetPlayerName(currentwinnerfinalwinnersizeof(finalwinner));
    
format(stringsizeof(string), "%s (ID %d) has won this game with a total score of %d."finalwinnercurrentwinnerscore);
    return 
1;

This a very blank way of doing it, you'll have to integrate it with your code by yourself.
(Not tested)