From 894c76b0de1dfd1e7a059241590e28cad939b415 Mon Sep 17 00:00:00 2001 From: dogan Date: Wed, 30 Sep 2020 15:29:44 +0200 Subject: [PATCH] ZSkills: no zammo pre infection --- ZSkills/scripting/ZSkills.sp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ZSkills/scripting/ZSkills.sp b/ZSkills/scripting/ZSkills.sp index 4e6b274e..679c27bb 100644 --- a/ZSkills/scripting/ZSkills.sp +++ b/ZSkills/scripting/ZSkills.sp @@ -10,6 +10,8 @@ bool g_bZCleanse_Enabled; bool g_bZCleanse_Active[MAXPLAYERS+1]; bool g_bLastButtonReload[MAXPLAYERS+1]; +bool g_bZombiesSpawned; + /* CONVARS */ ConVar g_hCVar_ZAmmo_Enabled; ConVar g_hCVar_ZAmmo_Duration; @@ -34,9 +36,9 @@ int g_iLastZAmmo_Used[MAXPLAYERS+1]; public Plugin myinfo = { name = "ZSkills", - author = "Neon", + author = "Neon + Dogan", description = "Skills?!", - version = "1.0.2" + version = "1.0.3" }; //---------------------------------------------------------------------------------------------------- @@ -61,6 +63,7 @@ public void OnPluginStart() HookEvent("weapon_fire", Event_WeaponFire); HookEvent("round_start", Event_RoundStart); + HookEvent("round_end", Event_RoundEnd); RegConsoleCmd("sm_zammo", Command_ZAmmo); RegConsoleCmd("sm_zcleanse", Command_ZCleanse); @@ -112,6 +115,11 @@ public Action Command_ZAmmo(int client, int args) PrintToChat(client, "[ZAmmo] This feature requires you to be Human."); return Plugin_Handled; } + if (!g_bZombiesSpawned) + { + PrintToChat(client, "[ZAmmo] Not available before Motherzombies spawn."); + return Plugin_Handled; + } if(g_bZAmmo_Active[client]) { PrintToChat(client, "[ZAmmo] is already active on you."); @@ -239,6 +247,14 @@ public void Event_RoundStart(Handle hEvent, char[] name, bool dontBroadcast) } } +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void Event_RoundEnd(Handle hEvent, char[] name, bool dontBroadcast) +{ + g_bZombiesSpawned = false; +} + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- @@ -293,6 +309,9 @@ public void Event_WeaponFire(Handle hEvent, char[] name, bool dontBroadcast) //---------------------------------------------------------------------------------------------------- public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn) { + if(!g_bZombiesSpawned && motherInfect) + g_bZombiesSpawned = true; + g_iLastInfection[client] = GetTime(); if (!g_bZAmmo_Active[client])