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

0 Members and 1 Guest 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

-- Remember to change the name of the sounds to the sound you want from above
local function PlayMusic(wintype)
   if wintype == WIN_INNOCENT then

   elseif wintype == WIN_TRAITOR then

   elseif wintype == WIN_TIMELIMIT then
hook.Add("TTTEndRound", "MyMusic", PlayMusic)

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 47
Re: I'm new to server making. How do I add sounds?
« Reply #1 on: March 18, 2017, 10:26:52 AM »
surface.PlaySound plays a sound relative to the sound/ folder. So if you have a file "sound/MW2.Wav" then
Code: Lua
  1. surface.PlaySound( "MW2.wav" )
should work just fine. Are you getting any errors server or client side?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam Group (feel free to join!)

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.