Here is my code
local function PlayMusic(wintype) if wintype == WIN_INNOCENT then BroadcastLua('surface.PlaySound("ttt/weed.wav")') else BroadcastLua('surface.PlaySound("ttt/weed.wav")') end end hook.Add("TTTEndRound", "MyMusic", PlayMusic) local function PlayStartMusic() BroadcastLua('surface.PlaySound("ttt/weed.wav")') end hook.Add("TTTBeginRound", "MyStartMusic", PlayStartMusic)
This lua file is in the lua/autorun/server location.
The code to download the files is:
Basically I was browsing around trying to find out how to make custom sounds play on my server for when terrorist and innocents win(…the files are the same because I wanted to test it out first…). I found this code,and it works but it gives me Failed to load sound “ttt/weed.wav”, file probably missing from disk/repository. I have put the sound files in sound/ttt/weed.wav . The files are being downloaded. I Have tried opening the file in audacity and then setting the sample rate to 44kHz and also saving it as PCM 16bit WAV. I still got that error and can not find out what I did wrong.