From b57f8fdd68ae55238bf944e3236a60cc0e026606 Mon Sep 17 00:00:00 2001 From: jenz Date: Thu, 8 Jan 2026 12:53:51 +0100 Subject: [PATCH] updated knockback low pop modifier --- .../scripting/knockback_low_pop_modifier.sp | 120 ++++++++++-------- 1 file changed, 65 insertions(+), 55 deletions(-) diff --git a/AntiNoob/scripting/knockback_low_pop_modifier.sp b/AntiNoob/scripting/knockback_low_pop_modifier.sp index 0423928..e7da3e4 100644 --- a/AntiNoob/scripting/knockback_low_pop_modifier.sp +++ b/AntiNoob/scripting/knockback_low_pop_modifier.sp @@ -1,55 +1,65 @@ -#include -#include -#include - -public Plugin myinfo = -{ - name = "knockback low pop modifier", - author = "jenz", - description = "balances knockback for low population", - version = "1.0.0", - url = "" -} - -public void OnPluginStart() -{ - HookEvent("round_end", OnRoundEnd); -} - -public void OnPluginEnd() -{ - ServerCommand("zr_class_set_multiplier zombies knockback 1.0"); -} - -public void OnMapEnd() -{ - ServerCommand("zr_class_set_multiplier zombies knockback 1.0"); -} - -public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast) -{ - int active_player_count = 0; - for (int i = 1; i <= MaxClients; i++) - { - if(IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && !IsFakeClient(i) && !IsClientAutismBot(i) && !IsClientSourceTV(i) && GetClientTeam(i) != CS_TEAM_SPECTATOR) - { - active_player_count++; - } - } - - int zombie_ratio = GetConVarInt(FindConVar("zr_infect_mzombie_ratio")) * 2; - if (active_player_count < zombie_ratio) - { - float knockback_increase = float(zombie_ratio) / float(active_player_count); - //random capacity of 3 - if (knockback_increase > 3.0) - { - knockback_increase = 3.0; - } - - PrintToChatAll("LOW POP: increased zombie knockback to X%f to balance gameplay", knockback_increase); - PrintToChatAll("LOW POP: increased zombie knockback to X%f to balance gameplay", knockback_increase); - PrintToChatAll("LOW POP: increased zombie knockback to X%f to balance gameplay", knockback_increase); - ServerCommand("zr_class_set_multiplier zombies knockback %f", knockback_increase); - } -} +#include +#include +#include + +public Plugin myinfo = +{ + name = "knockback low pop modifier", + author = "jenz", + description = "balances knockback for low population", + version = "1.0.0", + url = "" +} + +public void OnPluginStart() +{ + HookEvent("round_start", OnRoundStart); +} + +public void OnPluginEnd() +{ + ServerCommand("zr_class_set_multiplier zombies knockback 1.0"); +} + +public void OnMapEnd() +{ + ServerCommand("zr_class_set_multiplier zombies knockback 1.0"); +} + +public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) +{ + int active_player_count = 0; + + for (int i = 1; i <= MaxClients; i++) + { + if(IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && !IsFakeClient(i) && !IsClientAutismBot(i) && !IsClientSourceTV(i) && GetClientTeam(i) > CS_TEAM_SPECTATOR) + { + active_player_count++; + } + } + + if (active_player_count < 24) + { + int zombie_ratio = GetConVarInt(FindConVar("zr_infect_mzombie_ratio")); + + float knockback_increase = float(zombie_ratio) / float(active_player_count); + + if (knockback_increase > 3.0) + knockback_increase = 3.0; + else if(knockback_increase < 1.0) + knockback_increase = 1.0 + + if (knockback_increase > 1.0) + { + PrintToChatAll("LOW POP: increased zombie knockback to X%.2f to balance gameplay", knockback_increase); + PrintToChatAll("LOW POP: increased zombie knockback to X%.2f to balance gameplay", knockback_increase); + PrintToChatAll("LOW POP: increased zombie knockback to X%.2f to balance gameplay", knockback_increase); + } + + ServerCommand("zr_class_set_multiplier zombies knockback %.2f", knockback_increase); + } + else + { + ServerCommand("zr_class_set_multiplier zombies knockback 1.0"); + } +}