RSSy MYGO.pl Opublikowano Sierpień 20, 2022 o 17:04 RSSy Udostępnij Opublikowano Sierpień 20, 2022 o 17:04 Can you edit the https://forums.alliedmods.net/showth...ghlight=assist code with reapi? Code: #include <amxmodx> #include <amxmisc> #include <fakemeta> #include <hamsandwich> #include <dhudmessage> const TASK_ARGUMENTS = 100 new g_maxplayers, g_connected[33], g_offset[33][2], g_argping[33][3] new assists[33] new bool:plugin = true new rs new damage2[33][33] //damage[Attacker][Victim] public plugin_init() { register_plugin("Assists", "2.1", "RuleBreaker") g_maxplayers = get_maxplayers() register_clcmd("say /rs", "resetscore") register_clcmd("say /resetscore", "resetscore") register_clcmd("amx_assists", "plugin_assists", ADMIN_RCON) register_event("TextMsg", "Event_Restart", "a", "2&#Game_C", "2&#Game_w") rs = register_cvar("assists_rs", "0") register_forward(FM_UpdateClientData, "fw_UpdateClientData") // Calculate weird argument values regularly in case we are faking ping fluctuations or a multiple of the real ping set_task(2.0, "calculate_arguments", TASK_ARGUMENTS, _, _, "b") RegisterHam(Ham_TakeDamage, "player", "fw_takedamage") RegisterHam(Ham_Killed, "player", "Ham_Killed_player") RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1) set_task(1.0, "deletedmg") } public Event_Restart() { new i=0 do { assists[i]=0 i+=1 } while(i<33) } public plugin_assists(id) { if(plugin) { plugin=false client_print(id, print_console, "[AMXX] Plugin Assists is turned off!") return PLUGIN_HANDLED } else if (!plugin) { plugin = true client_print(id, print_console, "[AMXX] Plugin Assists is turned on!") return PLUGIN_HANDLED } return PLUGIN_CONTINUE } public Ham_Killed_player(iVictim, iAttacker, shouldgib) { new i=0 do { if(i!=iAttacker) { if(damage2[i][iVictim]>30) { assist(i, iVictim) } } i+=1 } while (i<33) } public assist(attacker, victim) { damage2[attacker][victim]=0 assists[attacker]+=1 set_hudmessage(0, 255, 0, 0.79, 0.24, 0, 6.0, 12.0) show_hudmessage(attacker, "+Assist") } public fwHamPlayerSpawnPost(iPlayer) { new i=0 do { damage2[iPlayer][i]=0 i+=1 } while(i<33) } public fw_takedamage(victim, inflictor, attacker, Float:damage, bits) { damage2[attacker][victim]+=damage } public deletedmg(id) { new i1 = 0 do { new i2=0 do { if(damage2[i1][i2]>0) { damage2[i1][i2]-=1 } i2+=1 } while (i2<33) i1+=1 } while (i1<33) set_task(1.0, "deletedmg") } public resetscore(id) { if(get_pcvar_num(rs)) { assists[id]=0 } return PLUGIN_CONTINUE } public client_putinserver(id) { g_connected[id] = true assists[id]+=0 } public client_disconnect(id) { g_connected[id] = false assists[id]=0 new i=0 do { damage2[id][i]=0 i+=1 } while(i<33) } public fw_UpdateClientData(id) { if(plugin) { // Scoreboard key being pressed? if (!(pev(id, pev_button) & IN_SCORE) && !(pev(id, pev_oldbuttons) & IN_SCORE)) return; // Send fake player's pings static player, sending sending = 0 for (player = 1; player <= g_maxplayers; player++) { // Player not in game? if (!g_connected[player]) continue; // Send message with the weird arguments switch (sending) { case 0: { // Start a new message message_begin(MSG_ONE_UNRELIABLE, SVC_PINGS, _, id) write_byte((g_offset[player][0] * 64) + (1 + 2 * (player - 1))) write_short(g_argping[player][0]) sending++ } case 1: { // Append additional data write_byte((g_offset[player][1] * 128) + (2 + 4 * (player - 1))) write_short(g_argping[player][1]) sending++ } case 2: { // Append additional data and end message write_byte((4 + 8 * (player - 1))) write_short(g_argping[player][2]) write_byte(0) message_end() sending = 0 } } } // End message if not yet sent if (sending) { write_byte(0) message_end() } } } // Calculate weird argument values based on target ping public calculate_arguments() { static player, ping for (player = 1; player <= g_maxplayers; player++) { ping = assists[player] // First argument's ping for (g_offset[player][0] = 0; g_offset[player][0] < 4; g_offset[player][0]++) { if ((ping - g_offset[player][0]) % 4 == 0) { g_argping[player][0] = (ping - g_offset[player][0]) / 4 break; } } // Second argument's ping for (g_offset[player][1] = 0; g_offset[player][1] < 2; g_offset[player][1]++) { if ((ping - g_offset[player][1]) % 2 == 0) { g_argping[player][1] = (ping - g_offset[player][1]) / 2 break; } } // Third argument's ping g_argping[player][2] = ping } } Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi