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?
[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
[/CODE]
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
Ok I'll Use that then :)[QUOTE=Handsome Matt;43539478][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
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][/QUOTE]
[editline]15th January 2014[/editline]
Ok thanks :)[QUOTE=AnonTakesOver;43538048]Please for the love of god use tags, I dont understand what you are trying to fix?
[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
[/CODE]
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[/QUOTE]
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 :/ Any help would be appreciated
[QUOTE=AnonTakesOver;43538048]Please for the love of god use tags, I dont understand what you are trying to fix?
[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
[/CODE]
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[/QUOTE]
I'm using your script so calm down bro I will. :/ Calm down
[editline]15th January 2014[/editline]
It still don't work :/
[QUOTE=Handsome Matt;43546407]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[/QUOTE]
Here's my version: [url]https://dl.dropboxusercontent.com/u/26074909/acecool_ttt_end_round.rar[/url]
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.
STFU Twat[QUOTE=Handsome Matt;43547686]"it don't work, wahhh" - you really know how to help yourself buddy.[/QUOTE]
[QUOTE=ApexProject;43547812]STFU Twat[/QUOTE]
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[QUOTE=code_gs;43547855]Dude, you're the one who's asking for help and he's trying to help you.[/QUOTE]
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[QUOTE=ApexProject;43547873]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[/QUOTE]
[editline]15th January 2014[/editline]
Thank you I will give it a go! :) I'm kinda new aswell I'm confused on where to put the Clientside [QUOTE=Acecool;43547634]Here's my version: [url]https://dl.dropboxusercontent.com/u/26074909/acecool_ttt_end_round.rar[/url]
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.[/QUOTE]
[editline]15th January 2014[/editline]
Ok :D[QUOTE=Acecool;43547908]Add me on Steam; I'll help you get mine working.[/QUOTE]
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.
[url]https://dl.dropboxusercontent.com/u/26074909/acecool_ttt_end_round_music.rar[/url]
Ok thank your for helping me your epic!!![QUOTE=Acecool;43549099]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.
[url]https://dl.dropboxusercontent.com/u/26074909/acecool_ttt_end_round_music.rar[/url][/QUOTE]
Sorry, you need to Log In to post a reply to this thread.