From 164a81d17c22cd57cc6e5fb555ed8ab4995355be Mon Sep 17 00:00:00 2001 From: dogan Date: Tue, 21 Jul 2020 02:15:28 +0200 Subject: [PATCH] AN: switch from round start to zombies spawned much better since lots of ppl join afterwards which messes up the calculation --- AntiNoob/scripting/AntiNoob.sp | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/AntiNoob/scripting/AntiNoob.sp b/AntiNoob/scripting/AntiNoob.sp index 7b76f4b6..acd79ff4 100644 --- a/AntiNoob/scripting/AntiNoob.sp +++ b/AntiNoob/scripting/AntiNoob.sp @@ -44,6 +44,7 @@ float g_fNapalmNoSteamReduction; float g_fNoSteamRatio; bool g_bAntiNoob; +bool g_bZombiesSpawned; float g_fCurrentKnockbackBoost; float g_fCurrentNapalmDamage; @@ -58,7 +59,7 @@ public Plugin myinfo = public void OnPluginStart() { - HookEvent("round_start", OnRoundStart); + HookEvent("round_end", OnRoundEnd); HookEvent("player_team", OnPlayerTeam); g_fCurrentKnockbackBoost = 1.0; @@ -250,6 +251,14 @@ public Action Command_AntiNoob(int client, int args) return Plugin_Handled; } + Format(cAdminNotification, sizeof(cAdminNotification), "{cyan}[AntiNoob]{white} Waiting for Zombies to spawn before doing anything!"); + + if(!g_bZombiesSpawned) + { + CPrintToChat(client, "%s", cAdminNotification); + return Plugin_Handled; + } + Format(cAdminNotification, sizeof(cAdminNotification), "{cyan}[AntiNoob]{white} Currently boosting knockback by {red}%.2f%%{white}.", ((g_fCurrentKnockbackBoost - 1.0) * 100.0)); if(g_bLowPopulation) @@ -320,13 +329,29 @@ public void CheckHumanZombieCount() } } -public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) +public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn) +{ + if(!g_bZombiesSpawned && motherInfect) + { + g_bZombiesSpawned = true; + StartRoundCheck(); + } +} + +public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast) +{ + g_bZombiesSpawned = false; + g_bMidRound = false; + + ServerCommand("zr_class_set_multiplier zombies knockback 1.0"); + ServerCommand("zr_napalm_time_scale 50.0"); +} + +public void StartRoundCheck() { g_iHumanScore = GetTeamScore(CS_TEAM_CT); g_iZombieScore = GetTeamScore(CS_TEAM_T); - g_bMidRound = false; - if(g_iHumanScore == 0) g_iHumanScore = 1;