• Enable/Disable Button
    0 replies, posted
Trying to create a client sided gui for testing and practice. I need a little help with the button, I want to make it a disable / enable button but i'm not sure how to. I don't know if you need to see my code, most of it's just from the gwiki, but hopefully someone can help me :D thanks:P [lua] local me = LocalPlayer() local Frame = vgui.Create( "DFrame" ) Frame:SetTitle( "Moo Hack -- Wiggle" ) Frame:SetSize( 300, 300 ) Frame:Center() Frame:MakePopup() Frame.Paint = function( self, w, h ) -- 'function Frame:Paint( w, h )' works too draw.RoundedBox( 0, 0, 0, w, h, Color( 128, 128, 128, 100 ) ) -- Draw a red box instead of the frame end local Button = vgui.Create( "DButton", Frame ) Button:SetText( "Enable BHOP!" ) Button:SetTextColor( Color( 255, 255, 255 ) ) Button:SetPos( 25, 250 ) Button:SetSize( 100, 30 ) Button.Paint = function( self, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 238, 0, 130, 250 ) ) -- Draw a blue button end Button.DoClick = function() if me:IsOnGround() and input.IsKeyDown( KEY_SPACE ) then RunConsoleCommand("+jump") else RunConsoleCommand("-jump") end end [/lua]
Sorry, you need to Log In to post a reply to this thread.