11.08.2013, 17:15
Hey Fellas,
I use Ryders Top 5 Script,
But I noticed the score keeps updating correctly, but the name doesnt.
Hope you can help
I use Ryders Top 5 Script,
But I noticed the score keeps updating correctly, but the name doesnt.
pawn Код:
public Top5Update()
{
new
playerScores[MAX_PLAYERS][rankingEnum],
index
;
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)
{
if(id < index)
{
format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~w~%s - ~r~%d", score_Text, id + 1, GetName(id), playerScores[id][player_Score]);
}
else
format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~r~N/A", score_Text, id + 1);
}
new str[128];
format(str, 128, "Your Alive Time: %d Sec.", Player[i][AliveTime]);
TextDrawSetString(AliveTimeTD[i], str);
TextDrawShowForPlayer(i, AliveTimeTD[i]);
TextDrawSetString(TopPlayersList, score_Text);
TextDrawShowForPlayer(i, TopPlayers);
TextDrawShowForPlayer(i, TopPlayersBG);
TextDrawShowForPlayer(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);
}