added ambient sound and boss sounds as extra settings

This commit is contained in:
jenz 2024-02-23 23:12:06 +01:00
parent 2d661b5a30
commit 639361b95f
2 changed files with 70 additions and 15 deletions

View File

@ -9,7 +9,14 @@
"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"
}
}

View File

@ -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;
}