TTT end round Music. Help!

I worked up this code.

resource.AddFile(“sounds/SOLACE - Average things.mp3”)

// End of Round Sound NOT MUSIC
local function PlaySound(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua(‘surface.PlaySound(“SOLACE - Average things.mp3”)’)
hook.Add(“TTTEndRound”, “PlaySound”, PlaySound)

So my question is, where do I put it, and will it work? If not, can you point me in the right direction?

make the sound files more readable?, like a1 and a2, also, put it in lua/autorun/server, or lua/autorun and it should work, also next time use code tags,


local function PlaySound(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua('surface.PlaySound("SOLACE - Average things.mp3")')
BroadcastLua('surface.PlaySound("shadows_of_mind.m p3")')
hook.Add("TTTEndRound", "PlaySound", PlaySound)

like that,

The first block of code you had was correct, pantera’s is the wrong syntax.

It’s probably not working because you have “m p3”.

Niether worked. I really want this to work!

// Initialize the tables
local im, tm, km = {}, {}, {}

 // Inno music

for u,i in pairs(file.Find(“sound/tttend/inno/*”,“MOD”)) do
table.insert(im, i)
print("im: " … #im)

 //Traitor music

for r,t in pairs(file.Find(“sound/tttend/trait/*”,“MOD”)) do
table.insert(tm, t)
print("tm: " … #tm)

//Time out

for j,k in pairs(file.Find(“sound/tttend/time/*”,“MOD”)) do
table.insert(km, k)
print("km: " … #km)

 //Plays music depending on wintype, and it's randomized

local function wDMX(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua(‘surface.PlaySound("’ … table.Random(im) … ‘")’)
elseif wintype == WIN_TRAITOR then
BroadcastLua(‘surface.PlaySound("’ … table.Random™ … ‘")’)
elseif wintype == WIN_TIMELIMIT then
BroadcastLua(‘surface.PlaySound("’ … table.Random(km) … ‘")’)

hook.Add(“TTTEndRound”, “wDMx”, wDMX)[/lua]

place your sound files in the directory sound/tttend/whatever end it is accordingly. Confirmed working, if it doesnt work for you, you did something wrong.

Where do I put the script?

didnt bother with fixing syntax


Didn’t work. Could we Skype or somthing? I put the music in garrysmod/sound/tttend/inno (Or trait or time). I put it in fastdl too. It is not working. I really need this to work…

[editline]14th October 2013[/editline]

Do you think it is a config problem between FastDL and the server? Players are saying its not even saying its downloading when they do in…

[editline]14th October 2013[/editline]


If you’re not able to do it, it’s probably not meant to be.

resource.AddFile the file, then broadcastlua surface.PlaySound(path/to/sou.nd)
Not very complicated.

EDIT: Sometimes fastdl has issues with files with spaces and caps, rename the file accordingly:

ex. before: SoUnD FiLe.mp3 after: soundfile.mp3

I made a script for this, if you want it. Go ahead and slap this into addons.

However, if you just want to use your code, I believe you need that to run serverside, and the sound directory is just ‘sound/’, not ‘sounds/’. Make sure you have the path correct down to the last letter. Also, what kind of error are you getting in console, if any?

its the fastdl then, there is no way it’s not working if you created the directories, put the mp3/wav in, and restarted server. I’ve confirmed this on my own server local + dedicated multiple times before.

Contact your host.

“I put the music in garrysmod/sound/tttend/inno”
"[lua]resource.AddFile(“sounds/SOLACE - Average things.mp3”) – Wot
resource.AddFile(“sounds/shadows_of_mind.mp3”) --Wot
BroadcastLua(‘surface.PlaySound(“SOLACE - Average things.mp3”)’) – Wot
BroadcastLua(‘surface.PlaySound(“shadows_of_mind.m p3”)’) – Wot

It’s not the FastDL. He has paths messed up.

for u,i in pairs(file.Find(“sound/tttend/inno/*”,“MOD”)) do

no, sound/tttend/inno is the correct path.

I have no idea how, but I totally skipped over your post when I read this.