[Ajuda] Ranking BUGADO
#1

estou com um problema no ranking ele mostra todos as colocaзхes o mesmo nick

CODIGO:

pawn Код:
@_CallBack: MostrarRankPlayer(playerid)
{
    new InfoTOP20[1540];
    new InfoRanking[77];
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}1є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[0][player_Nome], PlayerInformacoes[0][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}2є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[1][player_Nome], PlayerInformacoes[1][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}3є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[2][player_Nome], PlayerInformacoes[2][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}4є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[3][player_Nome], PlayerInformacoes[3][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}5є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[4][player_Nome], PlayerInformacoes[4][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}6є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[5][player_Nome], PlayerInformacoes[5][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}7є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[6][player_Nome], PlayerInformacoes[6][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}8є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[7][player_Nome], PlayerInformacoes[7][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}9є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[8][player_Nome], PlayerInformacoes[8][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}10є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[9][player_Nome], PlayerInformacoes[9][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}11є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[10][player_Nome], PlayerInformacoes[10][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}12є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[11][player_Nome], PlayerInformacoes[11][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}13є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[12][player_Nome], PlayerInformacoes[12][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}14є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[13][player_Nome], PlayerInformacoes[13][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}15є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[14][player_Nome], PlayerInformacoes[14][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}16є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[15][player_Nome], PlayerInformacoes[15][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}17є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[16][player_Nome], PlayerInformacoes[16][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}18є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[17][player_Nome], PlayerInformacoes[17][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}19є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[18][player_Nome], PlayerInformacoes[18][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    format(InfoRanking, sizeof(InfoRanking), "{FFFFFF}20є - %s {FFFFFF}- Score: {FFD700}%d\n", PlayerInformacoes[19][player_Nome], PlayerInformacoes[19][player_Score]);
    strcat(InfoTOP20,InfoRanking);
    ShowPlayerDialog(playerid, DIALOG_MENSAGEM, DIALOG_STYLE_MSGBOX, "{FFFFFF}TOP Score {228B22}20", InfoTOP20, "Fechar", "");
    return true;
}


