diff --git a/src/zr/event.inc b/src/zr/event.inc index d31f424..c4f843c 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -109,6 +109,7 @@ public Action:EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcas // Forward event to modules. RoundEndOnRoundEnd(reason); InfectOnRoundEnd(); + SEffectsOnRoundEnd(); RespawnOnRoundEnd(); } diff --git a/src/zr/soundeffects/ambientsounds.inc b/src/zr/soundeffects/ambientsounds.inc index dc1f8f0..8543612 100644 --- a/src/zr/soundeffects/ambientsounds.inc +++ b/src/zr/soundeffects/ambientsounds.inc @@ -117,6 +117,18 @@ AmbientSoundsOnRoundStart() AmbientSoundsRestart(); } +/** + * The round is ending. + */ +AmbientSoundsOnRoundEnd() +{ + // x = client index + for (new x = 1; x <= MaxClients; x++) + { + bAmbientSoundsIsPlaying[x] = false; + } +} + /** * Client is spawning into the game. * @@ -145,6 +157,9 @@ AmbientSoundsOnClientSpawn(client) // Emit ambient sound. SEffectsEmitAmbientSound(sound, ambientvolume, client); + + // Flag client that sound is playing. + bAmbientSoundsIsPlaying[client] = true; } /** @@ -164,18 +179,6 @@ AmbientSoundsRestart() return; } - // x = client index - for (new x = 1; x <= MaxClients; x++) - { - // If client isn't in-game, then stop. - if (!IsClientInGame(x)) - { - continue; - } - - bAmbientSoundsIsPlaying[x] = false; - } - // Get ambient sound length. new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]); @@ -203,6 +206,9 @@ public Action:AmbientSoundsTimer(Handle:timer) // Get ambient sound volume. new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]); + // Stop sound before playing again. + SEffectsStopAmbientSound(sound); + // Emit ambient sound. SEffectsEmitAmbientSound(sound, ambientvolume); diff --git a/src/zr/soundeffects/soundeffects.inc b/src/zr/soundeffects/soundeffects.inc index 9cdb56d..e85e155 100644 --- a/src/zr/soundeffects/soundeffects.inc +++ b/src/zr/soundeffects/soundeffects.inc @@ -61,6 +61,15 @@ SEffectsOnRoundStart() AmbientSoundsOnRoundStart(); } +/** + * The round is ending. + */ +SEffectsOnRoundEnd() +{ + // Forward event to sub-modules. + AmbientSoundsOnRoundEnd(); +} + /** * Client is spawning into the game. * @@ -118,9 +127,6 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client // Precache sound before playing. PrecacheSound(sound); - // Stop sound before playing again. - SEffectsStopAmbientSound(sound); - if (ZRIsClientValid(client)) { // Emit ambient sound. @@ -140,10 +146,7 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client } // Emit ambient sound. - EmitSoundToClient(x, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume); - - // Flag client that sound is playing. - bAmbientSoundsIsPlaying[x] = true; + EmitSoundToClient(x, sound, SOUND_FROM_PLAYER, SNDCHAN_AUTO, _, _, ambientvolume); } } }