28.12.2017, 10:54
Hello guys, I need help with this function I've Copy `Ryder Function for Highlist Scores And trying Change it From Scores to Kills What I mean? I want make It If there a player kill someone Textdraw Updated to
Example: RedRex - 1 Its mean I've killed a 1player now I've Creating it and Its worked But If I killed my Friend The textdraw is not updated to 1 or 2 Help me?
//OnPlayerDeath adding this
Example: RedRex - 1 Its mean I've killed a 1player now I've Creating it and Its worked But If I killed my Friend The textdraw is not updated to 1 or 2 Help me?
//OnPlayerDeath adding this
PHP код:
new
playerKills[MAX_PLAYERS][rankingEnum],
index
;
for(new i; i != MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
playerKills[index][player_Kill] = GetPlayerKills(i);
playerKills[index++][player_ID] = i;
}
}
GetPlayerHighestKills(playerKills, 0, index);
new
score_Text[256] = "~n~",
player_Name[20]
;
for(new i; i < 5; ++i)
{
if(i < index)
{
GetPlayerName(playerKills[i][player_ID], player_Name, sizeof(player_Name));
format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~w~%s - ~r~%d", score_Text, i + 1, player_Name, playerKills[i][player_Kill]);
}
else
format(score_Text, sizeof(score_Text), "%s~n~~b~%d. ~r~N/A", score_Text, i + 1);
}
TextDrawSetString(text_Top5[1], score_Text);
TextDrawShowForPlayer(playerid, text_Top5[0]);
TextDrawShowForPlayer(playerid, text_Top5[1]);
PHP код:
stock GetPlayerKills(playerid)
{
return PlayerInfo[playerid][pKills];
}
stock GetPlayerHighestKills(array[][rankingEnum], left, right)
{
new
tempLeft = left,
tempRight = right,
pivot = array[(left + right) / 2][player_Kill],
tempVar
;
while(tempLeft <= tempRight)
{
while(array[tempLeft][player_Kill] > pivot) tempLeft++;
while(array[tempRight][player_Kill] < pivot) tempRight--;
if(tempLeft <= tempRight)
{
tempVar = array[tempLeft][player_Kill], array[tempLeft][player_Kill] = array[tempRight][player_Kill], array[tempRight][player_Kill] = tempVar;
tempVar = array[tempLeft][player_ID], array[tempLeft][player_ID] = array[tempRight][player_ID], array[tempRight][player_ID] = tempVar;
tempLeft++, tempRight--;
}
}
if(left < tempRight) GetPlayerHighestKills(array, left, tempRight);
if(tempLeft < right) GetPlayerHighestKills(array, tempLeft, right);
}