End of Round Music Help?

Hey guys,My name is TheApexProject,I have the script end of round Music I don’t mean to force any work down on anyone,But may someone (Or people) Help me set this up I haven’t touched the code yet because I am totally confused,Not because it’s lua but the general paths of the files and such! So here is my code:

//
// sv_end_round_music.lua by Josh ‘Acecool’ Moser
//

//
// Define your music here, end each line with a ,
// You can define 1 to many sounds. It will play 1 of the list randomly, or the single one every time.
//
END_OF_ROUND_WIN_INNOCENT_SOUNDS = {
“round/sound1.mp3”,
“round/sound2.mp3”,
“round/sound3.mp3”,
}
END_OF_ROUND_WIN_TRAITOR_SOUNDS = {
“round/sound4.mp3”,
“round/sound5.mp3”,
“round/sound6.mp3”,
“round/sound7.mp3”,
}
END_OF_ROUND_WIN_TIMELIMIT_SOUNDS = {
“round/sound8.mp3”,
}

// You must define a default sound to play if some of your lists above are empty.
END_OF_ROUND_WIN_DEFAULT_SOUND = “round/sound9.mp3”;

if ( SERVER ) then
util.AddNetworkString( “_ttt_end_round_music” );

for k, v in pairs( END_OF_ROUND_WIN_INNOCENT_SOUNDS ) do resource.AddFile( "sound/" .. v ); end
for k, v in pairs( END_OF_ROUND_WIN_TRAITOR_SOUNDS ) do resource.AddFile( "sound/" .. v ); end
for k, v in pairs( END_OF_ROUND_WIN_TIMELIMIT_SOUNDS ) do resource.AddFile( "sound/" .. v ); end

local function endofround( wintype )
	// Default sound
	local _sound = END_OF_ROUND_WIN_DEFAULT_SOUND
	
	if wintype == WIN_INNOCENT then
		_sound = table.Random( END_OF_ROUND_WIN_INNOCENT_SOUNDS );
	elseif wintype == WIN_TRAITOR then
		_sound = table.Random( END_OF_ROUND_WIN_TRAITOR_SOUNDS );
	elseif wintype == WIN_TIMELIMIT then
		_sound = table.Random( END_OF_ROUND_WIN_TIMELIMIT_SOUNDS );
	end
	
	net.Start( "_ttt_end_round_music" );
		net.WriteString( _sound );
	net.Broadcast( );
end
hook.Add( "TTTEndRound", "Handymanendofround", endofround )

end

                                                                    Sincerely,TheApexProject
                                                                    Plz Reply :)

Please for the love of god use tags, I dont understand what you are trying to fix?



//
// sv_end_round_music.lua by Josh 'Acecool' Moser
//

//
// Define your music here, end each line with a ,
// You can define 1 to many sounds. It will play 1 of the list randomly, or the single one every time.
//
END_OF_ROUND_WIN_INNOCENT_SOUNDS = {
  "round/sound1.mp3",
  "round/sound2.mp3",
  "round/sound3.mp3",
}
END_OF_ROUND_WIN_TRAITOR_SOUNDS = {
  "round/sound4.mp3",
  "round/sound5.mp3",
  "round/sound6.mp3",
  "round/sound7.mp3",
}
END_OF_ROUND_WIN_TIMELIMIT_SOUNDS = {
  "round/sound8.mp3",
}

// You must define a default sound to play if some of your lists above are empty.
END_OF_ROUND_WIN_DEFAULT_SOUND = "round/sound9.mp3";

if ( SERVER ) then
  util.AddNetworkString( "_ttt_end_round_music" );

  for k, v in pairs( END_OF_ROUND_WIN_INNOCENT_SOUNDS ) do resource.AddFile( "sound/" .. v ); end
  for k, v in pairs( END_OF_ROUND_WIN_TRAITOR_SOUNDS ) do resource.AddFile( "sound/" .. v ); end
  for k, v in pairs( END_OF_ROUND_WIN_TIMELIMIT_SOUNDS ) do resource.AddFile( "sound/" .. v ); end

  local function endofround( wintype )
  // Default sound
  local _sound = END_OF_ROUND_WIN_DEFAULT_SOUND

  if wintype == WIN_INNOCENT then
  _sound = table.Random( END_OF_ROUND_WIN_INNOCENT_SOUNDS );
  elseif wintype == WIN_TRAITOR then
  _sound = table.Random( END_OF_ROUND_WIN_TRAITOR_SOUNDS );
  elseif wintype == WIN_TIMELIMIT then
  _sound = table.Random( END_OF_ROUND_WIN_TIMELIMIT_SOUNDS );
  end

  net.Start( "_ttt_end_round_music" );
  net.WriteString( _sound );
  net.Broadcast( );
