ZombieManager: bunch of improvements
This commit is contained in:
parent
7111db2ebb
commit
6df0736667
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <cstrike>
|
#include <cstrike>
|
||||||
|
#include <sdktools>
|
||||||
#include <multicolors>
|
#include <multicolors>
|
||||||
#include <zombiereloaded>
|
#include <zombiereloaded>
|
||||||
#include <AFKManager>
|
#include <AFKManager>
|
||||||
@ -11,9 +12,13 @@
|
|||||||
bool g_bTestRound;
|
bool g_bTestRound;
|
||||||
bool g_bAdminTestRound;
|
bool g_bAdminTestRound;
|
||||||
bool g_bMotherZM[MAXPLAYERS + 1] = { false, ...};
|
bool g_bMotherZM[MAXPLAYERS + 1] = { false, ...};
|
||||||
|
bool g_bMotherZMSpawned;
|
||||||
|
char g_cOriginalMotherZMNames[256];
|
||||||
|
|
||||||
/*bool g_bZHP[MAXPLAYERS + 1] = { false, ... };
|
/*bool g_bZHP[MAXPLAYERS + 1] = { false, ... };
|
||||||
Handle g_hCookieZHP = null;*/
|
Handle g_hCookieZHP = null;*/
|
||||||
|
bool g_bZombieSpawnSound[MAXPLAYERS + 1] = { false, ... };
|
||||||
|
Handle g_hZombieSpawnSound = null;
|
||||||
int g_iZHPMax[MAXPLAYERS + 1];
|
int g_iZHPMax[MAXPLAYERS + 1];
|
||||||
int g_iZShield[MAXPLAYERS + 1];
|
int g_iZShield[MAXPLAYERS + 1];
|
||||||
bool g_bShield;
|
bool g_bShield;
|
||||||
@ -27,7 +32,7 @@ public Plugin myinfo =
|
|||||||
name = "Zombie Manager",
|
name = "Zombie Manager",
|
||||||
author = "Dogan",
|
author = "Dogan",
|
||||||
description = "Tools to manage testround and zombies",
|
description = "Tools to manage testround and zombies",
|
||||||
version = "2.0.0",
|
version = "3.0.0",
|
||||||
url = ""
|
url = ""
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,11 +63,16 @@ public void OnPluginStart()
|
|||||||
g_hCookieZHP = RegClientCookie("zhp_blocked", "are zombie hp and shield display blocked", CookieAccess_Protected);
|
g_hCookieZHP = RegClientCookie("zhp_blocked", "are zombie hp and shield display blocked", CookieAccess_Protected);
|
||||||
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Zombie HP Shield Display");*/
|
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, "Mother Zombie Spawn Sound");
|
||||||
|
|
||||||
AutoExecConfig(true, "plugin.ZombieManager");
|
AutoExecConfig(true, "plugin.ZombieManager");
|
||||||
|
|
||||||
AddMultiTargetFilter("@mzombie", Filter_Motherzombies, "Mother Zombies", false);
|
AddMultiTargetFilter("@mzombie", Filter_Motherzombies, "Current Mother Zombies", false);
|
||||||
RegConsoleCmd("sm_mzombie", Command_DisplayMotherzombies, "Current Mother Zombies");
|
RegConsoleCmd("sm_mzombie", Command_DisplayMotherzombies, "Original + Current Mother Zombies");
|
||||||
RegConsoleCmd("sm_mzombies", Command_DisplayMotherzombies, "Current Mother Zombies");
|
RegConsoleCmd("sm_mzombies", Command_DisplayMotherzombies, "Original + Current Mother Zombies");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAllPluginsLoaded()
|
public void OnAllPluginsLoaded()
|
||||||
@ -90,6 +100,9 @@ public void OnPluginEnd()
|
|||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
g_bShield = GetConVarBool(FindConVar("sm_zombieshield"));
|
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)
|
/*public Action OnToggleZHP(int client, int args)
|
||||||
@ -117,9 +130,35 @@ public void ToggleZHP(int client)
|
|||||||
g_bZHP[client] = false;
|
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] ? "Mother Zombie Spawn Sound disabled." : "Mother Zombie Spawn 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 OnClientDisconnect(int client)
|
public void OnClientDisconnect(int client)
|
||||||
{
|
{
|
||||||
//g_bZHP[client] = false;
|
//g_bZHP[client] = false;
|
||||||
|
g_bZombieSpawnSound[client] = false;
|
||||||
g_iZHPMax[client] = 0;
|
g_iZHPMax[client] = 0;
|
||||||
g_iZShield[client] = 0;
|
g_iZShield[client] = 0;
|
||||||
g_bMotherZM[client] = false;
|
g_bMotherZM[client] = false;
|
||||||
@ -180,6 +219,61 @@ 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("Mother Zombie Spawn Sound Settings", client);
|
||||||
|
|
||||||
|
char sBuffer[128];
|
||||||
|
|
||||||
|
Format(sBuffer, sizeof(sBuffer), "Mother Zombie Spawn 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, "Mother Zombie Spawn Sound", 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)
|
public void Cvar_AFKTime(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||||
{
|
{
|
||||||
g_iAFKTime = convar.IntValue;
|
g_iAFKTime = convar.IntValue;
|
||||||
@ -194,6 +288,8 @@ public void OnRoundStart(Event hEvent, const char[] sName, bool bDontBroadcast)
|
|||||||
{
|
{
|
||||||
g_bTestRound = false;
|
g_bTestRound = false;
|
||||||
g_bAdminTestRound = false;
|
g_bAdminTestRound = false;
|
||||||
|
g_bMotherZMSpawned = false;
|
||||||
|
g_cOriginalMotherZMNames = "";
|
||||||
|
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
@ -239,6 +335,31 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_bMotherZM[client] = motherInfect;
|
g_bMotherZM[client] = motherInfect;
|
||||||
|
|
||||||
|
if(motherInfect && !g_bMotherZMSpawned)
|
||||||
|
{
|
||||||
|
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];
|
||||||
|
|
||||||
|
if(motherInfect)
|
||||||
|
{
|
||||||
|
GetClientName(client, aBuf2, sizeof(aBuf2));
|
||||||
|
StrCat(g_cOriginalMotherZMNames, sizeof(g_cOriginalMotherZMNames), aBuf2);
|
||||||
|
StrCat(g_cOriginalMotherZMNames, sizeof(g_cOriginalMotherZMNames), ", ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action ZR_OnInfectCountdown()
|
public Action ZR_OnInfectCountdown()
|
||||||
@ -290,10 +411,16 @@ public bool Filter_Motherzombies(const char[] sPattern, Handle hClients, int cli
|
|||||||
|
|
||||||
public Action Command_DisplayMotherzombies(int client, int args)
|
public Action Command_DisplayMotherzombies(int client, int args)
|
||||||
{
|
{
|
||||||
if(client == 0)
|
if(CheckCommandAccess(client, "", ADMFLAG_GENERIC))
|
||||||
{
|
{
|
||||||
ReplyToCommand(client, "[SM] Cannot use this from console.");
|
if(strlen(g_cOriginalMotherZMNames))
|
||||||
return Plugin_Handled;
|
{
|
||||||
|
char cOriginalMotherZM[512] = "[SM] Original Mother Zombies: ";
|
||||||
|
StrCat(cOriginalMotherZM, sizeof(cOriginalMotherZM), g_cOriginalMotherZMNames);
|
||||||
|
ReplyToCommand(client, "%s", cOriginalMotherZM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ReplyToCommand(client, "[SM] Original Mother Zombies: none");
|
||||||
}
|
}
|
||||||
|
|
||||||
char aBuf[1024];
|
char aBuf[1024];
|
||||||
@ -315,10 +442,10 @@ public Action Command_DisplayMotherzombies(int client, int args)
|
|||||||
if(strlen(aBuf))
|
if(strlen(aBuf))
|
||||||
{
|
{
|
||||||
aBuf[strlen(aBuf) - 2] = 0;
|
aBuf[strlen(aBuf) - 2] = 0;
|
||||||
ReplyToCommand(client, "[SM] Current Mother Zombies: %s", aBuf);
|
ReplyToCommand(client, "[SM] Current Alive Mother Zombies: %s", aBuf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ReplyToCommand(client, "[SM] Current Mother Zombies: none");
|
ReplyToCommand(client, "[SM] Current Alive Mother Zombies: none");
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
@ -431,6 +558,16 @@ public Action Timer_MessageTestRound(Handle timer)
|
|||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action Timer_LockMotherZMNames(Handle timer)
|
||||||
|
{
|
||||||
|
if(strlen(g_cOriginalMotherZMNames))
|
||||||
|
g_cOriginalMotherZMNames[strlen(g_cOriginalMotherZMNames) - 2] = 0;
|
||||||
|
|
||||||
|
PrintCenterTextAll("Zombie Infection has been spread!");
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
public Action Timer_HandleHPShield(Handle timer)
|
public Action Timer_HandleHPShield(Handle timer)
|
||||||
{
|
{
|
||||||
char sNemesis[32];
|
char sNemesis[32];
|
||||||
|
Loading…
Reference in New Issue
Block a user