SHARE
TWEET

Untitled

a guest May 19th, 2017 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- LOL I COPY CODE FROM OVERV
  2.  
  3. -- Fuck a duck
  4. -- Derma User Creating... kode? - DUCK
  5. -- I can't be arsed making up a cool abbreviation. Oh well. Rambo wins with AIDS.
  6.  
  7.  
  8. dermax = {}
  9.  
  10. dermax.objs = {} -- This is for the possible objects we can create.
  11. dermax.currentobjs = {} -- This is for the objects we have created. So as I can access them.
  12.  
  13. -- This is a useless wrapper function which just makes things quicker for me. Because I'm a lazy shite.
  14.  
  15. function dermax.objectregister(tbl)
  16.     table.insert(dermax.objs , tbl)
  17. end
  18.  
  19. local OBJECT = {
  20.  
  21. Name = "DFrame",
  22. CodeName = "UntitledDFrame",
  23. DefX = 300,
  24. DefY = 400,
  25. DefTitle = "#Untitled DFrame",
  26. DefaultCode = [[
  27. local UntitledDFrame = vgui.Create("DFrame")
  28. UntitledDFrame:SetSize(300 , 400)
  29. UntitledDFrame:SetTitle("#UntitledDFrame")
  30. UntitledDFrame:MakePopup()
  31. ]]
  32.  
  33. }
  34.  
  35. dermax.objectregister(OBJECT)
  36.  
  37.  
  38. -- Now we've finished creating the cool tables containing the VGUI info. Let's use it now.
  39.  
  40. function dermax.getobject(name)
  41.     for k , v in ipairs(dermax.objs) do
  42.         if v.Name == name then
  43.             return v
  44.         end
  45.     end
  46. end
  47.  
  48. function dermax.createobject(name)
  49.     local object = dermax.getobject(name)
  50.     if object then
  51.         local panel = vgui.Create(object.Name)
  52.         panel:SetSize(object.DefX , object.DefY)
  53.         panel:SetPos(20 , 140)
  54.         if panel.SetTitle then
  55.             panel:SetTitle(object.DefTitle)
  56.         end
  57.         if panel.DoClick then
  58.             panel.DoClick = function()
  59.                 dermax.currentobject = panel
  60.             end
  61.         end
  62.        
  63.         table.insert(dermax.currentobjs , panel)
  64.         PrintTable(object)
  65.     end
  66. end
  67.  
  68. dermax.createobject("DFrame")
  69.  
  70.  
  71. -- Right, so we've created the objects. Now we need a sexual menu to be able to edit them. I'd like to do it all visually, but I can't be arsed.
  72.  
  73. function dermax.createmenu()
  74.     if dermax.menu then
  75.         dermax.menu:SetVisible(not (dermax.menu:IsVisible()))
  76.     else
  77.         dermax.menu = vgui.Create("DFrame")
  78.         dermax.menu:SetPos(20 , 15)
  79.         dermax.menu:SetSize(ScrW() - 25 , 120)
  80.         dermax.menu:SetDraggable(false)
  81.         dermax.menu:MakePopup()
  82.  
  83.     end
  84. end
  85.  
  86. -- We need to be able to use this shit.
  87. concommand.Add("dermax_menu" , dermax.createmenu)
RAW Paste Data
Pastebin PRO Summer Special!
Get 60% OFF on Pastebin PRO accounts!
Top