SA-MP Forums Archive
Find out who has the most score in one day - 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: Find out who has the most score in one day (/showthread.php?tid=568079)



Find out who has the most score in one day - earlybird325 - 19.03.2015

im trying to figure out a way to find out who got the most score in one day, i can't figure it out.

pawn Код:
new scoreholder[MAX_PLAYERS];


public OnPlayerDeath(playerid,killerid,reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        scoreholder[killerid]++;
    }
    return 1;
}

//to be used with something else
stock CheckScore()
{
    for(new y=0; y<MAX_PLAYERS; y++)
    {

    }
    return 1;
}
I can't see where to get that info, if that player got most score, then they get a prize.


AW: Find out who has the most score in one day - Kaliber - 19.03.2015

Quote:
Originally Posted by earlybird325
Посмотреть сообщение
I can't see where to get that info, if that player got most score, then they get a prize.
Just sth like this:

Код:
stock CheckScore()
{
    new t=-1;
    for(new i,y; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(scoreholder[i] > y) y=scoreholder[i],t=i;
    }
    if(t == -1) return SendClientMessageToAll(-1,"Nobody is online or all have score 0 ._.");
    new string[128];
    GetPlayerName(t,string,MAX_PLAYER_NAME);
    format(string,128,"Player %s (ID: %d) has the most score with: %d",string,t,scoreholder[t]);
    SendClientMessageToAll(-1,string);
    return 1;
}
Greekz