Fixed ambience.
This commit is contained in:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user