Discord
Steam
/
Developers
/
Dbutton not po..
Login/Join
Event Log
Dbutton not popping up in game in DoClick()
2 replies, posted
Search
In This Thread
I tried using KeyPress hook, but in a DoClick() function. the DFrame popped up but not the Dbutton, well just take a look at the code. local SAS = Material( "materials/logosas.png" ) local MASK = Material("materials/logomask.png") local hos = Material ("materials/hos.png") local Frame = vgui.Create( "DFrame" ) Frame:SetTitle( "Choose Side" ) Frame:SetSize( 500, 500 ) Frame:Center() Frame:MakePopup() Frame:ShowCloseButton( false ) Frame:SetDraggable( false ) Frame.Paint = function( self, w, h ) -- 'function Frame:Paint( w, h )' works too draw.RoundedBox( 0, 0, 0, w, h, Color( 0,0,0,0) ) -- Draw a black box instead of the frame end hook.Add("HUDPaint", "select", function() surface.SetMaterial (SAS) surface.SetDrawColor(Color(255, 255, 255, 255)) surface.DrawTexturedRect(780, 455, 80, 140, Color(255, 255, 255, 255)) end) hook.Add("HUDPaint", "select2", function() surface.SetMaterial(MASK) surface.SetDrawColor(Color(41, 128, 185, 255)) surface.DrawTexturedRect(880, 455, 140, 140, Color(41, 128, 185, 255)) end) hook.Add("HUDPaint", "select3", function() surface.SetMaterial(hos) surface.SetDrawColor(Color(41, 128, 185, 255)) surface.DrawTexturedRect(ScrW()-880, 455, 100, 140, Color(41, 128, 185, 255)) end) ----------------------------------------------------------------------------------------------------------- --(SAS) local button_Master = vgui.Create( "DButton", Frame ) local ply = LocalPlayer() button_Master:SetText( "Special Air Service (SAS)" ) button_Master:SetTextColor( Color( 255, 255, 255 ) ) button_Master:SetPos( 50, 100 ) button_Master:SetSize( 120, 30 ) button_Master.Paint = function( self, w, h ) function button_Master:DoClick() local ply = LocalPlayer () ply:EmitSound( "sasprep.wav", 75, 100, 1, CHAN_STATIC ) ply:EmitSound( "prep.wav", 75, 100, 1, CHAN_STATIC ) timer.Create( "entry", 2, 1, function() ply:EmitSound( "entry.wav", 75, 100, 1, CHAN_STATIC ) end ) -- HUD hook.Add("HUDPaint", "HUDPaintIdentifier", function() surface.SetMaterial(SAS) surface.SetDrawColor(Color(255, 255, 255, 255)) surface.DrawTexturedRect(ScrW()-220, ScrH()-285, 200, 260, Color(255, 255, 255, 255)) end) hook.Remove( "HUDPaint", "select" , function() -- Removing SAS pic end ) hook.Remove( "HUDPaint", "select2" , function() --Removing MASK pic end ) hook.Remove( "HUDPaint", "select3" , function() --Removing Hostage pic end ) -- Commanding Hostage Tab hook.Add( "KeyPress", "keypressALT", function( ply, key ) if ( key == IN_WALK ) then print ("This works.") local sas = vgui.Create( "DFrame" ) sas:SetTitle( "Commands" ) sas:SetSize( 500, 500 ) sas:Center() sas:MakePopup() sas:ShowCloseButton( true ) sas:SetDraggable( false ) sas.Paint = function( self, w, h ) -- 'function Frame:Paint( w, h )' works too draw.RoundedBox( 0, 0, 0, w, h, Color( 0,0,0,0) ) -- Draw a black box instead of the frame end local button_sas = vgui.Create( "DButton", Frame ) local ply = LocalPlayer() button_sas:SetText( "VIP Follow Me" ) button_sas:SetTextColor( Color( 255, 255, 255 ) ) button_sas:SetPos( 50, 100 ) button_sas:SetSize( 120, 30 ) button_sas.Paint = function( self, w, h ) end end end)
Alright i will try
Sorry, you need to
Log In
to post a reply to this thread.