stock SalvarRanking(playerid,ScoresNivel,Posicao)
{
    new string[32] = "Ranking.ini";
    DOF2_CreateFile(string);
    if(Posicao == 1)
    {
        DOF2_SetString(string, "NomeJogador1", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel1", ScoresNivel);
    }
    else if(Posicao == 2)
    {
        DOF2_SetString(string, "NomeJogador2", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel2", ScoresNivel);
    }
    else if(Posicao == 3)
    {
        DOF2_SetString(string, "NomeJogador3", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel3", ScoresNivel);
    }
    else if(Posicao == 4)
    {
        DOF2_SetString(string, "NomeJogador4", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel4", ScoresNivel);
    }
    else if(Posicao == 5)
    {
        DOF2_SetString(string, "NomeJogador5", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel5", ScoresNivel);
    }
    else if(Posicao == 6)
    {
        DOF2_SetString(string, "NomeJogador6", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel6", ScoresNivel);
    }
    else if(Posicao == 7)
    {
        DOF2_SetString(string, "NomeJogador7", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel7", ScoresNivel);
    }
    else if(Posicao == 8)
    {
        DOF2_SetString(string, "NomeJogador8", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel8", ScoresNivel);
    }
    else if(Posicao == 9)
    {
        DOF2_SetString(string, "NomeJogador9", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel9", ScoresNivel);
    }
    else if(Posicao == 10)
    {
        DOF2_SetString(string, "NomeJogador10", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel10", ScoresNivel);
    }
    else if(Posicao == 11)
    {
        DOF2_SetString(string, "NomeJogador11", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel11", ScoresNivel);
    }
    else if(Posicao == 12)
    {
        DOF2_SetString(string, "NomeJogador12", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel12", ScoresNivel);
    }
    else if(Posicao == 13)
    {
        DOF2_SetString(string, "NomeJogador13", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel13", ScoresNivel);
    }
    else if(Posicao == 14)
    {
        DOF2_SetString(string, "NomeJogador14", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel14", ScoresNivel);
    }
    else if(Posicao == 15)
    {
        DOF2_SetString(string, "NomeJogador15", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel15", ScoresNivel);
    }
    else if(Posicao == 16)
    {
        DOF2_SetString(string, "NomeJogador16", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel16", ScoresNivel);
    }
    else if(Posicao == 17)
    {
        DOF2_SetString(string, "NomeJogador17", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel17", ScoresNivel);
    }
    else if(Posicao == 18)
    {
        DOF2_SetString(string, "NomeJogador18", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel18", ScoresNivel);
    }
    else if(Posicao == 19)
    {
        DOF2_SetString(string, "NomeJogador19", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel19", ScoresNivel);
    }
    else if(Posicao == 20)
    {
        DOF2_SetString(string, "NomeJogador20", PlayerName(playerid));
        DOF2_SetInt(string, "Nivel20", ScoresNivel);
    }
    DOF2_SaveFile();
    CarregarRanking();
    return 1;
}

stock CarregarRanking()
{
    new string[32] = "Ranking.ini";
    if(DOF2_FileExists(string))
    {
        strmid(PlayerInformacoes[0][player_Nome],DOF2_GetString(string,"NomeJogador1"),0,strlen(DOF2_GetString(string,"NomeJogador1")),128);
        PlayerInformacoes[0][player_Score] = DOF2_GetInt(string, "Nivel1");
        strmid(PlayerInformacoes[1][player_Nome],DOF2_GetString(string,"NomeJogador2"),0,strlen(DOF2_GetString(string,"NomeJogador2")),128);
        PlayerInformacoes[1][player_Score] = DOF2_GetInt(string, "Nivel2");
        strmid(PlayerInformacoes[2][player_Nome],DOF2_GetString(string,"NomeJogador3"),0,strlen(DOF2_GetString(string,"NomeJogador3")),128);
        PlayerInformacoes[2][player_Score] = DOF2_GetInt(string, "Nivel3");
        strmid(PlayerInformacoes[3][player_Nome],DOF2_GetString(string,"NomeJogador4"),0,strlen(DOF2_GetString(string,"NomeJogador4")),128);
        PlayerInformacoes[3][player_Score] = DOF2_GetInt(string, "Nivel4");
        strmid(PlayerInformacoes[4][player_Nome],DOF2_GetString(string,"NomeJogador5"),0,strlen(DOF2_GetString(string,"NomeJogador5")),128);
        PlayerInformacoes[4][player_Score] = DOF2_GetInt(string, "Nivel5");
        strmid(PlayerInformacoes[5][player_Nome],DOF2_GetString(string,"NomeJogador6"),0,strlen(DOF2_GetString(string,"NomeJogador6")),128);
        PlayerInformacoes[5][player_Score] = DOF2_GetInt(string, "Nivel6");
        strmid(PlayerInformacoes[6][player_Nome],DOF2_GetString(string,"NomeJogador7"),0,strlen(DOF2_GetString(string,"NomeJogador7")),128);
        PlayerInformacoes[6][player_Score] = DOF2_GetInt(string, "Nivel7");
        strmid(PlayerInformacoes[7][player_Nome],DOF2_GetString(string,"NomeJogador8"),0,strlen(DOF2_GetString(string,"NomeJogador8")),128);
        PlayerInformacoes[7][player_Score] = DOF2_GetInt(string, "Nivel8");
        strmid(PlayerInformacoes[8][player_Nome],DOF2_GetString(string,"NomeJogador9"),0,strlen(DOF2_GetString(string,"NomeJogador9")),128);
        PlayerInformacoes[8][player_Score] = DOF2_GetInt(string, "Nivel9");
        strmid(PlayerInformacoes[9][player_Nome],DOF2_GetString(string,"NomeJogador10"),0,strlen(DOF2_GetString(string,"NomeJogador10")),128);
        PlayerInformacoes[9][player_Score] = DOF2_GetInt(string, "Nivel10");
        strmid(PlayerInformacoes[10][player_Nome],DOF2_GetString(string,"NomeJogador11"),0,strlen(DOF2_GetString(string,"NomeJogador11")),128);
        PlayerInformacoes[10][player_Score] = DOF2_GetInt(string, "Nivel11");
        strmid(PlayerInformacoes[11][player_Nome],DOF2_GetString(string,"NomeJogador12"),0,strlen(DOF2_GetString(string,"NomeJogador12")),128);
        PlayerInformacoes[11][player_Score] = DOF2_GetInt(string, "Nivel12");
        strmid(PlayerInformacoes[12][player_Nome],DOF2_GetString(string,"NomeJogador13"),0,strlen(DOF2_GetString(string,"NomeJogador13")),128);
        PlayerInformacoes[12][player_Score] = DOF2_GetInt(string, "Nivel13");
        strmid(PlayerInformacoes[13][player_Nome],DOF2_GetString(string,"NomeJogador14"),0,strlen(DOF2_GetString(string,"NomeJogador14")),128);
        PlayerInformacoes[13][player_Score] = DOF2_GetInt(string, "Nivel14");
        strmid(PlayerInformacoes[14][player_Nome],DOF2_GetString(string,"NomeJogador15"),0,strlen(DOF2_GetString(string,"NomeJogador15")),128);
        PlayerInformacoes[14][player_Score] = DOF2_GetInt(string, "Nivel15");
        strmid(PlayerInformacoes[15][player_Nome],DOF2_GetString(string,"NomeJogador16"),0,strlen(DOF2_GetString(string,"NomeJogador16")),128);
        PlayerInformacoes[15][player_Score] = DOF2_GetInt(string, "Nivel16");
        strmid(PlayerInformacoes[16][player_Nome],DOF2_GetString(string,"NomeJogador17"),0,strlen(DOF2_GetString(string,"NomeJogador17")),128);
        PlayerInformacoes[16][player_Score] = DOF2_GetInt(string, "Nivel17");
        strmid(PlayerInformacoes[17][player_Nome],DOF2_GetString(string,"NomeJogador18"),0,strlen(DOF2_GetString(string,"NomeJogador18")),128);
        PlayerInformacoes[17][player_Score] = DOF2_GetInt(string, "Nivel18");
        strmid(PlayerInformacoes[18][player_Nome],DOF2_GetString(string,"NomeJogador19"),0,strlen(DOF2_GetString(string,"NomeJogador19")),128);
        PlayerInformacoes[18][player_Score] = DOF2_GetInt(string, "Nivel19");
        strmid(PlayerInformacoes[19][player_Nome],DOF2_GetString(string,"NomeJogador20"),0,strlen(DOF2_GetString(string,"NomeJogador20")),128);
        PlayerInformacoes[19][player_Score] = DOF2_GetInt(string, "Nivel20");
    }
    else
    {
        DOF2_CreateFile(string);
        DOF2_SetString(string, "NomeJogador1", "Ninguem");
        DOF2_SetInt(string, "Nivel4", 20);
        DOF2_SetString(string, "NomeJogador2", "Ninguem");
        DOF2_SetInt(string, "Nivel2", 19);
        DOF2_SetString(string, "NomeJogador3", "Ninguem");
        DOF2_SetInt(string, "Nivel3", 18);
        DOF2_SetString(string, "NomeJogador4", "Ninguem");
        DOF2_SetInt(string, "Nivel4", 17);
        DOF2_SetString(string, "NomeJogador5", "Ninguem");
        DOF2_SetInt(string, "Nivel5", 16);
        DOF2_SetString(string, "NomeJogador6", "Ninguem");
        DOF2_SetInt(string, "Nivel6", 15);
        DOF2_SetString(string, "NomeJogador7", "Ninguem");
        DOF2_SetInt(string, "Nivel7", 14);
        DOF2_SetString(string, "NomeJogador8", "Ninguem");
        DOF2_SetInt(string, "Nivel8", 13);
        DOF2_SetString(string, "NomeJogador9", "Ninguem");
        DOF2_SetInt(string, "Nivel9", 12);
        DOF2_SetString(string, "NomeJogador10", "Ninguem");
        DOF2_SetInt(string, "Nivel10", 11);
        DOF2_SetString(string, "NomeJogador11", "Ninguem");
        DOF2_SetInt(string, "Nivel11", 10);
        DOF2_SetString(string, "NomeJogador12", "Ninguem");
        DOF2_SetInt(string, "Nivel12", 9);
        DOF2_SetString(string, "NomeJogador13", "Ninguem");
        DOF2_SetInt(string, "Nivel13", 8);
        DOF2_SetString(string, "NomeJogador14", "Ninguem");
        DOF2_SetInt(string, "Nivel14", 7);
        DOF2_SetString(string, "NomeJogador15", "Ninguem");
        DOF2_SetInt(string, "Nivel15", 6);
        DOF2_SetString(string, "NomeJogador16", "Ninguem");
        DOF2_SetInt(string, "Nivel16", 5);
        DOF2_SetString(string, "NomeJogador17", "Ninguem");
        DOF2_SetInt(string, "Nivel17", 4);
        DOF2_SetString(string, "NomeJogador18", "Ninguem");
        DOF2_SetInt(string, "Nivel18", 3);
        DOF2_SetString(string, "NomeJogador19", "Ninguem");
        DOF2_SetInt(string, "Nivel19", 2);
        DOF2_SetString(string, "NomeJogador20", "Ninguem");
        DOF2_SetInt(string, "Nivel20", 1);
        DOF2_SaveFile();
    }
    return 1;
}

PRINT DO BUG:
Reply
#2

vocк esta mostrando o msm player por isso ... faзa um loop que da certo
Reply
#3

exemplo? e aonde eu faria este loop?
Reply
#4

Cuidado Com O Duble-Post

Use o search:

https://sampforum.blast.hk/showthread.php?tid=290735
Reply
#5

Quote:
Originally Posted by Whoo
Посмотреть сообщение
vocк esta mostrando o msm player por isso ... faзa um loop que da certo
como faзo isso? alguem pra ajudar dar um exemplo ai?? -.-
Reply
#6

Код:
for(new a=0; a<MAX_PLAYERS; a++) {
	if(IsPlayerConnected(a)) {
		new str[100];
		format(str, 100, "ID DO JOGADOR ATUAL: %d", a);
		print(str);
	}
}
Um exemplo idiota. Fiz um looping em todos os jogadores online e a cada vez que esse looping passar vai mostrar uma mensagem no console escrita: ID DO JOGADOR ATUAL: ID do jogador

Se tiver, por exemplo, 3 jogadores online o resultado serб:

ID DO JOGADOR ATUAL: 0
ID DO JOGADOR ATUAL: 1
ID DO JOGADOR ATUAL: 2

Com isso mais o tutorial que postaram й o suficiente para vocк fazer o que quer. Mais que isso sу te dando o cуdigo pronto.
Reply
#7

Quote:
Originally Posted by Kamper
Посмотреть сообщение
Код:
for(new a=0; a<MAX_PLAYERS; a++) {
	if(IsPlayerConnected(a)) {
		new str[100];
		format(str, 100, "ID DO JOGADOR ATUAL: %d", a);
		print(str);
	}
}
Um exemplo idiota. Fiz um looping em todos os jogadores online e a cada vez que esse looping passar vai mostrar uma mensagem no console escrita: ID DO JOGADOR ATUAL: ID do jogador

Se tiver, por exemplo, 3 jogadores online o resultado serб:

ID DO JOGADOR ATUAL: 0
ID DO JOGADOR ATUAL: 1
ID DO JOGADOR ATUAL: 2

Com isso mais o tutorial que postaram й o suficiente para vocк fazer o que quer. Mais que isso sу te dando o cуdigo pronto.
coloquei na callback MostrarRankPlayer

e deu isso no console e no dialog... aaahhh ja tentei de tudo lendo aquele tutorial e nгo da certo alguem ajuda po so falta isso -.-

PRINTS:
Reply
#8

alguem? ja tentei com os tutoriais mais continua bugado ou eu estou colocando no lugar errado... alguem por favor ajuda
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)