diff --git a/CrowdSpawnWarning/scripting/CrowdSpawnWarning.sp b/CrowdSpawnWarning/scripting/CrowdSpawnWarning.sp new file mode 100644 index 0000000..6333765 --- /dev/null +++ b/CrowdSpawnWarning/scripting/CrowdSpawnWarning.sp @@ -0,0 +1,59 @@ +#include +#include + +#pragma newdecls required + +/* CONVARS */ +ConVar g_cvCrowdSpawn; +ConVar g_cvWarningEnabled; + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public Plugin myinfo = +{ + name = "CrowdSpawnWarning", + author = "Neon", + description = "", + version = "1.0.0", + url = "https://steamcommunity.com/id/n3ontm" +}; + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +void OnAllPluginsLoaded() +{ + g_cvCrowdSpawn = FindConVar("zr_infect_mzombie_respawn"); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnPluginStart() +{ + g_cvWarningEnabled = CreateConVar("sm_crowd_spawn_warning", "1", "", FCVAR_NONE, true, 0.0, true, 1.0); + + HookEvent("round_start", OnRoundStart); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) +{ + CreateTimer(5.0, OnRoundStartPost, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE); +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public Action OnRoundStartPost(Handle timer) +{ + if (!GetConVarBool(FindConVar("zr_infect_mzombie_respawn"))) + { + CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans!!!"); + CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans!!!"); + CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans!!!"); + } +} \ No newline at end of file