Find out who has the most score in one day
#1

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.
Reply
#2

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)