RSSy MYGO.pl Opublikowano Grudzień 28, 2023 o 13:10 RSSy Udostępnij Opublikowano Grudzień 28, 2023 o 13:10 I have a plugin that contain nvault. Code that sent by me is not working, not calculating true rank. Can you fix it or re-make? I want to find players rank from vault file. In this vault there is player's point value, "P_points". You can use this and sort them for ranking. Then we must find true "P_rank". PHP Code: parse(Pdata, P, MAX_PLAYER, P_points, MAX_PLAYER, P_goles, MAX_PLAYER, P_robos, MAX_PLAYER, P_asis, MAX_PLAYER, P_encontra, MAX_PLAYER, P_disarm, MAX_PLAYER, P_kill, MAX_PLAYER, P_tekill, MAX_PLAYER, P_terobos, MAX_PLAYER, P_tedisarm, MAX_PLAYER, P_rank, MAX_PLAYER); PHP Code: VerificarPossUP(id) { if(!UserPassword[id]) return false; if(!SavePlayerRank(id)) { nvault_close(rankVault); nvault_close(topVault); return false; } new P[MAX_PLAYER + 1], P_points[MAX_PLAYER + 1], P_goles[MAX_PLAYER + 1], P_robos[MAX_PLAYER + 1], P_asis[MAX_PLAYER + 1], P_encontra[MAX_PLAYER + 1], P_disarm[MAX_PLAYER + 1], P_kill[MAX_PLAYER + 1], P_tekill[MAX_PLAYER + 1], P_terobos[MAX_PLAYER + 1], P_tedisarm[MAX_PLAYER + 1], P_rank[MAX_PLAYER + 1]; new C[MAX_PLAYER + 1], C_points[MAX_PLAYER + 1], C_goles[MAX_PLAYER + 1], C_robos[MAX_PLAYER + 1], C_asis[MAX_PLAYER + 1], C_encontra[MAX_PLAYER + 1], C_disarm[MAX_PLAYER + 1], C_kill[MAX_PLAYER + 1], C_tekill[MAX_PLAYER + 1], C_terobos[MAX_PLAYER + 1], C_tedisarm[MAX_PLAYER + 1], C_rank[MAX_PLAYER + 1]; new Pkey[64], Ckey[64], Pdata[64], Cdata[64], timestamp; new Ppoint, Cpoint, Crank, Prank; new Pname[MAX_PLAYER + 1], Cname[MAX_PLAYER + 1]; new tempPrank; get_user_authid(id, Pname, MAX_PLAYER); format(Pkey, 63, "^"%s^"", Pname); for(new x = 1; x <= TotalRank; x++) { if(nvault_lookup(rankVault, Pkey, Pdata, 1500, timestamp)) { parse(Pdata, P, MAX_PLAYER, P_points, MAX_PLAYER, P_goles, MAX_PLAYER, P_robos, MAX_PLAYER, P_asis, MAX_PLAYER, P_encontra, MAX_PLAYER, P_disarm, MAX_PLAYER, P_kill, MAX_PLAYER, P_tekill, MAX_PLAYER, P_terobos, MAX_PLAYER, P_tedisarm, MAX_PLAYER, P_rank, MAX_PLAYER); Ppoint = str_to_num(P_points) Prank = str_to_num(P_rank) if(Prank > 1 && Prank <= TotalRank) { tempPrank = Prank - 1 format(Ckey, 63, "%i", tempPrank); if(nvault_lookup(topVault, Ckey, Cdata, 1500, timestamp)) { parse(Cdata, Cname, MAX_PLAYER) format(Ckey, 63, "^"%s^"", Cname); if(nvault_lookup(rankVault, Ckey, Cdata, 1500, timestamp)) { parse(Cdata, C, MAX_PLAYER, C_points, MAX_PLAYER, C_goles, MAX_PLAYER, C_robos, MAX_PLAYER, C_asis, MAX_PLAYER, C_encontra, MAX_PLAYER, C_disarm, MAX_PLAYER, C_kill, MAX_PLAYER, C_tekill, MAX_PLAYER, C_terobos, MAX_PLAYER, C_tedisarm, MAX_PLAYER, C_rank, MAX_PLAYER); Cpoint = str_to_num(C_points) Crank = str_to_num(C_rank) if(Crank >= 1 && Crank <= TotalRank) { if(Ppoint > Cpoint) { format(Cdata, 63, "%s %i %i %i %i %i %i %i %i %i %i %i", C, Cpoint, str_to_num(C_goles), str_to_num(C_robos), str_to_num(C_asis), str_to_num(C_encontra), str_to_num(C_disarm), str_to_num(C_kill), str_to_num(C_tekill), str_to_num(C_terobos), str_to_num(C_tedisarm), Prank) format(Pdata, 63, "%s %i %i %i %i %i %i %i %i %i %i %i", P, Ppoint, str_to_num(P_goles), str_to_num(P_robos), str_to_num(P_asis), str_to_num(P_encontra), str_to_num(P_disarm), str_to_num(P_kill), str_to_num(P_tekill), str_to_num(P_terobos), str_to_num(P_tedisarm), Crank) nvault_set(rankVault, Ckey, Cdata); nvault_set(rankVault, Pkey, Pdata); new keytop[64] format(keytop, 63, "%i", Crank); nvault_set(topVault, keytop, Pkey); format(keytop, 63, "%i", Prank); nvault_set(topVault, keytop, Ckey); } else { Pro_Rank[id] = Prank; break; } } else { Pro_Rank[id] = Prank; break; } } else { Pro_Rank[id] = Prank; break; } } else { Pro_Rank[id] = Prank; break; } } else { Pro_Rank[id] = Prank; break; } } else break; } for(new x = 1; x <= TotalRank; x++) { if(nvault_lookup(rankVault, Pkey, Pdata, 1500, timestamp)) { parse(Pdata, P, MAX_PLAYER, P_points, MAX_PLAYER, P_goles, MAX_PLAYER, P_robos, MAX_PLAYER, P_asis, MAX_PLAYER, P_encontra, MAX_PLAYER, P_disarm, MAX_PLAYER, P_kill, MAX_PLAYER, P_tekill, MAX_PLAYER, P_terobos, MAX_PLAYER, P_tedisarm, MAX_PLAYER, P_rank, MAX_PLAYER); Ppoint = str_to_num(P_points) Prank = str_to_num(P_rank) if(Prank >= 1 && Prank < TotalRank) { tempPrank = Prank + 1 format(Ckey, 63, "%i", tempPrank); if(nvault_lookup(topVault, Ckey, Cdata, 1500, timestamp)) { parse(Cdata, Cname, MAX_PLAYER) format(Ckey, 63, "^"%s^"", Cname); if(nvault_lookup(rankVault, Ckey, Cdata, 1500, timestamp)) { parse(Cdata, C, MAX_PLAYER, C_points, MAX_PLAYER, C_goles, MAX_PLAYER, C_robos, MAX_PLAYER, C_asis, MAX_PLAYER, C_encontra, MAX_PLAYER, C_disarm, MAX_PLAYER, C_kill, MAX_PLAYER, C_tekill, MAX_PLAYER, C_terobos, MAX_PLAYER, C_tedisarm, MAX_PLAYER, C_rank, MAX_PLAYER); Cpoint = str_to_num(C_points) Crank = str_to_num(C_rank) if(Crank >= 1 && Crank <= TotalRank) { if(Ppoint < Cpoint) { format(Cdata, 63, "%s %i %i %i %i %i %i %i %i %i %i %i", C, Cpoint, str_to_num(C_goles), str_to_num(C_robos), str_to_num(C_asis), str_to_num(C_encontra), str_to_num(C_disarm), str_to_num(C_kill), str_to_num(C_tekill), str_to_num(C_terobos), str_to_num(C_tedisarm), Prank) format(Pdata, 63, "%s %i %i %i %i %i %i %i %i %i %i %i", P, Ppoint, str_to_num(P_goles), str_to_num(P_robos), str_to_num(P_asis), str_to_num(P_encontra), str_to_num(P_disarm), str_to_num(P_kill), str_to_num(P_tekill), str_to_num(P_terobos), str_to_num(P_tedisarm), Crank) nvault_set(rankVault, Ckey, Cdata); nvault_set(rankVault, Pkey, Pdata); new keytop[64] format(keytop, 63, "%i", Crank) nvault_set(topVault, keytop, Pkey); format(keytop, 63, "%i", Prank) nvault_set(topVault, keytop, Ckey); } else { Pro_Rank[id] = Prank; break; } } else { Pro_Rank[id] = Prank; break; } } else { Pro_Rank[id] = Prank; break; } } else { Pro_Rank[id] = Prank; break; } } else { Pro_Rank[id] = Prank; break; } } else break; } nvault_close(rankVault); nvault_close(topVault); return true } Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi