Add mother zombie infection countdown sound.
This commit is contained in:
parent
30a1d4b2ce
commit
e73d61fbf3
@ -478,6 +478,16 @@
|
||||
"en" "Could not bring back @green{1}@default to life."
|
||||
}
|
||||
|
||||
"CDS enable"
|
||||
{
|
||||
"en" "Infect countdown sound enabled."
|
||||
}
|
||||
|
||||
"CDS disable"
|
||||
{
|
||||
"en" "Infect countdown sound disabled."
|
||||
}
|
||||
|
||||
// ===========================
|
||||
// Damage (core)
|
||||
// ===========================
|
||||
@ -534,6 +544,11 @@
|
||||
"en" "ZMarket - Customize loadouts here"
|
||||
}
|
||||
|
||||
"Menu main cds"
|
||||
{
|
||||
"en" "CDS - Toggle infect countdown sound"
|
||||
}
|
||||
|
||||
// ===========================
|
||||
// Weapons (core)
|
||||
// ===========================
|
||||
@ -995,6 +1010,12 @@
|
||||
"en" "ZMarket Loadout"
|
||||
}
|
||||
|
||||
"ZCookies menu main cds"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "Infect Countdown Sound: {1}"
|
||||
}
|
||||
|
||||
// ===========================
|
||||
// ZSpawn (module)
|
||||
// ===========================
|
||||
|
BIN
cstrike/sound/zr/countdown/1.mp3
Normal file
BIN
cstrike/sound/zr/countdown/1.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/10.mp3
Normal file
BIN
cstrike/sound/zr/countdown/10.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/2.mp3
Normal file
BIN
cstrike/sound/zr/countdown/2.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/3.mp3
Normal file
BIN
cstrike/sound/zr/countdown/3.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/4.mp3
Normal file
BIN
cstrike/sound/zr/countdown/4.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/5.mp3
Normal file
BIN
cstrike/sound/zr/countdown/5.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/6.mp3
Normal file
BIN
cstrike/sound/zr/countdown/6.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/7.mp3
Normal file
BIN
cstrike/sound/zr/countdown/7.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/8.mp3
Normal file
BIN
cstrike/sound/zr/countdown/8.mp3
Normal file
Binary file not shown.
BIN
cstrike/sound/zr/countdown/9.mp3
Normal file
BIN
cstrike/sound/zr/countdown/9.mp3
Normal file
Binary file not shown.
@ -351,6 +351,7 @@ public OnClientCookiesCached(client)
|
||||
ClassOnCookiesCached(client);
|
||||
WeaponsOnCookiesCached(client);
|
||||
ZHPOnCookiesCached(client);
|
||||
InfectOnCookiesCached(client);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,6 +34,7 @@ CookiesInit()
|
||||
ClassOnCookiesCreate();
|
||||
WeaponsOnCookiesCreate();
|
||||
ZHPOnCookiesCreate();
|
||||
InfectOnCookiesCreate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,6 +115,7 @@ enum CvarsList
|
||||
Handle:CVAR_INFECT_MZOMBIE_MIN,
|
||||
Handle:CVAR_INFECT_MZOMBIE_MAX,
|
||||
Handle:CVAR_INFECT_MZOMBIE_COUNTDOWN,
|
||||
Handle:CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND,
|
||||
Handle:CVAR_INFECT_MZOMBIE_RESPAWN,
|
||||
Handle:CVAR_INFECT_EXPLOSION,
|
||||
Handle:CVAR_INFECT_FIREBALL,
|
||||
@ -333,6 +334,7 @@ CvarsCreate()
|
||||
g_hCvarsList[CVAR_INFECT_MZOMBIE_MIN] = CreateConVar("zr_infect_mzombie_min", "1", "Minimum number of mother zombies. Range mode only, cannot be zero.");
|
||||
g_hCvarsList[CVAR_INFECT_MZOMBIE_MAX] = CreateConVar("zr_infect_mzombie_max", "3", "Maximum number of mother zombies. Range mode only, cannot be zero.");
|
||||
g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN] = CreateConVar("zr_infect_mzombie_countdown", "0", "Counts down to the first infection of the round. Countdown is printed in the middle of the client's screen.");
|
||||
g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND] = CreateConVar("zr_infect_mzombie_countdown_sound","0", "Play back countdown sound to clients. [0 = Disabled | 1 = Default Disabled | 2 = Default enabled]");
|
||||
g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN] = CreateConVar("zr_infect_mzombie_respawn", "0", "Teleport mother zombies back to spawn on infect.");
|
||||
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MIN] = CreateConVar("zr_infect_spawntime_min", "30.0", "Minimum time from the start of the round until picking the mother zombie(s).");
|
||||
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MAX] = CreateConVar("zr_infect_spawntime_max", "50.0", "Maximum time from the start of the round until picking the mother zombie(s).");
|
||||
|
@ -76,6 +76,26 @@ new Handle:g_tInfectCountdown = INVALID_HANDLE;
|
||||
*/
|
||||
new Handle:g_hInfectCountdownData = INVALID_HANDLE;
|
||||
|
||||
/**
|
||||
* Name of the cookie for toggle state of the infect countdown sound
|
||||
*/
|
||||
#define CDS_COOKIE_ENABLED "zr_cds"
|
||||
|
||||
/**
|
||||
* Number of available/precached infect countdown sounds.
|
||||
*/
|
||||
new g_iInfectCountdownSounds = 0;
|
||||
|
||||
/**
|
||||
* Array for storing infect countdown sound client settings.
|
||||
*/
|
||||
new g_aInfectCountdownSoundClients[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Cookie handle for the toggle state of the countdown sound on a client.
|
||||
*/
|
||||
new Handle:g_hInfectCountdownSoundEnabledCookie = INVALID_HANDLE;
|
||||
|
||||
/**
|
||||
* Array for flagging client as zombie.
|
||||
*/
|
||||
@ -158,6 +178,42 @@ InfectOnLibraryRemoved(const String:name[])
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create infect-related cookies here.
|
||||
*/
|
||||
InfectOnCookiesCreate()
|
||||
{
|
||||
// Create cookie handle if it doesn't exist.
|
||||
if (g_hInfectCountdownSoundEnabledCookie == INVALID_HANDLE)
|
||||
{
|
||||
g_hInfectCountdownSoundEnabledCookie = RegClientCookie(CDS_COOKIE_ENABLED, "Toggle infection countdown sound.", CookieAccess_Protected);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called once a client's saved cookies have been loaded from the database.
|
||||
*
|
||||
* @param client Client index.
|
||||
*/
|
||||
InfectOnCookiesCached(client)
|
||||
{
|
||||
// Get default client setting from cvar.
|
||||
new countdownsound = GetConVarInt(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND]);
|
||||
|
||||
// Get cds enabled cookie value.
|
||||
decl String:cdsenabled[8];
|
||||
GetClientCookie(client, g_hInfectCountdownSoundEnabledCookie, cdsenabled, sizeof(cdsenabled));
|
||||
|
||||
// If the cookie is empty, then set the default value.
|
||||
if (!cdsenabled[0])
|
||||
{
|
||||
// Set cookie to default value from cvar.
|
||||
CookiesSetClientCookieBool(client, g_hInfectCountdownSoundEnabledCookie, countdownsound == 2);
|
||||
}
|
||||
|
||||
g_aInfectCountdownSoundClients[client] = CookiesGetClientCookieBool(client, g_hInfectCountdownSoundEnabledCookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map is ending.
|
||||
*/
|
||||
@ -187,17 +243,33 @@ InfectLoad()
|
||||
decl String:sound[PLATFORM_MAX_PATH];
|
||||
GetConVarString(g_hCvarsList[CVAR_INFECT_SOUND], sound, sizeof(sound));
|
||||
|
||||
// If infect sound cvar is empty, then stop.
|
||||
if (!sound[0])
|
||||
// If infect sound cvar is not empty.
|
||||
if (sound[0])
|
||||
{
|
||||
return;
|
||||
// Prepend sound/ to the path.
|
||||
Format(sound, sizeof(sound), "sound/%s", sound);
|
||||
|
||||
// Add sound file to downloads table.
|
||||
AddFileToDownloadsTable(sound);
|
||||
}
|
||||
|
||||
// Prepend sound/ to the path.
|
||||
Format(sound, sizeof(sound), "sound/%s", sound);
|
||||
// Precache countdown sounds
|
||||
int count = 1;
|
||||
new bool:countdownsound = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND]);
|
||||
while (countdownsound)
|
||||
{
|
||||
Format(sound, sizeof(sound), "sound/zr/countdown/%i.mp3", count);
|
||||
if (!FileExists(sound))
|
||||
break;
|
||||
|
||||
// Add sound file to downloads table.
|
||||
AddFileToDownloadsTable(sound);
|
||||
AddFileToDownloadsTable(sound);
|
||||
ReplaceString(sound, sizeof(sound), "sound/", "");
|
||||
|
||||
PrecacheSound(sound);
|
||||
|
||||
count++;
|
||||
g_iInfectCountdownSounds = count;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,6 +279,7 @@ InfectOnCommandsCreate()
|
||||
{
|
||||
RegConsoleCmd("zr_infect", InfectInfectCommand, "Infect a client. Usage: zr_infect <filter> [respawn - 1/0]");
|
||||
RegConsoleCmd("zr_human", InfectHumanCommand, "Turn a client into a human. Usage: zr_human <filter> [respawn - 1/0]");
|
||||
RegConsoleCmd(SAYHOOKS_KEYWORD_CDS, CDSCommand, "Toggle infection countdown sound.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -266,6 +339,8 @@ InfectClientInit(client)
|
||||
*/
|
||||
InfectOnClientDisconnect(client)
|
||||
{
|
||||
g_aInfectCountdownSoundClients[client] = false;
|
||||
|
||||
// If client is still connecting, then stop.
|
||||
if (!IsClientInGame(client))
|
||||
{
|
||||
@ -796,8 +871,7 @@ InfectMoveAllToCT()
|
||||
*/
|
||||
public Action:InfectCountdown(Handle:timer)
|
||||
{
|
||||
new bool:countdown = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN]);
|
||||
if (!countdown)
|
||||
if (!GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN]))
|
||||
{
|
||||
InfectStopCountdown();
|
||||
return Plugin_Stop;
|
||||
@ -820,6 +894,27 @@ public Action:InfectCountdown(Handle:timer)
|
||||
{
|
||||
// Print the countdown text to the clients.
|
||||
TranslationPrintCenterTextAll(false, "Infect countdown", RoundToNearest(length - counter));
|
||||
|
||||
new bool:countdownsound = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND]);
|
||||
new countdown = RoundToNearest(length - counter);
|
||||
if (countdownsound && g_iInfectCountdownSounds != 0 && countdown > 0 && countdown <= g_iInfectCountdownSounds)
|
||||
{
|
||||
decl String:sound[PLATFORM_MAX_PATH];
|
||||
Format(sound, sizeof(sound), "zr/countdown/%i.mp3", countdown);
|
||||
|
||||
int[] clients = new int[MaxClients];
|
||||
int total = 0;
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i) && g_aInfectCountdownSoundClients[i])
|
||||
{
|
||||
clients[total++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (total)
|
||||
EmitSound(clients, total, sound);
|
||||
}
|
||||
}
|
||||
|
||||
counter++;
|
||||
@ -1665,3 +1760,62 @@ InfectMode:InfectGetModeOrFail()
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Command callback (zhp)
|
||||
* Shows real HP as zombie.
|
||||
*
|
||||
* @param client The client index.
|
||||
* @param argc Argument count.
|
||||
*/
|
||||
public Action:CDSCommand(client, argc)
|
||||
{
|
||||
// If client is console, then stop and tell them this feature is for players only.
|
||||
if (ZRIsConsole(client))
|
||||
{
|
||||
TranslationPrintToServer("Must be player");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// Toggle CDS setting.
|
||||
InfectCountdownSoundToggle(client);
|
||||
|
||||
// This stops the "Unknown command" message in client's console.
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle infect countdown sound on a client.
|
||||
*
|
||||
* @param client The client index.
|
||||
*/
|
||||
bool:InfectCountdownSoundToggle(client)
|
||||
{
|
||||
// If infect countdown sound is disabled, then stop.
|
||||
new bool:countdownsound = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND]);
|
||||
if (!countdownsound)
|
||||
{
|
||||
// Tell client feature is disabled.
|
||||
TranslationPrintToChat(client, "Feature is disabled");
|
||||
|
||||
// Stop.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Toggle the value.
|
||||
g_aInfectCountdownSoundClients[client] = !g_aInfectCountdownSoundClients[client];
|
||||
|
||||
// Store new value.
|
||||
CookiesSetClientCookieBool(client, g_hInfectCountdownSoundEnabledCookie, !!g_aInfectCountdownSoundClients[client]);
|
||||
|
||||
if (g_aInfectCountdownSoundClients[client])
|
||||
{
|
||||
TranslationPrintToChat(client, "CDS enable");
|
||||
}
|
||||
else
|
||||
{
|
||||
TranslationPrintToChat(client, "CDS disable");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
@ -91,6 +91,7 @@ ZMenuMain(client)
|
||||
decl String:ztele[MENU_LINE_HUGE_LENGTH];
|
||||
decl String:zhp[MENU_LINE_HUGE_LENGTH];
|
||||
decl String:zmarket[MENU_LINE_HUGE_LENGTH];
|
||||
decl String:cds[MENU_LINE_HUGE_LENGTH];
|
||||
|
||||
// Translate each line into client's language.
|
||||
Format(title, sizeof(title), "%t\n ", "Menu main title", SAYHOOKS_CHAT_PUBLIC_DEFAULT, SAYHOOKS_CHAT_SILENT_DEFAULT);
|
||||
@ -101,6 +102,7 @@ ZMenuMain(client)
|
||||
Format(ztele, sizeof(ztele), "%t", "Menu main ztele");
|
||||
Format(zhp, sizeof(zhp), "%t", "Menu main zhp");
|
||||
Format(zmarket, sizeof(zmarket), "%t", "Menu main zmarket");
|
||||
Format(cds, sizeof(cds), "%t", "Menu main cds");
|
||||
|
||||
// Add items to menu.
|
||||
|
||||
@ -120,6 +122,9 @@ ZMenuMain(client)
|
||||
AddMenuItem(menu_main, "zhp", zhp);
|
||||
AddMenuItem(menu_main, "zmarket", zmarket);
|
||||
|
||||
if (GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND]))
|
||||
AddMenuItem(menu_main, "cds", cds);
|
||||
|
||||
// Display menu to client.
|
||||
DisplayMenu(menu_main, client, MENU_TIME_FOREVER);
|
||||
}
|
||||
@ -191,6 +196,11 @@ public ZMenuMainHandle(Handle:menu, MenuAction:action, client, slot)
|
||||
// Send ZMarket menu.
|
||||
resend = !ZMarketMenuMain(client);
|
||||
}
|
||||
// Select CDS.
|
||||
case 7:
|
||||
{
|
||||
InfectCountdownSoundToggle(client);
|
||||
}
|
||||
}
|
||||
|
||||
// Resend is still true, then resend menu.
|
||||
|
@ -51,6 +51,7 @@
|
||||
#define SAYHOOKS_KEYWORD_ZHP "zhp"
|
||||
#define SAYHOOKS_KEYWORD_ZMARKET "zmarket"
|
||||
#define SAYHOOKS_KEYWORD_ZSHIELD "zshield"
|
||||
#define SAYHOOKS_KEYWORD_CDS "cds"
|
||||
/**
|
||||
* @endsection
|
||||
*/
|
||||
|
@ -49,26 +49,31 @@ ZCookiesMenuMain(client)
|
||||
|
||||
decl String:zhpenabled[MENU_LINE_SMALL_LENGTH];
|
||||
decl String:overlayenabled[MENU_LINE_SMALL_LENGTH];
|
||||
decl String:cdsenabled[MENU_LINE_SMALL_LENGTH];
|
||||
|
||||
// Get the current toggle state of the cookies.
|
||||
ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hZHPEnabledCookie), zhpenabled, sizeof(zhpenabled), false, client);
|
||||
ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hOverlayEnabledCookie), overlayenabled, sizeof(overlayenabled), false, client);
|
||||
ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hInfectCountdownSoundEnabledCookie), cdsenabled, sizeof(cdsenabled), false, client);
|
||||
|
||||
decl String:title[MENU_LINE_TITLE_LENGTH];
|
||||
decl String:zhp[MENU_LINE_REG_LENGTH];
|
||||
decl String:overlay[MENU_LINE_REG_LENGTH];
|
||||
decl String:zmarket[MENU_LINE_REG_LENGTH];
|
||||
decl String:cds[MENU_LINE_REG_LENGTH];
|
||||
|
||||
// Translate each line into client's language.
|
||||
Format(title, sizeof(title), "%t\n ", "ZCookies Menu main title");
|
||||
Format(zhp, sizeof(zhp), "%t", "ZCookies menu main zhp", zhpenabled);
|
||||
Format(overlay, sizeof(overlay), "%t", "ZCookies menu main overlay", overlayenabled);
|
||||
Format(zmarket, sizeof(zmarket), "%t", "ZCookies zmarket loadout");
|
||||
Format(cds, sizeof(cds), "%t", "ZCookies menu main cds", cdsenabled);
|
||||
|
||||
// Get conditional values for each option.
|
||||
new bool:zhpcvar = GetConVarBool(g_hCvarsList[CVAR_ZHP]); // For ZHP.
|
||||
new bool:overlaytoggle = GetConVarBool(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLE]); // For class overlay.
|
||||
new bool:zmarketenabled = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET]); // For ZMarket loadout.
|
||||
new bool:cdscvar = GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND]); // For infect countdown sound.
|
||||
|
||||
// Add items to menu.
|
||||
SetMenuTitle(zcookies_menu_main, title);
|
||||
@ -76,6 +81,9 @@ ZCookiesMenuMain(client)
|
||||
AddMenuItem(zcookies_menu_main, "overlay", overlay, MenuGetItemDraw(overlaytoggle));
|
||||
AddMenuItem(zcookies_menu_main, "zmarket", zmarket, MenuGetItemDraw(zmarketenabled));
|
||||
|
||||
if (GetConVarBool(g_hCvarsList[CVAR_INFECT_MZOMBIE_COUNTDOWN_SOUND]))
|
||||
AddMenuItem(zcookies_menu_main, "cds", cds, MenuGetItemDraw(cdscvar));
|
||||
|
||||
// Create a "Back" button to the main menu.
|
||||
SetMenuExitBackButton(zcookies_menu_main, true);
|
||||
|
||||
@ -127,6 +135,11 @@ public ZCookiesMenuMainHandle(Handle:menu, MenuAction:action, client, slot)
|
||||
// Don't resend ZCookies.
|
||||
resend = false;
|
||||
}
|
||||
// Toggled infect countdown sound.
|
||||
case 3:
|
||||
{
|
||||
InfectCountdownSoundToggle(client);
|
||||
}
|
||||
}
|
||||
|
||||
if (resend)
|
||||
|
Loading…
Reference in New Issue
Block a user