• Derma Button Sound
    4 replies, posted
How can I have a sound play when the buttons are clicked on my derma panel. I want only the client to hear them.
[url]http://wiki.garrysmod.com/?title=DButton.DoClick[/url] Along with [url]http://wiki.garrysmod.com/?title=Surface.PlaySound[/url] Need a quick example? Hack it together: [lua] concommand.Add("DermaMusicButton", function() window = vgui.Create( "DFrame" ) window:SetSize( 200,70 ) window:Center() window:SetTitle( "DButton Test" ) window:MakePopup() button = vgui.Create( "DButton", window ) button:SetSize( 100, 30 ) button:SetPos( 50, 30 ) button:SetText( "Play music" ) button.DoClick = function() surface.PlaySound( "/music/hl2_song20_submix0.mp3" ) end end ) [/lua] [i]note it's not exactly good practice to just hack things together from the wiki[/i]
I've tried that any many methods. Can you make me an example that I know works before I try this. Thanks.
The example posted works in my post.
Thank you.
Sorry, you need to Log In to post a reply to this thread.