PDA

View Full Version : EmitAmbientSound doesn't work


Yeah=}
01-03-2012, 14:32
I use this code for precaching sound and adding this to the downloads table:

#define SND "res/hax.wav"
#define SND_FULL "sound/res/hax.wav"
...
public OnMapStart()
{
AddFileToDownloadsTable( SND_FULL );
PrecacheSound( SND, true );
}

but anyway when i try to play this sound using EmitAmbientSound it writes in console Failed to load sound "res\hax.wav", file probably missing from disk/repository and doesn't work.

Can anybody help me?

PS: File has been successfully downloaded from server, i have checked it.
PSPS: EmitSoundToClient also doesn't work.

Yeah=}
01-04-2012, 04:51
Up

Rehtag
01-04-2012, 05:02
Have you tried:

#define SND_FULL "res/hax.wav"

?

Yeah=}
01-04-2012, 08:40
Have you tried:

#define SND_FULL "res/hax.wav"

?

Yes, but when i replaced "sound/res/hax.wav" to "res/hax.wav" file hadn't been downloading :cry:

Powerlord
01-04-2012, 09:55
If this is an sv_pure 1 server, you need to add this path to your pure_server_whitelist.txt file or else the client won't actually play it even if they downloaded it. Note: The location of this file depends on which game this is. For HL2:DM, DoD:S, and TF2 it's in orangebox/hl2/ and for CS:S, it's in css/hl2/ (or it should be, I haven't verified this). For other games, it may not yet exist and must be created.

Specifically, you'd need to add

sound\res\hax.wav allow_from_diskor, if you have multiple files from this directory,
sound\res\... allow_from_diskAnd yes, those are backslashes. The specification for pure_server_whitelist.txt specifies backslashes.

Yeah=}
01-04-2012, 12:57
If this is an sv_pure 1 server, you need to add this path to your pure_server_whitelist.txt file or else the client won't actually play it even if they downloaded it. Note: The location of this file depends on which game this is. For HL2:DM, DoD:S, and TF2 it's in orangebox/hl2/ and for CS:S, it's in css/hl2/ (or it should be, I haven't verified this). For other games, it may not yet exist and must be created.

Specifically, you'd need to add

sound\res\hax.wav allow_from_diskor, if you have multiple files from this directory,
sound\res\... allow_from_diskAnd yes, those are backslashes. The specification for pure_server_whitelist.txt specifies backslashes.

Thanks, it works :)