I'm trying to implement a custom sound into my game but whenever I run the command to play it, it tells me that the directory does not exist. Ant help? code:
resource.AddFile( "sound/cool/dance.wav" )
sound.Add( {
name = "dance",
channel = CHAN_STATIC,
volume = 1.0,
level = 80,
pitch = { 95, 110 },
sound = "sound/cool/dance.wav"
} )
hook.Add( "OnPlayerChat", "test", function( ply, text, public )
if ( string.lower( text ) == "!test") then
ply:EmitSound( "dance", 75, 100, 1, CHAN_AUTO ) -- Same as below
return ""
end
end )
Fixed it
How did you fix it, you come here for help saying you fixed it what if other people have this problem, just note what you changed or what was the problem
Oh yes sorry. Remove sound/
Here's how to get sounds to work in source based off my knowledge, since this thread is a big stump,
Make sure you use .wav files, if the file you want to use isn't .wav, use a online converter or download one.
Download Download Wavosaur
Open wavosaur, drag and drop the sound into wavosaur,
Make sure it's mono channel and that the rate is 44100Hz or it will not work.
Add it via sound.Add ( path is relative to the "sound" directory AFAIK )
Play it using whatever method you want.
Done
https://i.imgur.com/17BhfAy.png
Sorry, you need to Log In to post a reply to this thread.