ULX

Author Topic: I'm new to server making. How do I add sounds?  (Read 1668 times)

0 Members and 2 Guests are viewing this topic.

Offline N00bModder

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
I'm new to server making. How do I add sounds?
« on: March 17, 2017, 06:30:09 PM »
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)





An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given