Score update problem
#2

You're calling the SendClientMessageToAll function inside the loop. A for loop starts by a designated number and reaches up to its destination. Imagine in your server, your players had the score of their playerid (Ex: I'm playerid 9, my score is 9), it will just keep spamming every name that is bigger.

pawn Код:
public ScoreUpdate()
{
    new string[128];
    new highest = -1;
    new highestPlayer;
    new name[MAX_PLAYER_NAME];
    for(new slots = GetMaxPlayers(), i; i < slots; i++)
    {
        if(!IsPlayerConnected(i))
            continue;
        if(GetPlayerScore(i) > highest)
        {
            highest = GetPlayerScore(i);
            highestPlayer = i;
        }
    }
    GetPlayerName(highestPlayer, 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;
}
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)