Score update problem
#1

Hi, im having a problem with this very simple feature that should check for the highest score on the server.
The problem is that who ever on the server has a higher score than 0 it states him also as the player
with the highest score. (now imagine the spam with like 50 people on the server)

Can anyone please take a look at the code and tell me what could be wrong?

pawn Код:
public ScoreUpdate()
{
    new string[128];
    new highest = -1;
    new name[MAX_PLAYER_NAME];
    for(new slots = GetMaxPlayers(), i; i < slots; i++)
    {
        if(!IsPlayerConnected(i))
            continue;
        if(GetPlayerScore(i) > highest)
        {
            highest = GetPlayerScore(i);
            GetPlayerName(i, name, sizeof(name));
            format(string, sizeof(string), "Player %s is currently the top killer with a score of %d kills!", name, highest);
            SendClientMessageToAll(COLOR_ORANGE, string);
        }
    }
    return 1;
}
Thanks, regards.
Reply


Messages In This Thread
Score update problem - by OldDirtyBastard - 11.06.2011, 11:53
Re: Score update problem - by Cyanide - 11.06.2011, 12:21
Re: Score update problem - by OldDirtyBastard - 11.06.2011, 12:31

Forum Jump:


Users browsing this thread: 1 Guest(s)