• End-Round-Music Errors
    2 replies, posted
I would like the players to have the possibility to make the music quietly and completely remove the EndRoundMusic. (F1 Menu) This does not work! cl_end_round_music.lua: [code]net.Receive( "_ttt_end_round_music", function( byte, Player ) local _sound = net.ReadString( ); surface.PlaySound( _sound ); end )[/code] cl_end_round_ttt.lua: [code] hook.Add( "TTTSettingsTabs", "Panel", DermaPanel) local DermaPanel = vgui.Create( 'DFrame' ) DermaPanel:SetSize( 500, 200 ) DermaPanel:Center() DermaPanel:MakePopup() local DermaNumSlider = vgui.Create( "DNumSlider", DermaPanel ) DermaNumSlider:SetPos( 50, 50 ) DermaNumSlider:SetSize( 300, 100 ) DermaNumSlider:SetText( "Maximum props" ) DermaNumSlider:SetMin( 0 ) DermaNumSlider:SetMax( 3 ) DermaNumSlider:SetDecimals( 3 ) CreateClientConVar("ttt_endroundsounds_enable", "1", FCVAR_ARCHIVE) hook.Add("TTTSettingsTabs", "EndRoundSoundsTTTSettingsTab", function(dtabs) local padding = dtabs:GetPadding() padding = padding * 2 local dsettings = vgui.Create("DPanelList", dtabs) dsettings:StretchToParent(0,0,padding,0) dsettings:EnableVerticalScrollbar(true) dsettings:SetPadding(10) dsettings:SetSpacing(10) do local dgui = vgui.Create("DForm", dsettings) dgui:SetName("General settings") local cb = nil dgui:CheckBox("Enable music on round end", "ttt_endroundsounds_enable") dsettings:AddItem(dgui) end [/code] sv_end_round_music.lua: [code]END_OF_ROUND_WIN_INNOCENT_SOUNDS = { "endround/tom.mp3", } END_OF_ROUND_WIN_TRAITOR_SOUNDS = { "endround/michael.mp3", } END_OF_ROUND_WIN_TIMELIMIT_SOUNDS = { "endround/gun.mp3", } 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 ) 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] Thank you very much.
Push
I'm no expert. But I think you need to post what the error is / why this isn't behaving as you intended.
Sorry, you need to Log In to post a reply to this thread.