add CrowdSpawnWarning

This commit is contained in:
BotoX 2018-08-07 22:28:46 +02:00
parent f7cc75b072
commit 227b2064c1

View File

@ -0,0 +1,57 @@
#include <sourcemod>
#include <multicolors>
/* 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:
//----------------------------------------------------------------------------------------------------
public 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 (!g_cvCrowdSpawn.BoolValue && g_cvWarningEnabled.BoolValue)
{
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!!!");
}
}