• Need sound to play when player respawns
    12 replies, posted
trying this code, but not working so far ( the .wav 's are named 1 - 10) and the "sounds" file is in the gamemode folder, same folder the script is in function GM:PlayerSpawn( ply ) self:EmitSound( "sounds/" .. math.Rand(0, 10) .. ".wav", 100, 100 ) end
You need the sound to play? PlayerSpawn is a server-side hook. math.Rand returns a float, not an int. Are your sounds really just named 1,2,3,4,5,6,7,8,9 and 10? You're trying to make the gamemode itself emit the sound.
correct, when a player respawns they will hear one of the 10 sounds
Use the playerspawn hook to network a message to all players abd then they get a sound play with surface.PlaySound
this is really strange, so to avoid confusion i put the sounds right into the same folder as the lua scripts, and i get this Failed to load sound "1.wav", file probably missing from disk/repository Failed to load sound "rpkm-1.wav", file probably missing from disk/repository even though those are the exact sounds
The slashes are okay, the error output flops them for no reason, but the folder should be sound, not sounds.
where do i make a sound folder, in content?
why would sounds go in the lua folder?? make them in the folder "sound" and give the lua code as path "1.wav" the one is the file name
ah ok, now its playing one of the sounds, but the rest must have the wrong bitrate, *** Invalid sample rate (16000) for sound '8.wav'.
no just in the addons folder? in the same folder shere you make the lua folder too. but not INSIDE the lua folder. in the same shere lua folder is too. Do you even know the basics?
Making some progress so at 16000 it recognizes that the file exists but refuses to play it, now at 44100 it forgets the file exists Failed to load sound "9.wav", file probably missing from disk/repository
so everything works now?
Yes, thank you!
Sorry, you need to Log In to post a reply to this thread.