I'm trying to add a sound in TTT for when the round ends. I didn't have a sound folder, so I created one, I added some .wav files. I tried to test it out by playsound: sound/MW2.wav. But it said: That sound doesn't exist on the server. I don't know what to do I did added this LUA file in the
C:\GMOD\garrysmod\addons\End of Round Music\lua\autorun directory.
Here is the inside of the LUA file:
-- You can add up to 3 sounds for this. Add or delete resource.addfile as you need
resource.AddFile("sound/MW2.wav")
resource.AddFile("sound/Traffic.wav")
resource.AddFile("sound/Mission.wav")
-- Remember to change the name of the sounds to the sound you want from above
local function PlayMusic(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua('surface.PlaySound("MW2.wav")')
elseif wintype == WIN_TRAITOR then
BroadcastLua('surface.PlaySound("Traffic.wav")')
elseif wintype == WIN_TIMELIMIT then
BroadcastLua('surface.PlaySound("Mission.wav")')
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)