From 639361b95f77866a7b01e7b27b2c74136eb7357c Mon Sep 17 00:00:00 2001 From: jenz Date: Fri, 23 Feb 2024 23:12:06 +0100 Subject: [PATCH] added ambient sound and boss sounds as extra settings --- ZombieRiot/configs/unloze_zr/extra.txt | 31 +++++++++------ ZombieRiot/scripting/unloze_zr.sp | 54 ++++++++++++++++++++++++-- 2 files changed, 70 insertions(+), 15 deletions(-) diff --git a/ZombieRiot/configs/unloze_zr/extra.txt b/ZombieRiot/configs/unloze_zr/extra.txt index d7cb2f1a..412938b0 100644 --- a/ZombieRiot/configs/unloze_zr/extra.txt +++ b/ZombieRiot/configs/unloze_zr/extra.txt @@ -1,15 +1,22 @@ "ExtraSettings" { - "Extras" - { - "Respawn Time" "9.000000" - "round start zclass time" "15.0" - "zmsoundInterval" "15.0" - "botStuckCount" "3" - "botStuckPush" "250.0" - "zmsoundsFile" "sound/music/zr/zombie_pain1.mp3" - "zmsoundsFile" "sound/music/zr/zombie_voice_idle2.mp3" - "Global command" "mp_afterroundmoney 16000" - "Global command" "bot_difficulty 3" - } + "Extras" + { + "Respawn Time" "9.000000" + "round start zclass time" "15.0" + "zmsoundInterval" "15.0" + "botStuckCount" "3" + "botStuckPush" "250.0" + "zmsoundsFile" "sound/music/zr/zombie_pain1.mp3" + "zmsoundsFile" "sound/music/zr/zombie_voice_idle2.mp3" + "zm spawn protection" "1.0" + "human spawn protection" "10.0" + "Global command" "mp_afterroundmoney 16000" + "Global command" "bot_difficulty 3" + "ambientSound" "ambient/zr/zr_ambience.mp3" + "ambientLoopDuration" "60.3" + "bossSound" "ambient/zr/satanic_demona.mp3" + "bossLoopDuration" "155.3" + } } + diff --git a/ZombieRiot/scripting/unloze_zr.sp b/ZombieRiot/scripting/unloze_zr.sp index d08ae522..fc1f11c1 100644 --- a/ZombieRiot/scripting/unloze_zr.sp +++ b/ZombieRiot/scripting/unloze_zr.sp @@ -44,7 +44,11 @@ char g_cZMSounds[g_dIndexes][g_dLength]; char g_cWeaponEntity[g_dIndexes][g_dLength]; char g_cWeaponNames[g_dIndexes][g_dLength]; char g_cWeaponCommand[g_dIndexes][g_dLength]; +char g_cAmbientSOund[512]; +char g_cBossSound[512]; +float g_fAmbientSoundLoopDuration; +float g_fBossSoundLoopDuration; int g_iLength = g_dLength - 1; int g_iWave; int g_iSpeedDelayClient[MAXPLAYERS + 1]; @@ -157,7 +161,6 @@ public void OnPluginStart() g_hCheckBotStuck = CreateTimer(2.0, Timer_CheckIfBotsStuck, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); g_hZombieSounds = CreateTimer(g_fZMSounds, Timer_zombieSounds, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); g_hFixKNife = CreateTimer(2.0, Timer_FixKNife, INVALID_HANDLE, TIMER_REPEAT); - g_hAmbient = CreateTimer(60.3, Timer_Ambient, INVALID_HANDLE, TIMER_REPEAT); // 0.3 seconds without sound for (int i = 1; i < MaxClients; i++) { @@ -907,6 +910,33 @@ public void LoadExtraSettings() PrecacheSound(g_cZMSounds[g_iSoundIndexes][g_iLength]); g_iSoundIndexes++; } + if (StrContains(l_cLine, "ambientSound", false) > -1) + { + ReplaceStrings(l_cLine, "ambientSound"); + Format(g_cAmbientSOund, sizeof(g_cAmbientSOund), l_cLine); + } + if (StrContains(l_cLine, "ambientLoopDuration") > -1) + { + ReplaceStrings(l_cLine, "ambientLoopDuration"); + if (StringToInt(l_cLine) > 1) + g_fAmbientSoundLoopDuration = StringToFloat(l_cLine); + else + g_fAmbientSoundLoopDuration = 10.0; + } + if (StrContains(l_cLine, "bossSound", false) > -1) + { + ReplaceStrings(l_cLine, "bossSound"); + Format(g_cBossSound, sizeof(g_cBossSound), l_cLine); + } + + if (StrContains(l_cLine, "bossLoopDuration") > -1) + { + ReplaceStrings(l_cLine, "bossLoopDuration"); + if (StringToInt(l_cLine) > 1) + g_fBossSoundLoopDuration = StringToFloat(l_cLine); + else + g_fBossSoundLoopDuration = 10.0; + } } delete l_hFile; } @@ -1095,7 +1125,6 @@ public void OnClientDisconnect(int client) //---------------------------------------------------------------------------------------------------- public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast) { - EmitAmbience("ambient/zr/zr_ambience.mp3"); g_iHumanCount = 999; g_iZombieCount = 999; g_bRoundInProgress = false; @@ -1119,6 +1148,18 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast } } } + if (g_hAmbient != null) + delete g_hAmbient; + if (StrContains(g_cDaysTitles[g_iWave - 1], "BOSS", false) != -1) //the daystitle contains the word boss in it + { + EmitAmbience(g_cBossSound); //nobody will ever understand why megalovania was on the servers since 2020. + g_hAmbient = CreateTimer(g_fBossSoundLoopDuration, Timer_Ambient, INVALID_HANDLE, TIMER_REPEAT); // 0.3 seconds without sound + } + else + { + EmitAmbience(g_cAmbientSOund); + g_hAmbient = CreateTimer(g_fAmbientSoundLoopDuration, Timer_Ambient, INVALID_HANDLE, TIMER_REPEAT); // 0.3 seconds without sound + } } //---------------------------------------------------------------------------------------------------- // Purpose: @@ -2201,6 +2242,13 @@ void StopAmbience(const char []sound) public Action Timer_Ambient(Handle timer, any userid) { - EmitAmbience("ambient/zr/zr_ambience.mp3"); + if (StrContains(g_cDaysTitles[g_iWave - 1], "BOSS", false) != -1) //the daystitle contains the word boss in it + { + EmitAmbience(g_cBossSound); //nobody will ever understand why megalovania was on the servers since 2020. + } + else + { + EmitAmbience(g_cAmbientSOund); + } return Plugin_Handled; }