end
hook.Add( "TTTEndRound", "Handymanendofround", endofround )
end


Suggestions:
Make sure you have a folder in your root called round, and the sound files in there are named sound1.mp3 etc
Make sure you have this in garrysmod\garrysmod\lua\autorun\server

[lua]//
// sv_end_round_music.lua by Josh ‘Acecool’ Moser
//[/lua]

haha; it gets me everytime.

this isn’t the full script, there’s clientside stuff for it too, so whereever you found this, go back and look for the clientside stuff.

[editline]lalala[/editline]

here, have a script that actually works:

[lua]–
– sh_end_round_music.lua by ‘Handsome’ Matt Stevens Age 17 UK

local winSounds = {
[3] = { – Innocent
“round/sound1.mp3”,
“round/sound2.mp3”,
“round/sound3.mp3”
},
[2] = { – Traitor
“round/sound4.mp3”,
“round/sound5.mp3”,
“round/sound6.mp3”,
“round/sound7.mp3”,
},
[4] = { – Time Limit
“round/sound8.mp3”
}
}

if SERVER then
AddCSLuaFile()
util.AddNetworkString(“TTT_EndRoundMusic”)

for _, a in pairs( winSounds ) do for _, b in pairs(a) do resource.AddFile(“sound/” … b) end end

hook.Add(“TTTEndRound”, “IReallyLikeDisneyFilms”, function(wintype)
local sound = math.random( 1, #winSounds[wintype] )

net.Start("TTT_EndRoundMusic")
  net.WriteUInt(wintype, 2)
  net.WriteUInt(sound, 6)
net.Broadcast()

end)
elseif CLIENT then
net.Receive(“TTT_EndRoundMusic”, function()
local wintype = net.ReadUInt(2)
local sound = net.ReadUInt(6)

surface.PlaySound(winSounds[wintype][sound])

end)
end[/lua]

Ok I’ll Use that then :slight_smile:

[editline]15th January 2014[/editline]

Ok thanks :slight_smile:

I put all the sounds in a folder called round and place it in garrysmod/garrysmod Then I Put the Notepad++ File Into Lua/Autorun/server (My file is called TTT_EndOfRoundMusic) And when the round ends nothing plays :confused: Any help would be appreciated

Are you even fucking listening. That script. Won’t. Work.

Use the one I provided above and put it in lua/autorun/sh_endroundmusic.lua

I’m using your script so calm down bro I will. :confused: Calm down

[editline]15th January 2014[/editline]

It still don’t work :confused:

Here’s my version: https://dl.dropboxusercontent.com/u/26074909/acecool_ttt_end_round.rar

Just change the sound locations to point to where you keep your sounds. The sounds should be in

garrysmod/gamemodes/terrortown/content/sound/round/x.xxx

My code does work; enjoy.

“it don’t work, wahhh” - you really know how to help yourself buddy.

STFU Twat

Dude, you’re the one who’s asking for help and he’s trying to help you.

But I asked then he’s being ignorant I just said It doesn’t work He can just say “Ok I don’t know”. not be a twat about it

Add me on Steam; I’ll help you get mine working.

I don’t wanna be lousy just if he is then I will. Simple as that

[editline]15th January 2014[/editline]

Thank you I will give it a go! :slight_smile: I’m kinda new aswell I’m confused on where to put the Clientside

[editline]15th January 2014[/editline]

Ok :smiley:

New version; it still transfers the song-name but the lists are shared. I’ll change it, eventually, so it just transfers the win-type and the index.

But, just extract to addons; includes base-sounds to make it more clear.

https://dl.dropboxusercontent.com/u/26074909/acecool_ttt_end_round_music.rar

Ok thank your for helping me your epic!!!