11.06.2011, 11:53
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?
Thanks, regards.
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;
}