SA-MP Forums Archive
GetPlayerWithMostScore???? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerWithMostScore???? (/showthread.php?tid=195716)



GetPlayerWithMostScore???? - [MNC]Azz - 03.12.2010

Yh.... i wanna know is it possible to find out who has THE MOST score in the server.....
NOT by pressing TAB button... but a function or sum sort of....


Re: GetPlayerWithMostScore???? - woot - 03.12.2010

Untested .. returns the player ID with the highest score.

pawn Код:
stock GetPlayerWithMostScore()
{
    new
        sHighestID  =   INVALID_PLAYER_ID,
        sHighest    =   0;
       
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerScore( i ) > sHighest)
        {
            sHighest = GetPlayerScore(i);
            sHighestID = i;
        }
    }
    return sHighestID;
}



Re: GetPlayerWithMostScore???? - [MNC]Azz - 03.12.2010

hmm... thx ill try


Re: GetPlayerWithMostScore???? - [MNC]Azz - 03.12.2010

how should i use it? like if i wanted a command /topplayer... GetPlayerName(sHighestID,pname); dont work...

EDIT: fixed!!! thanks a lot!!!


Re: GetPlayerWithMostScore???? - knackworst - 03.12.2010

Someone should make an include of this... LOL
nice, it helped me too : )