ZSkills: no zammo pre infection

This commit is contained in:
dogan 2020-09-30 15:29:44 +02:00
parent 3196094ae3
commit 894c76b0de

View File

@ -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])