• Cant setup ttt end of round music.
    10 replies, posted
So I have been trying to setup trouble in terrorist town music on my Garrys mod server. I cant seem to get it to work. And I have been trying to fix this for a few hours .-.. Anyone know how to fix this or have another addon that may be better. (The server is linux) [QUOTE]--///////////////////////////////////////// ----FEATURE LIST---- ///////////////////////////////////////////-- --//// ////-- --//// No need to manually resource.AddFile ////-- --//// ////-- --//// Three tables to add the different sounds to the different type of wins. ////-- --//// ////-- --//// No need to add "sound/" in the tables, if you do, you'll actually be screwing up the resource.addfile ////-- --//// ////-- --//// Sounds are randomly chosen inside the table matching the proper win method ////-- --//// ////-- --//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////-- --///////////////////////////////////////// ----WARNINGS AND TIPS---- ///////////////////////////////////////////-- --//// ////-- --//// Remember that you can only use "/" and not "\" ////-- --//// ////-- --//// Remember to keep a table actually not fully empty to avoid code breaking. You can even just leave a wrong path in it ////-- --//// ////-- --//// For a guide on how to add new sounds, check the workshop page ////-- --//// ////-- --//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////-- -- Sounds played when the innocent win local InnocentWinSounds = { "1.wav", "2.wav", "3.wav", "4.wav", "5.wav", "7.wav", "8.wav" } -- Sounds played when the traitors win local TraitorWinSounds = { ""1.wav", "2.wav", "3.wav", "4.wav", "5.wav", "7.wav", "8.wav" } -- Sounds played when time is up local OutOfTimeSounds = { "1.wav", "2.wav", "3.wav", "4.wav", "5.wav", "7.wav", "8.wav" } for k, v in pairs (InnocentWinSounds) do resource.AddFile("sound/"..v) util.PrecacheSound("sound/"..v) end for k, v in pairs (TraitorWinSounds) do resource.AddFile("sound/"..v) util.PrecacheSound("sound/"..v) end for k, v in pairs (OutOfTimeSounds) do resource.AddFile("sound/"..v) util.PrecacheSound("sound/"..v) end local function PlaySoundClip(win) if win == WIN_INNOCENT then BroadcastLua('surface.PlaySound("'..InnocentWinSounds[math.random(1, #InnocentWinSounds)]..'")') elseif win == WIN_TRAITOR then BroadcastLua('surface.PlaySound("'..TraitorWinSounds[math.random(1, #TraitorWinSounds)]..'")') elseif win == WIN_TIMELIMIT then BroadcastLua('surface.PlaySound("'..OutOfTimeSounds[math.random(1, #OutOfTimeSounds)]..'")') end end hook.Add("TTTEndRound", "SoundClipEndRound", PlaySoundClip)[/QUOTE]
Are the files set to be downloaded to the clients? EDIT: Sorry, I derped .-. Anyways, does the console say anything when the sound is supposed to be broadcasted?
No it does not.
just use this one as it works perfectly. [url]http://steamcommunity.com/sharedfiles/filedetails/?id=125659070&searchtext=ttt+music[/url] also please remember when pasting code to use [lua] [/lua] tags as it makes it a lot easier to read
Is there anyway to get it to play not 1 but multiple different songs? [editline]25th June 2013[/editline] [QUOTE=Evil Melon;41177867]just use this one as it works perfectly. [url]http://steamcommunity.com/sharedfiles/filedetails/?id=125659070&searchtext=ttt+music[/url] also please remember when pasting code to use [lua] [/lua] tags as it makes it a lot easier to read[/QUOTE] Is there anyway to get it to play not 1 but multiple different songs?
[QUOTE=dmb7116;41178058]Is there anyway to get it to play not 1 but multiple different songs? [editline]25th June 2013[/editline] Is there anyway to get it to play not 1 but multiple different songs?[/QUOTE] math.Rand and some tables
Here's the one that I give out: [url]https://dl.dropboxusercontent.com/u/26074909/ttt_end_round.rar[/url] It plays the same song across all clients. It could be modified to do what you want.
[QUOTE=rejax;41178268]math.Rand and some tables[/QUOTE] math.Rand is a utility function made by garry to give random floats. You want math.random(a[, b]) for integers.
Eww broadcastlua
[QUOTE=JetBoom;41178300]math.Rand is a utility function made by garry to give random floats. You want math.random(a[, b]) for integers.[/QUOTE] Oops, thanks! I'm still learning.
[QUOTE=JetBoom;41178300]math.Rand is a utility function made by garry to give random floats. You want math.random(a[, b]) for integers.[/QUOTE] Or since it's a table: table.random(TableName)
Sorry, you need to Log In to post a reply to this thread.