[Pedido] Rank Top10
#1

Olб,

Gostaria de saber se alguem sabe de algum rank que mostre os Melhores players online (Top10), em TD... eu sу sei de um do RyDer mas ele buga as vezes.
Reply
#2

Eu usava o dele. Porйm eu dei uma pequena mexida e arrumei faz 1 ano eu acho. Deixei atй ele em dialog. Vou abrir o baъ aqui kkkk'

PS: Ele ler Apenas do LvL 1 para cima. LvL 0 apresenta conflitos.
Nгo vou arrumar mais e optimizar ele no momento.

pawn Код:
/* AONDE QUER QUE APAREЗA: MostrarRankJFS(playerid)
Ex: */

if (!strcmp("/top5", cmdtext, true)) return MostrarRankJFS(playerid);



// ADICIONAR AO FINAL DO GM/FS
forward MostrarRankJFS(playerid);
public MostrarRankJFS(playerid)
{
    new
        playerScores[MAX_PLAYERS][rankingEnum],
        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[MAX_PLAYER_NAME]
    ;
    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{FFFFFF}%d. {FF7777}%s - {FFFFFF}%d", score_Text, i + 1, player_Name, playerScores[i][player_Score]);
          }
          else
          {
                format(score_Text, sizeof(score_Text), "%s\n{FFFFFF}%d.  {FF7777}N/A", score_Text, i + 1);
          }
    }
    ShowPlayerDialog(playerid, 2742, DIALOG_STYLE_MSGBOX, "Rank Players Online", score_Text, "Fechar", "");
    return true;
}
 
 // Ryder
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);
}

Imagens:




Depois arrumo para TOP 10, ou se preferir mudar vocк mesmo, basta modificar aquele 5 do Loop.

Caso use outra variбvel de salvamento ou se quiser usar para fazer outro tipo de top... troque o GetPlayerScore.
Inclusive queria postar esse GM. '-'
Reply
#3

Sim e exatamente no lvl 0 que buga rs.

-

Pra falar a verdade eu queria em textdraw pois vou usa-lo em um sistema de corridas, ai vou aumentar para top10 e onde tem

" playerScores[index][player_Score] = GetPlayerScore(i);"

Para:

" playerScores[index][player_Score] = rPosiзгo(i);

Serб que daria algum conflito? Pois assim que os jogadotes entrassem na corrida todos estariam no CP 0.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)