How would I make a client command, lets say !nomusic, stop the music playing at end of round, and have the server remember peoples setting through map-changes/restarts. I am a bit of a noob when it comes to lua...
[CODE]local music = {
"zapper_ttt/Black_Mountains_new.mp3",
"zapper_ttt/Bullseye_new.mp3",
"zapper_ttt/Come_And_Get_It_new.mp3",
"zapper_ttt/Cosmos_new.mp3",
"zapper_ttt/Declaration_new.mp3",
"zapper_ttt/Dreams_new.mp3",
"zapper_ttt/Get_Out_new.mp3",
"zapper_ttt/Get_Some_new.mp3",
"zapper_ttt/Lucid_new.mp3",
"zapper_ttt/I_Just_Want_To_Run_new.mp3",
}
for k, v in pairs( music ) do
resource.AddFile( "sound/"..v )
end
hook.Add( "TTTEndRound", "End Round Music", function( wtype )
if wtype == WIN_INNOCENT then
local song = table.Random( music )
song = "surface.PlaySound(\""..song.."\")"
BroadcastLua( song )
elseif wtype == WIN_TRAITOR then
local song = table.Random( music )
song = "surface.PlaySound(\""..song.."\")"
BroadcastLua( song )
else
local song = table.Random( music )
song = "surface.PlaySound(\""..song.."\")"
BroadcastLua( song )
end
end )[/CODE]
[editline]28th October 2013[/editline]
Actually, I modified TTT to create a convar tick-box in TTT settings (music_end). How would I make it so that when the client convar "music_end" equals 0, the code to play the music will not run.
You can also bind 'stopsound' to a key. It's a useful tool to have regardless.
Sorry, you need to Log In to post a reply to this thread.