08.03.2013, 22:25
Well, I have a little problem with this code.
I use the Top 5 script of Ryder.
I'm trying to add in the top 5 the kill ratio of the players, but when 2 players enter in the server the top 5 bugs. Have this code any error?
Regards.
Код:
new
playerScores[MAX_PLAYERS][ranking],
index
;
for(new i; i != MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
playerScores[index][player_Score] = GetPlayerScore(i);
playerScores[index++][player_ID] = i;
}
}
GetPlayerHighestScores(playerScores, 0, index);
new
score_Text[256] = "~n~",
player_Name[20]
;
for(new i; i < 5; ++i)
{
if(i < index)
{
GetPlayerName(playerScores[i][player_ID], player_Name, sizeof(player_Name));
format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~r~%s - ~w~%d - ~r~%0.2f", score_Text, i + 1, player_Name, playerScores[i][player_Score], Float:pInfo[i][pKills]/Float:pInfo[i][pDeaths]);
}
else
format(score_Text, sizeof(score_Text), "%s~n~", score_Text);
}
TextDrawSetString(text_Top5[0], score_Text);
TextDrawShowForPlayer(playerid, text_Top5[0]);
TextDrawShowForPlayer(playerid, text_Top5[1]);
return 1;
}
I'm trying to add in the top 5 the kill ratio of the players, but when 2 players enter in the server the top 5 bugs. Have this code any error?
Regards.

