Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. local function Bleh()
  2. local buttons = {}
  3.  
  4. local Frame = vgui.Create( "DFrame" )
  5. Frame:SetPos( 5, 5 )
  6. Frame:SetSize( 300, 300 )
  7. Frame:SetTitle( "Admin Stuff" )
  8. Frame:SetVisible( true )
  9. Frame:SetDraggable( false )
  10. Frame:ShowCloseButton( true )
  11. Frame:MakePopup()
  12.  
  13. local Button = vgui.Create( "DButton", Frame )
  14. Button:SetText( "Return Me" )
  15. Button:SetTextColor( Color( 255, 255, 255 ) )
  16. Button:SetPos( 50, 50 )
  17. Button:SetSize( 100, 30 )
  18. Button.Paint = function( self, w, h )
  19. draw.RoundedBox( 0, 0, 0, w, h, Color( 41, 128, 185, 250 ) ) -- Draw a blue button
  20. end
  21.  
  22. Button.DoClick = function()
  23. RunConsoleCommand("ulx", "return")
  24. end
  25.  
  26. table.insert(buttons, Button)
  27.  
  28. local Button2 = vgui.Create( "DButton", Frame )
  29. Button2:SetText( "Enable Godmode" )
  30. Button2:SetTextColor( Color( 255, 255, 255 ) )
  31. Button2:SetPos( 90, 90 )
  32. Button2:SetSize( 100, 30 )
  33. Button2.Paint = function( self, w, h )
  34. draw.RoundedBox( 0, 0, 0, w, h, Color( 41, 128, 185, 250 ) ) -- Draw a blue button
  35. end
  36. Button2.DoClick = function()
  37. RunConsoleCommand("ulx", "god")
  38. end
  39.  
  40. table.insert(buttons, Button2)
  41.  
  42. for k, v in pairs(buttons) do
  43. local click = v.DoClick
  44.  
  45. v.DoClick = function(self)
  46. click()
  47.  
  48. self.Drag = true
  49. end
  50. end
  51.  
  52. Frame.Think = function()
  53. local x, y = input.GetCursorPos()
  54.  
  55. for k, v in pairs(buttons) do
  56. if v.Drag then
  57. v:SetPos(x, y)
  58. end
  59. end
  60. end
  61.  
  62. Frame.OnMousePressed = function(self, key)
  63. if not (key == MOUSE_LEFT) then return end
  64.  
  65. for k, v in pairs(buttons) do
  66. if v.Drag then v.Drag = false end
  67. end
  68. end
  69.  
  70. end
  71. concommand.Add("bleh", Bleh)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement