ZombieManager: Remove sound

This commit is contained in:
hubdom 2021-01-12 17:42:26 +01:00
parent c5530a8722
commit 22be0183ea

View File

@ -18,8 +18,6 @@ char g_cOriginalMotherZMNames[256];
/*bool g_bZHP[MAXPLAYERS + 1] = { false, ... };
Handle g_hCookieZHP = null;*/
bool g_bZombieSpawnSound[MAXPLAYERS + 1] = { false, ... };
Handle g_hZombieSpawnSound = null;
int g_iZHPMax[MAXPLAYERS + 1];
int g_iZShield[MAXPLAYERS + 1];
bool g_bShield;
@ -67,11 +65,6 @@ public void OnPluginStart()
g_hCookieZHP = RegClientCookie("zhp_blocked", "are zombie hp and shield display blocked", CookieAccess_Protected);
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Zombie HP Shield Display");*/
RegConsoleCmd("sm_zombiespawnsound", OnToggleZombieSpawnSound, "Toggle blocking the Sound when Mother Zombies spawn");
RegConsoleCmd("sm_zss", OnToggleZombieSpawnSound, "Toggle blocking the Sound when Mother Zombies spawn");
g_hZombieSpawnSound = RegClientCookie("zss_blocked", "is mother zombie spawn sound blocked", CookieAccess_Protected);
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "MotherZombieSpawnSound");
AutoExecConfig(true, "plugin.ZombieManager");
AddMultiTargetFilter("@mzombie", Filter_Motherzombies, "Current Mother Zombies", false);
@ -110,9 +103,6 @@ public void OnPluginEnd()
public void OnMapStart()
{
g_bShield = GetConVarBool(FindConVar("sm_zombieshield"));
PrecacheSound("unloze/not-not-so-infected-rush.mp3");
AddFileToDownloadsTable("sound/unloze/not-not-so-infected-rush.mp3");
}
/*public Action OnToggleZHP(int client, int args)
@ -140,30 +130,8 @@ public void ToggleZHP(int client)
g_bZHP[client] = false;
}*/
public Action OnToggleZombieSpawnSound(int client, int args)
{
ToggleZombieSpawnSound(client);
return Plugin_Handled;
}
public void ToggleZombieSpawnSound(int client)
{
g_bZombieSpawnSound[client] = !g_bZombieSpawnSound[client];
SetClientCookie(client, g_hZombieSpawnSound, g_bZombieSpawnSound[client] ? "1" : "");
CPrintToChat(client, "{cyan}[MotherZombieSpawnSound] {white}%s", g_bZombieSpawnSound[client] ? "Sound disabled." : "Sound enabled.");
}
public void OnClientCookiesCached(int client)
{
char sBuffer[2];
GetClientCookie(client, g_hZombieSpawnSound, sBuffer, sizeof(sBuffer));
if(sBuffer[0] != '\0')
g_bZombieSpawnSound[client] = true;
else
g_bZombieSpawnSound[client] = false;
}
public void OnClientPutInServer(int client)
{
@ -173,7 +141,6 @@ public void OnClientPutInServer(int client)
public void OnClientDisconnect(int client)
{
//g_bZHP[client] = false;
g_bZombieSpawnSound[client] = false;
g_iZHPMax[client] = 0;
g_iZShield[client] = 0;
g_bMotherZM[client] = false;
@ -234,60 +201,6 @@ public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int se
}
}*/
public void ShowSettingsMenu(int client)
{
Menu menu = new Menu(MenuHandler_MainMenu);
menu.SetTitle("MotherZombieSpawnSound Settings", client);
char sBuffer[128];
Format(sBuffer, sizeof(sBuffer), "Sound: %s", g_bZombieSpawnSound[client] ? "Disabled" : "Enabled");
menu.AddItem("0", sBuffer);
menu.ExitBackButton = true;
menu.Display(client, MENU_TIME_FOREVER);
}
public void MenuHandler_CookieMenu(int client, CookieMenuAction action, any info, char[] buffer, int maxlen)
{
switch(action)
{
case(CookieMenuAction_DisplayOption):
{
Format(buffer, maxlen, "MotherZombieSpawnSound", client);
}
case(CookieMenuAction_SelectOption):
{
ShowSettingsMenu(client);
}
}
}
public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int selection)
{
switch(action)
{
case(MenuAction_Select):
{
switch(selection)
{
case(0): ToggleZombieSpawnSound(client);
}
ShowSettingsMenu(client);
}
case(MenuAction_Cancel):
{
ShowCookieMenu(client);
}
case(MenuAction_End):
{
delete menu;
}
}
}
public void Cvar_AFKTime(ConVar convar, const char[] oldValue, const char[] newValue)
{
@ -360,16 +273,6 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
{
g_bMotherZMSpawned = true;
CreateTimer(1.0, Timer_LockMotherZMNames, _, TIMER_FLAG_NO_MAPCHANGE);
for(int i = 1; i <= MaxClients; i++)
{
if(!IsClientInGame(i))
continue;
if(g_bZombieSpawnSound[i])
continue;
EmitSoundToClient(i, "unloze/not-not-so-infected-rush.mp3");
}
}
char aBuf2[MAX_NAME_LENGTH];
@ -595,7 +498,7 @@ public Action Timer_LockMotherZMNames(Handle timer)
if(strlen(g_cOriginalMotherZMNames))
g_cOriginalMotherZMNames[strlen(g_cOriginalMotherZMNames) - 2] = 0;
PrintCenterTextAll("Zombie Infection has been spread!");
PrintCenterTextAll("Zombie Infection has spread!");
return Plugin_Handled;
}