11.08.2013, 21:19
Try the following:
Since you are showing the Textdraws to everyone, I've changed it to ShowForAll instead.
pawn Код:
public Top5Update()
{
new
playerScores[MAX_PLAYERS][rankingEnum],
index
;
new str[128];
for(new i; i != MAX_PLAYERS; ++i)
{
if(IsPlayerConnectedEx(i) && !IsPlayerNPC(i))
{
playerScores[index][player_Score] = Player[i][AliveTime];
playerScores[index][player_ID] = i;
index++;
}
}
GetPlayerHighestScores(playerScores, 0, index);
new score_Text[256] = "~n~";
for(new id; id < 5; ++id)
{
format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~w~%s - ~r~%d", score_Text, id + 1, GetName(playerScores[id][player_ID]), playerScores[id][player_Score]);
format(str, 128, "Your Alive Time: %d Sec.", Player[id][AliveTime]);
TextDrawSetString(AliveTimeTD[id], str);
TextDrawShowForAllAll(AliveTimeTD[id]);
}
TextDrawSetString(TopPlayersList, score_Text);
TextDrawShowForAll(TopPlayers);//Player(i, TopPlayers);
TextDrawShowForAll(TopPlayersBG);//Player(i, TopPlayersBG);
TextDrawShowForAll(TopPlayersList);//Player(i, TopPlayersList);
return 1;
}
stock GetPlayerHighestScores(array[][rankingEnum], left, right)
{
new
tempLeft = left,
tempRight = right,
pivot = array[(left + right) / 2][player_Score],
tempVar
;
while(tempLeft <= tempRight)
{
while(array[tempLeft][player_Score] > pivot) tempLeft++;
while(array[tempRight][player_Score] < pivot) tempRight--;
if(tempLeft <= tempRight)
{
tempVar = array[tempLeft][player_Score], array[tempLeft][player_Score] = array[tempRight][player_Score], array[tempRight][player_Score] = tempVar;
tempVar = array[tempLeft][player_ID], array[tempLeft][player_ID] = array[tempRight][player_ID], array[tempRight][player_ID] = tempVar;
tempLeft++, tempRight--;
}
}
if(left < tempRight) GetPlayerHighestScores(array, left, tempRight);
if(tempLeft < right) GetPlayerHighestScores(array, tempLeft, right);
}