Advertisement
CREONIX

F4 MENU LEAK | DARKP | VISCAGAMING.COM

Jan 29th, 2017
886
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 76.01 KB | None | 0 0
  1. surface.CreateFont( "SleepyF4", {
  2. font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  3. size = 48,
  4. weight = 500,
  5. blursize = 0,
  6. scanlines = 0,
  7. antialias = true,
  8. underline = false,
  9. italic = false,
  10. strikeout = false,
  11. symbol = false,
  12. rotary = false,
  13. shadow = false,
  14. additive = false,
  15. outline = false,
  16. } )
  17.  
  18. surface.CreateFont( "SleepyF4_ShopItemText", {
  19.     font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  20.     size = 11,
  21.     weight = 500,
  22.     blursize = 0,
  23.     scanlines = 0,
  24.     antialias = true,
  25. } )
  26.  
  27. --- Metamist's Modifications
  28. -- Some modifications to add things like categories.
  29. -- Added with prefix METAMOD_ to prevent possible conflicts
  30.  
  31. local function METAMOD_createCategories(list, addEntriesFunc, prefix)
  32.     table.sort(list, function(a, b)
  33.         return (a.sortOrder or 100) < (b.sortOrder or 100)
  34.     end)
  35.  
  36.     local panels = {}
  37.  
  38.     for k, catData in ipairs(list) do
  39.         if #catData.members == 0 then continue end
  40.  
  41.         local catPnl = vgui.Create("DCollapsibleCategory")
  42.         local label = catData.name
  43.         if prefix ~= nil then
  44.             label = prefix .. " - " .. label
  45.         end
  46.         catPnl:SetLabel(label)
  47.  
  48.         local catList = vgui.Create("DPanelList")
  49.         catList:SetSize(470, 200)
  50.         catList:SetAutoSize(true)
  51.         catList:EnableHorizontal(true)
  52.         catList:SetPadding(5)
  53.         catList:SetSpacing(5)
  54.  
  55.         addEntriesFunc(catData, catList)
  56.  
  57.         if #catList:GetItems() == 0 then
  58.             catPnl:Remove()
  59.             catList:Remove()
  60.             continue
  61.         end
  62.  
  63.         catPnl:SetContents(catList)
  64.  
  65.         panels[#panels + 1] = {
  66.             catPnl = catPnl,
  67.             catList = catList,
  68.             catData = catData
  69.         }
  70.     end
  71.  
  72.     return panels
  73. end
  74.  
  75. local matExclamation = Material("materials/icon16/exclamation.png")
  76.  
  77. local VoteVGUI = {}
  78. local QuestionVGUI = {}
  79. local PanelNum = 0
  80. local LetterWritePanel
  81. VoteQueues = VoteQueues or {}
  82.  
  83. function MsgDoVote(msg)
  84.         local _, chatY = chat.GetChatBoxPos()
  85.  
  86.         local question = msg:ReadString()
  87.         local voteid = msg:ReadString()
  88.         local timeleft = msg:ReadFloat()
  89.         if timeleft == 0 then
  90.                 timeleft = 100
  91.         end
  92.         local OldTime = CurTime()
  93.         if string.find(voteid, LocalPlayer():EntIndex()) then return end --If it's about you then go away
  94.         if not IsValid(LocalPlayer()) then return end -- Sent right before player initialisation
  95.  
  96.         VoteQueues[voteid] = table.Count(VoteQueues) + 1
  97.  
  98.         LocalPlayer():EmitSound("Town.d1_town_02_elevbell1", 100, 100)
  99.         local panel = vgui.Create("DFrame")
  100.         panel:SetPos(3, -50)
  101.         panel:SetTitle("")
  102.         panel:SetSize(220, 70)
  103.         panel:SetSizable(false)
  104.         panel.btnClose:SetVisible(false)
  105.         panel.btnMaxim:SetVisible(false)
  106.         panel.btnMinim:SetVisible(false)
  107.         panel:SetDraggable(false)
  108.         function panel:Close()
  109.                 VoteQueues[voteid] = nil
  110.                 for _, v in pairs (VoteQueues) do
  111.                         VoteQueues[_] = math.max(v - 1, 1)
  112.                 end
  113.  
  114.                 PanelNum = PanelNum - 70
  115.                 VoteVGUI[voteid .. "vote"] = nil
  116.  
  117.                 local num = 0
  118.                 for k,v in SortedPairs(VoteVGUI) do
  119.                         v:SetPos(3, chatY - 145 - num)
  120.                         num = num + 70
  121.                 end
  122.  
  123.                 for k,v in SortedPairs(QuestionVGUI) do
  124.                         v:SetPos(3, chatY - 145 - num)
  125.                         num = num + 300
  126.                 end
  127.                 self:Remove()
  128.         end
  129.         panel.Paint = function(me)
  130.                 local w, h = me:GetSize()
  131.                 draw.RoundedBox(4, 0, 0, w, h, Color(0, 0, 0, 255))
  132.                 draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(60, 60, 60, 255))
  133.  
  134.                 draw.RoundedBox(0, w - 12, 4, 8, h - 8, color_black)
  135.                 draw.RoundedBox(0, w - 11, 5, 6, h - 11, Color(25, 25, 25, 255))
  136.  
  137.                 local frac = (CurTime() - OldTime) / timeleft
  138.                 draw.RoundedBox(0, w - 11, 5 + h * frac, 6, h - h * frac - 10, Color(100, 100, 100, 255))
  139.         end
  140.  
  141.         function panel:Think()
  142.                 if timeleft - (CurTime() - OldTime) <= 0 then
  143.                         return
  144.                         panel:Close()
  145.                 end
  146.  
  147.                 panel.Pos = panel.Pos or -70
  148.                 panel.Pos = Lerp(5 * FrameTime(), panel.Pos, 3 + (VoteQueues[voteid] - 1) * 73)
  149.  
  150.                 panel:SetPos(3, panel.Pos)
  151.         end
  152.  
  153.         panel:SetKeyboardInputEnabled(false)
  154.         panel:SetMouseInputEnabled(true)
  155.         panel:SetVisible(true)
  156.  
  157.         local expl = string.Explode("\n", question)
  158.         local name = expl[1]
  159.  
  160.         local line2 = ""
  161.         for i = 2, #expl do
  162.                 line2 = line2 .. expl[i] .. " "
  163.         end
  164.  
  165.         local label = vgui.Create("DLabel")
  166.         label:SetParent(panel)
  167.         label:SetPos(5, 5)
  168.         label:SetText(name)
  169.         label:SizeToContents()
  170.         label:SetWide(panel:GetWide() - 30)
  171.         -- label:A()
  172.         label:SetVisible(true)
  173.  
  174.         local label1 = vgui.Create("DLabel")
  175.         label1:SetParent(panel)
  176.         label1:SetPos(5, 5)
  177.         label1:MoveBelow(label)
  178.         label1:SetText(line2)
  179.         label1:SizeToContents()
  180.         label1:SetVisible(true)
  181.  
  182.         local nextHeight = label:GetTall() > 78 and label:GetTall() - 78 or 0 // make panel taller for divider and buttons
  183.         panel:SetTall(panel:GetTall() + nextHeight)
  184.  
  185.         local divider = vgui.Create("Divider")
  186.         divider:SetParent(panel)
  187.         divider:SetPos(2, panel:GetTall() - 30)
  188.         divider:SetSize(180, 2)
  189.         divider:SetVisible(true)
  190.  
  191.         local ybutton = vgui.Create("Button")
  192.         ybutton:SetParent(panel)
  193.         ybutton:SetPos(25, panel:GetTall() - 25)
  194.         ybutton:AlignLeft(10)
  195.         ybutton:SetSize(80, 20)
  196.         ybutton:SetCommand("!")
  197.         ybutton:SetText("Yes")
  198.         ybutton:SetVisible(true)
  199.         ybutton.DoClick = function()
  200.                 LocalPlayer():ConCommand("vote " .. voteid .. " 1\n")
  201.                 panel:Close()
  202.         end
  203.         ybutton:SetColor(color_white)
  204.         ybutton:SetFont("DermaDefaultBold")
  205.         ybutton.Paint = function(me)
  206.                 local w, h = me:GetSize()
  207.                 draw.RoundedBox(4, 0, 0, w, h, Color(0, 0, 0, 255))
  208.                 draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(27, 117, 36, 255))
  209.  
  210.                 if (me.Hovered) then
  211.                         draw.RoundedBox(4, 0, 0, w, h, Color(255, 255, 255, 100))
  212.                 end
  213.         end
  214.  
  215.         local nbutton = vgui.Create("Button")
  216.         nbutton:SetParent(panel)
  217.         nbutton:SetPos(70, panel:GetTall() - 25)
  218.         nbutton:SetSize(80, 20)
  219.         nbutton:AlignRight(25)
  220.         nbutton:SetCommand("!")
  221.         nbutton:SetText("No")
  222.         nbutton:SetVisible(true)
  223.         nbutton.DoClick = function()
  224.                 LocalPlayer():ConCommand("vote " .. voteid .. " 2\n")
  225.                 panel:Close()
  226.         end
  227.         nbutton:SetFont("DermaDefaultBold")
  228.         nbutton:SetColor(color_white)
  229.         nbutton.Paint = function(me)
  230.                 local w, h = me:GetSize()
  231.                 draw.RoundedBox(4, 0, 0, w, h, Color(0, 0, 0, 255))
  232.                 draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(175, 0, 0, 255))
  233.  
  234.                 if (me.Hovered) then
  235.                         draw.RoundedBox(4, 0, 0, w, h, Color(255, 255, 255, 100))
  236.                 end
  237.         end
  238.  
  239.         PanelNum = PanelNum + 140
  240.         VoteVGUI[voteid .. "vote"] = panel
  241. end
  242. usermessage.Hook("DoVote", MsgDoVote)
  243.  
  244. local function KillVoteVGUI(msg)
  245.         local id = msg:ReadString()
  246.  
  247.         if VoteVGUI[id .. "vote"] and VoteVGUI[id .. "vote"]:IsValid() then
  248.                 VoteVGUI[id.."vote"]:Close()
  249.  
  250.         end
  251. end
  252. usermessage.Hook("KillVoteVGUI", KillVoteVGUI)
  253.  
  254. local function MsgDoQuestion(msg)
  255.         local _, chatY = chat.GetChatBoxPos()
  256.         local question = msg:ReadString()
  257.         local quesid = msg:ReadString()
  258.         local timeleft = msg:ReadFloat()
  259.         if timeleft == 0 then
  260.                 timeleft = 100
  261.         end
  262.         VoteQueues[quesid] = table.Count(VoteQueues) + 1
  263.  
  264.         local OldTime = CurTime()
  265.  
  266.         LocalPlayer():EmitSound("Town.d1_town_02_elevbell1", 100, 100)
  267.         local panel = vgui.Create("DFrame")
  268.         panel:SetPos(3, -50)
  269.         panel:SetTitle("")
  270.         panel:SetSize(220, 70)
  271.         panel:SetSizable(false)
  272.         panel.btnClose:SetVisible(false)
  273.         panel.btnMaxim:SetVisible(false)
  274.         panel.btnMinim:SetVisible(false)
  275.         panel:SetDraggable(false)
  276.         function panel:Close()
  277.                 VoteQueues[quesid] = nil
  278.                 for _, v in pairs (VoteQueues) do
  279.                         VoteQueues[_] = math.max(v - 1, 1)
  280.                 end
  281.  
  282.                 PanelNum = PanelNum - 70
  283.                 VoteVGUI[quesid .. "vote"] = nil
  284.  
  285.                 local num = 0
  286.                 for k,v in SortedPairs(VoteVGUI) do
  287.                         v:SetPos(3, chatY - 145 - num)
  288.                         num = num + 70
  289.                 end
  290.  
  291.                 for k,v in SortedPairs(QuestionVGUI) do
  292.                         v:SetPos(3, chatY - 145 - num)
  293.                         num = num + 300
  294.                 end
  295.                 self:Remove()
  296.         end
  297.         panel.Paint = function(me)
  298.                 local w, h = me:GetSize()
  299.                 draw.RoundedBox(4, 0, 0, w, h, Color(0, 0, 0, 255))
  300.                 draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(60, 60, 60, 255))
  301.  
  302.                 draw.RoundedBox(0, w - 12, 4, 8, h - 8, color_black)
  303.                 draw.RoundedBox(0, w - 11, 5, 6, h - 11, Color(25, 25, 25, 255))
  304.  
  305.                 local frac = (CurTime() - OldTime) / timeleft
  306.                 draw.RoundedBox(0, w - 11, 5 + h * frac, 6, h - h * frac - 10, Color(100, 100, 100, 255))
  307.         end
  308.  
  309.         function panel:Think()
  310.                 if timeleft - (CurTime() - OldTime) <= 0 then
  311.                         panel:Close()
  312.                         return
  313.                 end
  314.  
  315.                 panel.Pos = panel.Pos or -70
  316.                 panel.Pos = Lerp(5 * FrameTime(), panel.Pos, 3 + (VoteQueues[quesid] - 1) * 73)
  317.  
  318.                 panel:SetPos(3, panel.Pos)
  319.         end
  320.  
  321.         panel:SetKeyboardInputEnabled(false)
  322.         panel:SetMouseInputEnabled(true)
  323.         panel:SetVisible(true)
  324.  
  325.         local expl = string.Explode("\n", question)
  326.         local name = expl[1]
  327.  
  328.         local line2 = ""
  329.         for i = 2, #expl do
  330.                 line2 = line2 .. expl[i] .. " "
  331.         end
  332.  
  333.         local label = vgui.Create("DLabel")
  334.         label:SetParent(panel)
  335.         label:SetPos(5, 5)
  336.         label:SetText(name)
  337.         label:SizeToContents()
  338.         label:SetWide(panel:GetWide() - 30)
  339.         -- label:A()
  340.         label:SetVisible(true)
  341.  
  342.         local label1 = vgui.Create("DLabel")
  343.         label1:SetParent(panel)
  344.         label1:SetPos(5, 5)
  345.         label1:MoveBelow(label)
  346.         label1:SetText(line2)
  347.         label1:SizeToContents()
  348.         label1:SetVisible(true)
  349.  
  350.         local nextHeight = label:GetTall() > 78 and label:GetTall() - 78 or 0 // make panel taller for divider and buttons
  351.         panel:SetTall(panel:GetTall() + nextHeight)
  352.  
  353.         local divider = vgui.Create("Divider")
  354.         divider:SetParent(panel)
  355.         divider:SetPos(2, panel:GetTall() - 30)
  356.         divider:SetSize(180, 2)
  357.         divider:SetVisible(true)
  358.  
  359.         local ybutton = vgui.Create("Button")
  360.         ybutton:SetParent(panel)
  361.         ybutton:SetPos(25, panel:GetTall() - 25)
  362.         ybutton:AlignLeft(10)
  363.         ybutton:SetSize(80, 20)
  364.         ybutton:SetCommand("!")
  365.         ybutton:SetText("Yes")
  366.         ybutton:SetVisible(true)
  367.         ybutton.DoClick = function()
  368.                 LocalPlayer():ConCommand("ans " .. quesid .. " 1\n")
  369.                 panel:Close()
  370.         end
  371.         ybutton:SetColor(color_white)
  372.         ybutton:SetFont("DermaDefaultBold")
  373.         ybutton.Paint = function(me)
  374.                 local w, h = me:GetSize()
  375.                 draw.RoundedBox(4, 0, 0, w, h, Color(0, 0, 0, 255))
  376.                 draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(27, 117, 36, 255))
  377.  
  378.                 if (me.Hovered) then
  379.                         draw.RoundedBox(4, 0, 0, w, h, Color(255, 255, 255, 100))
  380.                 end
  381.         end
  382.  
  383.         local nbutton = vgui.Create("Button")
  384.         nbutton:SetParent(panel)
  385.         nbutton:SetPos(70, panel:GetTall() - 25)
  386.         nbutton:SetSize(80, 20)
  387.         nbutton:AlignRight(25)
  388.         nbutton:SetCommand("!")
  389.         nbutton:SetText("No")
  390.         nbutton:SetVisible(true)
  391.         nbutton.DoClick = function()
  392.                 LocalPlayer():ConCommand("ans " .. quesid .. " 2\n")
  393.                 panel:Close()
  394.         end
  395.         nbutton:SetFont("DermaDefaultBold")
  396.         nbutton:SetColor(color_white)
  397.         nbutton.Paint = function(me)
  398.                 local w, h = me:GetSize()
  399.                 draw.RoundedBox(4, 0, 0, w, h, Color(0, 0, 0, 255))
  400.                 draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(175, 0, 0, 255))
  401.  
  402.                 if (me.Hovered) then
  403.                         draw.RoundedBox(4, 0, 0, w, h, Color(255, 255, 255, 100))
  404.                 end
  405.         end
  406.  
  407.         PanelNum = PanelNum + 140
  408.         VoteVGUI[quesid .. "vote"] = panel
  409. end
  410. usermessage.Hook("DoQuestion", MsgDoQuestion)
  411.  
  412. local function KillQuestionVGUI(msg)
  413.         local id = msg:ReadString()
  414.  
  415.         if QuestionVGUI[id .. "ques"] and QuestionVGUI[id .. "ques"]:IsValid() then
  416.                 QuestionVGUI[id .. "ques"]:Close()
  417.         end
  418. end
  419. usermessage.Hook("KillQuestionVGUI", KillQuestionVGUI)
  420.  
  421. local function DoVoteAnswerQuestion(ply, cmd, args)
  422.         if not args[1] then return end
  423.  
  424.         local vote = 2
  425.         if tonumber(args[1]) == 1 or string.lower(args[1]) == "yes" or string.lower(args[1]) == "true" then vote = 1 end
  426.  
  427.         for k,v in pairs(VoteVGUI) do
  428.                 if ValidPanel(v) then
  429.                         local ID = string.sub(k, 1, -5)
  430.                         VoteVGUI[k]:Close()
  431.                         RunConsoleCommand("vote", ID, vote)
  432.                         return
  433.                 end
  434.         end
  435.  
  436.         for k,v in pairs(QuestionVGUI) do
  437.                 if ValidPanel(v) then
  438.                         local ID = string.sub(k, 1, -5)
  439.                         QuestionVGUI[k]:Close()
  440.                         RunConsoleCommand("ans", ID, vote)
  441.                         return
  442.                 end
  443.         end
  444. end
  445. concommand.Add("rp_vote", DoVoteAnswerQuestion)
  446.  
  447. local function DoLetter(msg)
  448.         LetterWritePanel = vgui.Create("Frame")
  449.         LetterWritePanel:SetPos(ScrW() / 2 - 75, ScrH() / 2 - 100)
  450.         LetterWritePanel:SetSize(150, 200)
  451.         LetterWritePanel:SetMouseInputEnabled(true)
  452.         LetterWritePanel:SetKeyboardInputEnabled(true)
  453.         LetterWritePanel:SetVisible(true)
  454. end
  455. usermessage.Hook("DoLetter", DoLetter)
  456.  
  457. //Modify this
  458. local Colors = {
  459.         //Main menu
  460.         F4MenuBackground = Color(180, 180, 180,125),
  461.         F4MenuBorder = Color(60,60,60,160),
  462.         LogoCardBackground = Color(30,16,36,180),
  463.         LogoCardTop = Color(20,250,60,255),
  464.         LogoCardBottom = Color(20,250,60,255),
  465.         CanvasBackground = Color(26,26,26,220),
  466.         //Actions tab
  467.         ButtonBackground = Color(201,201,201,255),
  468.         ButtonText = Color(120,120,120,255),
  469.         CategoryBackground = Color(80,80,80,255),
  470.         //Jobs tab
  471.         JobOutlineHover = Color(255,255,255),
  472.         JobOutlinePressed = Color(10,10,255),
  473.         //Shop tab
  474.         ShopItemBackground = Color(201,201,201,255),
  475.         ShopDescriptionBackground = Color(0,0,0,200),
  476.         //Shared between tabs
  477.         TabActive = Color(26,26,26,220),
  478.         TabInactive = Color(60,60,60,220),
  479.         TabTitleFront = Color(255,255,255,255),
  480.         TabTitleShadow = Color(0,0,0,255),
  481. }
  482. local Texts = {
  483.         //Menu
  484.         LogoCardTop = 'PedoBear',
  485.         LogoCardBottom = 'Gaming',
  486.         //Tab titles
  487.         ActionsTabTitle = 'Actions',
  488.         JobsTabTitle = 'Jobs',
  489.         ShopTabTitle = 'Shop',
  490.         ForumTabTitle = 'Rules',
  491.         //Some localizations
  492.         DescriptionTitle = 'Description:',
  493.         WeaponsNone = "This job has no weapons.",
  494.         WeaponsSpecial = "Weapons:",
  495.         CurrentTeam = 'Current: ',
  496.         //Some system settings - no modifications needed, really
  497.         TabTitleFont = 'F4TabTitle',
  498.         ButtonFont = 'DermaDefaultBold',
  499.         DarkRPCommand = 'say',
  500. }
  501. local Materials = {
  502.         GradientNormal = Material('gui/gradient'),
  503.         GradientUp = Material('gui/gradient_up'),
  504.         GradientDown = Material('gui/gradient_down'),
  505.         GradientCenter = Material('gui/center_gradient'),
  506.         ActionsButton = Material('icon16/star.png'),
  507.         JobsButton = Material('icon16/user_suit.png'),
  508.         ShopButton = Material('icon16/cart.png'),
  509.         ForumButton = Material('icon16/heart.png'),
  510. }
  511.  
  512. local function METAMOD_paintShopItemBackground(pnl, w, h, data)
  513.     local ofst = 0
  514.     if pnl.Depressed then
  515.         ofst = 2
  516.     end
  517.  
  518.     draw.RoundedBox(4, ofst, ofst, w - ofst * 2, h - ofst * 2, Colors.ShopItemBackground)
  519.     return true
  520. end
  521.  
  522. local function METAMOD_paintShopItemForeground(pnl, w, h, data)
  523.     local ofst = 0
  524.     if pnl.Depressed then
  525.         ofst = 2
  526.     end
  527.  
  528.     draw.RoundedBoxEx(4, ofst, ofst, w - ofst * 2, 20, Color(0, 0, 0, 160), true, true, false, false)
  529.     draw.SimpleText(data.name, "SleepyF4_ShopItemText", w / 2, 10 + ofst, nil, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  530.  
  531.     local price = (data.price == 0) and "Free" or DarkRP.formatMoney(data.price)
  532.  
  533.     draw.RoundedBoxEx(4, ofst, h - 20 - ofst, w - ofst * 2, 20, Color(0, 0, 0, 160), false, false, true, true)
  534.     draw.SimpleText(price, "SleepyF4_ShopItemText", w / 2, h - 10 - ofst, nil, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  535.     return true
  536. end
  537.  
  538. //Command workaround
  539. local function RunCmd(...)
  540.         local arg = {...}
  541.         if Texts.DarkRPCommand:lower():find('say') then
  542.                 arg = table.concat(arg,' ')
  543.         else
  544.                 arg = table.concat(arg,'" "')
  545.         end
  546.         RunConsoleCommand(Texts.DarkRPCommand,arg)
  547. end
  548.  
  549. //This is what creates the layout
  550. local function CreateMenu()
  551.         if F4Menu and IsValid(F4Menu) then
  552.                 F4Menu:Remove()
  553.         end
  554.  
  555.         local LogoCard,Canvas,TopBar
  556.         local ActionsButton,ActionsTab
  557.         local JobsButton,JobsTab
  558.         local ShopButton,ShopTab
  559.         local DonateButton,DonateTab
  560.         --local tex = surface.GetTextureID("j0rpi/f4bg")
  561.         F4Menu = vgui.Create('DFrame')
  562.         F4Menu:SetSize(1200,700)
  563.         F4Menu:Center()
  564.         F4Menu:MakePopup()
  565.         F4Menu:ShowCloseButton(true)
  566.         F4Menu.btnMaxim:SetVisible( false )
  567.         F4Menu.btnMinim:SetVisible( false )
  568.         F4Menu:SetDeleteOnClose(false)
  569.         F4Menu:ParentToHUD()
  570.         F4Menu:SetDraggable(false)
  571.         F4Menu:SetSizable(false)
  572.         F4Menu:SetTitle('')
  573.         F4Menu.Tabs = {}
  574.  
  575.         F4Menu.F4Down = true
  576.  
  577.         local F4Bind
  578.         function F4Menu:Think()
  579.             DFrame.Think(self)
  580.  
  581.             F4Bind = F4Bind or input.KeyNameToNumber(input.LookupBinding("gm_showspare2"))
  582.             if not F4Bind then return end
  583.  
  584.             if self:IsVisible() then
  585.                 if not self.F4Down and input.IsKeyDown(F4Bind) then
  586.                     self:Hide()
  587.                 elseif not input.IsKeyDown(F4Bind) then
  588.                     self.F4Down = false
  589.                 end
  590.             end
  591.         end
  592.  
  593.         function F4Menu:OpenTab(Button)
  594.                 if Button == nil then
  595.                         if self.OpenedTab and self.OpenedTab:IsValid() then
  596.                                 Button = self.OpenedTab
  597.                         else
  598.                                 Button = table.GetFirstKey(self.Tabs)
  599.                         end
  600.                 end
  601.                 if self.Tabs[Button] and IsValid(self.Tabs[Button]) then
  602.                         self.OpenedTab = Button
  603.                         for k,v in pairs(self.Tabs) do
  604.                                 k.Toggled = false
  605.                                 v:SetVisible(false)
  606.                         end
  607.                         self.Tabs[Button]:SetVisible(true)
  608.                         self.Tabs[Button]:Refresh()
  609.                         Button.Toggled = true
  610.                 end
  611.         end
  612.         function F4Menu:Paint(w,h)
  613.                 surface.SetDrawColor(Colors.F4MenuBackground)
  614.                 surface.DrawRect(0,0,w,h)
  615.                 surface.SetDrawColor(Colors.F4MenuBorder)
  616.                 surface.DrawOutlinedRect(0,0,w,h)
  617.                 --surface.SetTexture(tex)
  618.                 --surface.SetDrawColor(255,255,255,255)
  619.                 --surface.DrawTexturedRect(5, 5, 1190, 76)
  620.         end
  621.  
  622.  
  623.  
  624.         LogoCard = vgui.Create('DPanel',F4Menu)
  625.         LogoCard:SetPos(5,5)
  626.         LogoCard:SetSize(500,70)
  627.         function LogoCard:Paint(w,h)
  628.                 --draw.RoundedBox(4,0,0,w,h,Colors.LogoCardBackground)
  629.                 draw.SimpleText("ViscaGaming.com",'SleepyF4',10,15,Color(255, 255, 255, 255))
  630.                 --draw.SimpleText(Texts.LogoCardBottom,'DermaLarge',5,35,Colors.LogoCardBottom)
  631.                 --local smurf2 = Material("materials/darkrp/smurf.png")
  632.                 --surface.SetMaterial(smurf2)
  633.                 --surface.SetDrawColor(200,200,200,255)
  634.                 --surface.DrawTexturedRect(0, 0, 250, 69)
  635.         end
  636.         F4Menu.LogoCard = LogoCard
  637.  
  638.         Canvas = vgui.Create('DPanel',F4Menu)
  639.         Canvas:SetPos(5,LogoCard.y+LogoCard:GetTall()+5)
  640.         Canvas:SetSize(F4Menu:GetWide()-10,F4Menu:GetTall()-(LogoCard.y+LogoCard:GetTall()+10))
  641.         function Canvas:Paint(w,h)
  642.                 draw.RoundedBox(0,0,0,w,h,Colors.CanvasBackground)
  643.         end
  644.         F4Menu.Canvas = Canvas
  645. end
  646.  
  647. //Options stuff
  648. local j0rpibtntxtcolor = Color(255,255,255,255)
  649. local function CreateButton(w,text,icon,doclick)
  650.         text = tostring(text)
  651.         w = tonumber(w) or 2
  652.         icon = icon and Material(icon) or false
  653.         doclick = doclick or function()end
  654.         w = w*185 + (w-1)*5
  655.  
  656.         local button = vgui.Create('DButton')
  657.         button:SetSize(w,45)
  658.         button.Paint = function(self,w,h)
  659.                 draw.RoundedBox(4,0,0,w,h,Color( 15, 15, 15, 255 ))
  660.                 draw.RoundedBox(4,0,-22,w,h,Color( 25, 25, 25, 255 ))
  661.                 if icon then
  662.                         surface.SetDrawColor(Color(200,200,200,255))
  663.                         surface.SetMaterial(icon)
  664.                         surface.DrawTexturedRect(8,h/2-8,16,16)
  665.                         draw.SimpleText(text,Texts.ButtonFont,8+w/2,h/2,j0rpibtntxtcolor,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  666.                 else
  667.                         draw.SimpleText(text,"DermaDefault",w/2,h/2,j0rpibtntxtcolor,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  668.                 end
  669.                 return true
  670.         end
  671.         button.DoClick = doclick
  672.         return button
  673. end
  674. local function GetOptions(type,col)
  675.         type = tostring(type)
  676.         col = col or Color(151,151,151,255)
  677.         local Actions = vgui.Create("DPanelList")
  678.         Actions:SetAutoSize(true)
  679.         Actions:SetPadding(10)
  680.         Actions:SetSpacing(5)
  681.         Actions:EnableHorizontal(true)
  682.         local Category = vgui.Create("DCollapsibleCategory")
  683.         Category:SetLabel(type)
  684.         Category:SetContents(Actions)
  685.         Category.Paint = function(self,w,h)
  686.                 draw.RoundedBox(4,0,0,w,h,Color(80,80,80,100))
  687.                 draw.RoundedBox(4,0,0,w,h,Color(80,80,80,100))
  688.         end
  689.         if type == 'general' then
  690.                 Category:SetLabel('General')
  691.  
  692.                 Actions:AddItem(CreateButton(2,
  693.                         "Drop Money",
  694.                         'icon16/money.png',
  695.                         function()
  696.                                 Derma_StringRequest("Amount of money", "How much money do you want to drop?", "", function(a) RunCmd("/dropmoney", tostring(a)) end)
  697.                         end))
  698.  
  699.                                     Actions:AddItem(CreateButton(2,
  700.                         string.format("Call an admin"),
  701.                         'icon16/shield.png',
  702.                         function()
  703.                                 RunCmd("@Admin to me, quick!")
  704.                                 F4Menu:Close()
  705.                         end))
  706.                 Actions:AddItem(CreateButton(2,
  707.                         "Drop Weapon",
  708.                         'icon16/box.png',
  709.                         function()
  710.                                 RunCmd("/drop")
  711.                         end))
  712.                 Actions:AddItem(CreateButton(2,
  713.                         "Request Gun Licence",
  714.                         'icon16/gun.png',
  715.                         function()
  716.                                 RunCmd("/requestlicense")
  717.                         end))
  718.         elseif type == 'roleplay' then
  719.                 Category:SetLabel('Roleplay actions')
  720.                 Actions:AddItem(CreateButton(1,
  721.                         'Change RP Name',
  722.                         'icon16/vcard_edit.png',
  723.                         function()
  724.                                 Derma_StringRequest("Roleplay name", "What would you like your RP name to be?", LocalPlayer():Name() or "", function(a) RunCmd("/rpname", tostring(a)) end)
  725.                         end))
  726.                 Actions:AddItem(CreateButton(1,
  727.                         'Custom Job Title',
  728.                         'icon16/vcard_edit.png',
  729.                         function()
  730.                                 Derma_StringRequest("Job title", "What do you want to change your job title to?", LocalPlayer().DarkRPVars.job or "", function(a) RunCmd("/job", tostring(a)) end)
  731.                         end))
  732.                 Actions:AddItem(CreateButton(1,
  733.                         'Sell All Doors',
  734.                         'icon16/book_delete.png',
  735.                         function() RunCmd("/unownalldoors") end))
  736.         elseif type == 'police' then
  737.                 col = team.GetColor(TEAM_POLICE)
  738.                 Category:SetLabel('Police')
  739.                 Actions:AddItem(CreateButton(1,
  740.                         "Give Player Gunlicense",
  741.                         'icon16/gun.png',
  742.                         function()
  743.                                 RunCmd("/givelicense")
  744.                         end))
  745.                 Actions:AddItem(CreateButton(1,
  746.                         'Request Warrant',
  747.                         'icon16/script_error.png',
  748.                         function()
  749.                                 local menu = DermaMenu()
  750.                                 for _,ply in pairs(player.GetAll()) do
  751.                                         if ply ~= LocalPlayer() then
  752.                                                 menu:AddOption(ply:Nick(), function()
  753.                                                         Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil,function(a)RunCmd("/warrant", tostring(ply:UserID()).." ".. a)end, function() end )
  754.                                                 end)
  755.                                         end
  756.                                 end
  757.                                 menu:Open()
  758.                         end))
  759.                 Actions:AddItem(CreateButton(1,
  760.                         'Make Wanted',
  761.                         'icon16/group_error.png',
  762.                         function()
  763.                                 local menu = DermaMenu()
  764.                                 for _,ply in pairs(player.GetAll()) do
  765.                                         if ply ~= LocalPlayer() then
  766.                                                 menu:AddOption(ply:Nick(), function()
  767.                                                         Derma_StringRequest("Warrant", "Why would you make "..ply:Nick().." wanted?", nil,function(a)RunCmd("/wanted", tostring(ply:UserID()).." ".. a)end, function() end )
  768.                                                 end)
  769.                                         end
  770.                                 end
  771.                                 menu:Open()
  772.                         end))
  773.                 Actions:AddItem(CreateButton(1,
  774.                         'Remove Wanted',
  775.                         'icon16/group_add.png',
  776.                         function()
  777.                                 local menu = DermaMenu()
  778.                                 for _,ply in pairs(player.GetAll()) do
  779.                                         if ply ~= LocalPlayer() then
  780.                                                 menu:AddOption(ply:Nick(), function()
  781.                                                         RunCmd("/unwanted", tostring(ply:UserID()))
  782.                                                 end)
  783.                                         end
  784.                                 end
  785.                                 menu:Open()
  786.                         end))
  787.         elseif type == 'mayor' then
  788.                 col = team.GetColor(TEAM_MAYOR)
  789.                 Category:SetLabel('Mayor')
  790.                 Actions:AddItem(CreateButton(1,
  791.                         "Give Player Gunlicense",
  792.                         'icon16/gun.png',
  793.                         function()
  794.                                 RunCmd("/givelicense")
  795.                         end))
  796.                 Actions:AddItem(CreateButton(1,
  797.                         'Initiate lockdown',
  798.                         'icon16/bell_add.png',
  799.                         function() RunCmd("/lockdown") end))
  800.                 Actions:AddItem(CreateButton(1,
  801.                         'Stop Lockdown',
  802.                         'icon16/bell_delete.png',
  803.                         function() RunCmd("/unlockdown") end))
  804.                 Actions:AddItem(CreateButton(1,
  805.                         'Initiate Lottery',
  806.                         'icon16/money.png',
  807.                         function() RunCmd("/lottery") end))
  808.                 Actions:AddItem(CreateButton(1,
  809.                         'Place Law Board',
  810.                         'icon16/application.png',
  811.                         function() RunCmd("/placelaws") end))
  812.                 Actions:AddItem(CreateButton(1,
  813.                         'Add Law',
  814.                         'icon16/application_add.png',
  815.                         function()
  816.                                 Derma_StringRequest("Add a law", "Type the law you would like to add here.", "", function(law)
  817.                                         RunCmd("/addlaw ", law)
  818.                                 end)
  819.                         end))
  820.                 Actions:AddItem(CreateButton(1,
  821.                         'Remove Law',
  822.                         'icon16/application_delete.png',
  823.                         function()
  824.                                 Derma_StringRequest("Remove a law", "Enter the number of the law you would like to remove here.", "", function(num)
  825.                                         RunCmd("/removelaw", num)
  826.                                 end)
  827.                                 end))
  828.         elseif type == 'mobboss' then
  829.                 local Team = LocalPlayer():Team()
  830.                 col = Team == TEAM_MOB and team.GetColor(TEAM_MOB) or Team == TEAM_BDL and team.GetColor(TEAM_BDL) or col
  831.                 Category:SetLabel('Mob boss')
  832.                 Actions:AddItem(CreateButton(1,
  833.                         'Set Agenda',
  834.                         'icon16/application_view_detail.png',
  835.                         function()
  836.                                 Derma_StringRequest("Set agenda", "What text would you like to change agenda to?", LocalPlayer().DarkRPVars.agenda or "", function(a)
  837.                                         RunCmd("/agenda", tostring(a))
  838.                                 end)
  839.                         end))
  840.         end
  841.         return Category
  842. end
  843.  
  844. //Stuff related to teams
  845. local function GetDescription(team)
  846.         local Team = RPExtraTeams[team]
  847.         if !Team then return false end
  848.         local description = Texts.DescriptionTitle
  849.         description = description.."\n"..Team.description
  850.         description = description.."\n\n"
  851.         local weps = ""
  852.         if #Team.weapons > 0 then
  853.                 weps = Texts.WeaponsSpecial
  854.                 for k,v in pairs(Team.weapons) do
  855.                         local class = weapons.Get(v)
  856.                         if class then
  857.                                 weps = weps.."\n* "..(class.PrintName or v)
  858.                         end
  859.                 end
  860.         else
  861.                 weps = Texts.WeaponsNone
  862.         end
  863.         description = description..weps
  864.         return description
  865. end
  866. local function GetDisplayTeam(team)
  867.         local Team = RPExtraTeams[team]
  868.         if !Team then return false end
  869.         Team = table.Copy(Team)
  870.         if LocalPlayer():Team() == team then
  871.                 Team.name = Texts.CurrentTeam..Team.name
  872.         end
  873.         Team.desc_full = GetDescription(team)
  874.         if type(Team.model) == "table" then
  875.                 Team.model = table.Random(Team.model)
  876.         end
  877.         return Team
  878. end
  879.  
  880. //Tabs stuff
  881. local function AddActionsTab()
  882.         local ActionList
  883.         local ActionsButton = vgui.Create('DButton',F4Menu)
  884.         ActionsButton:SetPos(786 - 84 -15,F4Menu.Canvas.y-35)
  885.         ActionsButton:SetSize(84,35)
  886.         ActionsButton.Icon = Materials.ActionsButton
  887.         ActionsButton.Text = Texts.ActionsTabTitle
  888.         ActionsButton.DoClick = function(self) F4Menu:OpenTab(self) end
  889.         ActionsButton.Paint = function(self,w,h)
  890.                 local ry,rh
  891.                 if self.Toggled then
  892.                         ry,rh = 0,h
  893.                         draw.RoundedBoxEx(4,0,ry,w,rh,Colors.TabActive,true,true)
  894.                 else
  895.                         ry,rh = 5,h-5
  896.                         draw.RoundedBoxEx(4,0,ry,w,rh,Colors.TabInactive,true,true)
  897.                 end
  898.                 surface.SetDrawColor(Color(255,255,255,255))
  899.                 surface.SetMaterial(self.Icon)
  900.                 surface.DrawTexturedRect(8,ry+rh/2-8,16,16)
  901.                 draw.SimpleText(self.Text,"DermaDefaultBold",32,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER)
  902.                 return true
  903.         end
  904.  
  905.         local ActionsTab = vgui.Create('DPanel',F4Menu.Canvas)
  906.         ActionsTab:SetSize(F4Menu.Canvas:GetSize())
  907.         ActionsTab.Paint = function()end
  908.         ActionsTab.Refresh = function(self)
  909.                 ActionList:Clear()
  910.                 ActionList:AddItem(GetOptions('general'))
  911.                 ActionList:AddItem(GetOptions('roleplay'))
  912.                 local team = LocalPlayer():Team()
  913.                 if team == TEAM_MAYOR  then
  914.                         ActionList:AddItem(GetOptions('mayor'))
  915.                         ActionList:AddItem(GetOptions('police'))
  916.                 elseif table.HasValue({TEAM_SECRETS, TEAM_CHIEF, TEAM_POLICE, TEAM_MAYOR, TEAM_SWAT, TEAM_SPEC, TEAM_CHIEFPLUS, TEAM_SWATPLUS, TEAM_POLICEPLUS, TEAM_FBI, TEAM_ADMIN},LocalPlayer():Team())
  917.  then
  918.                         ActionList:AddItem(GetOptions('police'))
  919.                 elseif team == TEAM_MOB or team == TEAM_BDL then
  920.                         ActionList:AddItem(GetOptions('mobboss'))
  921.                 end
  922.         end
  923.  
  924.         ActionList = vgui.Create('DPanelList',ActionsTab)
  925.         ActionList:SetPos(5,5)
  926.         ActionList:SetSize(ActionsTab:GetWide()-10,ActionsTab:GetTall()-10)
  927.         ActionList:EnableVerticalScrollbar(true)
  928.         ActionList:SetSpacing(5)
  929.  
  930.         F4Menu.Tabs[ActionsButton] = ActionsTab
  931.         F4Menu:OpenTab(ActionsButton)
  932.         return ActionsButton
  933. end
  934. local function AddJobsTab()
  935.         local JobList,JobPreview,JobsTab,JobsButton
  936.         JobsButton = vgui.Create('DButton',F4Menu)
  937.         JobsButton:SetPos(875- 84 - 15,F4Menu.Canvas.y-35)
  938.         JobsButton:SetSize(75,35)
  939.         JobsButton.Icon = Materials.JobsButton
  940.         JobsButton.Text = Texts.JobsTabTitle
  941.         JobsButton.DoClick = function(self) F4Menu:OpenTab(self) end
  942.         JobsButton.Paint = function(self,w,h)
  943.                 local ry,rh
  944.                 if self.Toggled then
  945.                         ry,rh = 0,h
  946.                         draw.RoundedBoxEx(4,0,ry,w,rh,Colors.TabActive,true,true)
  947.                 else
  948.                         ry,rh = 5,h-5
  949.                         draw.RoundedBoxEx(4,0,ry,w,rh,Colors.TabInactive,true,true)
  950.                 end
  951.                 surface.SetDrawColor(Color(255,255,255,255))
  952.                 surface.SetMaterial(self.Icon)
  953.                 surface.DrawTexturedRect(8,ry+rh/2-8,16,16)
  954.                 draw.SimpleText(self.Text,"DermaDefaultBold",32,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER)
  955.                 return true
  956.         end
  957.  
  958.         local PAINT_JOB = function(self,w,h)
  959.                 draw.RoundedBox(4,0,0,w,h,self.m_colText)
  960.                 if self.Hovered then
  961.                         draw.RoundedBox(4,4,4,w-8,h-8,!self.Depressed and Colors.JobOutlineHover or Colors.JobOutlinePressed)
  962.                         draw.RoundedBox(4,6,6,w-12,h-12,self.m_colText)
  963.                 end
  964.                 draw.SimpleText(self:GetText(),"DermaDefaultBold",70,h/2,nil,nil,TEXT_ALIGN_CENTER)
  965.                 return true
  966.         end
  967.         local DOCLICK_JOB = function(self,w,h)
  968.                 local Team = JobPreview.Team
  969.                 if Team.vote then
  970.                         if ((Team.admin == 0 and LocalPlayer():IsAdmin()) or (Team.admin == 1 and LocalPlayer():IsSuperAdmin())) then
  971.                                 local menu = DermaMenu()
  972.                                 menu:AddOption("Vote", function() RunCmd("/vote"..Team.command) F4Menu:Close() end)
  973.                                 menu:AddOption("Do not vote", function() RunCmd("/"..Team.command) F4Menu:Close() end)
  974.                                 menu:Open()
  975.                         else
  976.                                 RunCmd("/vote" .. Team.command)
  977.                                 F4Menu:Close()
  978.                         end
  979.                 else
  980.                         RunCmd("/" .. Team.command)
  981.                         F4Menu:Close()
  982.                 end
  983.         end
  984.         JobsTab = vgui.Create('DPanel',F4Menu.Canvas)
  985.         JobsTab:SetSize(F4Menu.Canvas:GetSize())
  986.         JobsTab.Paint = function()end
  987.         JobsTab.Refresh = function(self)
  988.                 local ply = LocalPlayer()
  989.                 local pt = ply:Team()
  990.                 local width = (JobList:GetWide()-32)/2
  991.                 JobList:Clear()
  992.                 JobPreview.Team = GetDisplayTeam(LocalPlayer():Team())
  993.                 JobPreview:Refresh()
  994.  
  995.                 local panels = METAMOD_createCategories(DarkRP.getCategories().jobs, function(data, list)
  996.                     for k, v in ipairs(data.members) do
  997.                         local allowed = true
  998.                         local allowedMsg = "You are not allowed to join this job"
  999.                         local show = true
  1000.                         if pt == v.team then
  1001.                                 show = false
  1002.                         elseif v.admin == 1 and not ply:IsAdmin() then
  1003.                                 show = false
  1004.                         end
  1005.                         if v.admin > 1 and not ply:IsSuperAdmin() then
  1006.                                 show = false
  1007.                         end
  1008.                         if v.customCheck and not v.customCheck(ply) then
  1009.                             allowed = false
  1010.                             if v.CustomCheckFailMsg then allowedMsg = v.CustomCheckFailMsg end
  1011.                         end
  1012.                         if (type(v.NeedToChangeFrom) == "number" and pt ~= v.NeedToChangeFrom) or (type(v.NeedToChangeFrom) == "table" and not table.HasValue(v.NeedToChangeFrom, pt)) then
  1013.                                 show = false
  1014.                         end
  1015.  
  1016.                         if show then
  1017.                                 local model = v.model
  1018.                                 if type(model) == "table" then
  1019.                                     model = table.Random(model)
  1020.                                 end
  1021.  
  1022.                                 local button = vgui.Create('DButton')
  1023.                                 button:SetSize(width,66)
  1024.                                 button:SetColor(team.GetColor(v.team))
  1025.                                 button:SetText(v.name)
  1026.                                 button.Paint = PAINT_JOB
  1027.                                 button.DoClick = function(pnl)
  1028.                                     if not allowed then
  1029.                                         local pnl = Derma_Query(allowedMsg, "Warning", "Ok")
  1030.                                         pnl.Paint = function(pnl, w, h)
  1031.                                             if pnl.m_bBackgroundBlur then
  1032.                                                 Derma_DrawBackgroundBlur(pnl, pnl.m_fCreateTime)
  1033.                                             end
  1034.  
  1035.                                             surface.SetDrawColor(Colors.F4MenuBackground)
  1036.                                             surface.DrawRect(0,0,w,h)
  1037.                                             surface.SetDrawColor(Colors.F4MenuBorder)
  1038.                                             surface.DrawOutlinedRect(0,0,w,h)
  1039.                                         end
  1040.                                         return
  1041.                                     end
  1042.                                     DOCLICK_JOB(pnl)
  1043.                                 end
  1044.                                 button.OnCursorEntered = function(self)
  1045.                                         JobPreview.Team = GetDisplayTeam(self.Team)
  1046.                                         JobPreview:Refresh()
  1047.                                 end
  1048.  
  1049.  
  1050.                                 local matBlurScreen = Material("pp/blurscreen")
  1051.  
  1052.                                 button:SetTooltip(allowed and "Press to join job" or allowedMsg)
  1053.                                 button.PaintOver = function(pnl, w, h)
  1054.                                     if allowed then return end
  1055.  
  1056.  
  1057.  
  1058.                                     local x, y = pnl:LocalToScreen(0, 0)
  1059.                                     surface.SetMaterial(matBlurScreen)
  1060.                                     surface.SetDrawColor(255, 255, 255, 255)
  1061.  
  1062.                                     matBlurScreen:SetFloat("$blur", 1)
  1063.                                     matBlurScreen:Recompute()
  1064.                                     if render then render.UpdateScreenEffectTexture() end -- Todo: Make this available to menu Lua
  1065.                                     surface.DrawTexturedRect(x * -1, y * -1, ScrW(), ScrH())
  1066.  
  1067.                                     surface.SetDrawColor(10, 10, 10, 100)
  1068.                                     surface.DrawRect(x * -1, y * -1, ScrW(), ScrH())
  1069.  
  1070.  
  1071.  
  1072.  
  1073.                                     //draw.RoundedBoxEx(4, w - 20, 0, 20, h, Color(255, 0, 0, 255), false, true, false, true)
  1074.                                     local size = 16
  1075.                                     local off = (h - size) / 2
  1076.                                     surface.SetMaterial(matExclamation)
  1077.                                     surface.SetDrawColor(255, 255, 255)
  1078.                                     surface.DrawTexturedRect(w - off - size, off, size, size)
  1079.                                 end
  1080.  
  1081.                                 local icon = vgui.Create('SpawnIcon',button)
  1082.                                 icon:SetSize(64,64)
  1083.                                 icon:SetPos(1,1)
  1084.                                 icon:SetModel(model)
  1085.                                 icon:SetMouseInputEnabled(false)
  1086.                                 icon.PaintOver = function()end
  1087.                                 icon.DoClick = function()end
  1088.  
  1089.                                 button.Team = v.team
  1090.  
  1091.                                 list:AddItem(button)
  1092.                         end
  1093.                     end
  1094.                 end)
  1095.  
  1096.                 for k, v in ipairs(panels) do
  1097.                     v.catPnl.Paint = function(self, w, h)
  1098.                         draw.RoundedBox(4, 0, 0, w, 20, v.catData.color)
  1099.                         surface.SetDrawColor(v.catData.color)
  1100.                         surface.DrawRect(0, 4, 4, h - 4)
  1101.                         surface.DrawRect(w - 4, 4, 4, h - 4)
  1102.                         surface.DrawRect(0, h - 4, w, 4)
  1103.                     end
  1104.                     v.catList:EnableHorizontal(true)
  1105.                     v.catList:SetSpacing(10)
  1106.  
  1107.                     v.catPnl:SetExpanded(v.catData.startExpanded or true)
  1108.  
  1109.                     JobList:AddItem(v.catPnl)
  1110.                 end
  1111.         end
  1112.  
  1113.         JobList = vgui.Create('DPanelList',JobsTab)
  1114.         JobList:SetPos(5,5)
  1115.         JobList:SetSize((JobsTab:GetWide()-15)*.6,JobsTab:GetTall()-10)
  1116.         JobList:EnableVerticalScrollbar(true)
  1117.         JobList:SetSpacing(10)
  1118.  
  1119.         JobPreview = vgui.Create('DPanelList',JobsTab)
  1120.         JobPreview:SetPos(10+JobList:GetWide(),5)
  1121.         JobPreview:SetSize((JobsTab:GetWide()-15)*.4,JobsTab:GetTall()-10)
  1122.         JobPreview.Paint = function(self,w,h)
  1123.                 draw.RoundedBox(4,0,0,w,h,Color(120,120,120,45))
  1124.                 if self.Team then
  1125.                         draw.RoundedBox(4,0,0,w,50,self.Team.color)
  1126.                         draw.SimpleText(self.Team.name,"DermaDefaultBold",w/2,20,nil,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  1127.                         draw.RoundedBox(4,0,40,w,h-40,Color(220,220,220))
  1128.                 end
  1129.         end
  1130.         JobPreview.Refresh = function(self)
  1131.                 local enabled = tobool(self.Team)
  1132.                 self.Description:SetVisible(enabled)
  1133.                 if enabled then
  1134.                         self.Description:SetText(self.Team.desc_full)
  1135.                 end
  1136.         end
  1137.  
  1138.         JobPreview.Description = vgui.Create('DTextEntry',JobPreview)
  1139.         JobPreview.Description:SetPos(5,45)
  1140.         JobPreview.Description:SetSize(JobPreview:GetWide()-10,JobPreview:GetTall()-50)
  1141.         JobPreview.Description:SetMultiline(true)
  1142.         JobPreview.Description:SetEditable(false)
  1143.         JobPreview.Description:SetDrawBackground(false)
  1144.  
  1145.         F4Menu.Tabs[JobsButton] = JobsTab
  1146.         return JobsButton
  1147. end
  1148. local function AddShopTab()
  1149.         local ItemList
  1150.         local ShopButton = vgui.Create('DButton',F4Menu)
  1151.         ShopButton:SetPos(955- 84 - 15,F4Menu.Canvas.y-35)
  1152.         ShopButton:SetSize(75,35)
  1153.         ShopButton.Icon = Materials.ShopButton
  1154.         ShopButton.Text = Texts.ShopTabTitle
  1155.         ShopButton.DoClick = function(self) F4Menu:OpenTab(self) end
  1156.         ShopButton.Paint = function(self,w,h)
  1157.                 local ry,rh
  1158.                 if self.Toggled then
  1159.                         ry,rh = 0,h
  1160.                         draw.RoundedBoxEx(4,0,ry,w,rh,Colors.TabActive,true,true)
  1161.                 else
  1162.                         ry,rh = 5,h-5
  1163.                         draw.RoundedBoxEx(4,0,ry,w,rh,Colors.TabInactive,true,true)
  1164.                 end
  1165.                 surface.SetDrawColor(Color(255,255,255,255))
  1166.                 surface.SetMaterial(self.Icon)
  1167.                 surface.DrawTexturedRect(8,ry+rh/2-8,16,16)
  1168.                 draw.SimpleText(self.Text,"DermaDefaultBold",32,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER)
  1169.                 return true
  1170.         end
  1171.  
  1172.         local ShopTab = vgui.Create('DPanel',F4Menu.Canvas)
  1173.         ShopTab:SetSize(F4Menu.Canvas:GetSize())
  1174.         ShopTab.Paint = function()end
  1175.         ShopTab.Refresh = function()
  1176.                 ItemList:Clear()
  1177.                 if #CustomShipments > 0 then
  1178.                     local panels = METAMOD_createCategories(DarkRP.getCategories().weapons, function(data, list)
  1179.                         for k, v in pairs(data.members) do
  1180.                             if (v.seperate and (not GAMEMODE.Config.restrictbuypistol or
  1181.                                     (GAMEMODE.Config.restrictbuypistol and (not v.allowed[1] or table.HasValue(v.allowed, LocalPlayer():Team())))))
  1182.                                     and (not v.customCheck or v.customCheck and v.customCheck(LocalPlayer())) then
  1183.                                 local description = v.name..': '.. GAMEMODE.Config.currency .. (v.pricesep or "")
  1184.                                 local command = "/buy "..v.name
  1185.  
  1186.                                 local button = vgui.Create("DButton")
  1187.                                 button:SetSize(80,80)
  1188.                                 button.Paint = function(self, w, h)
  1189.                                     return METAMOD_paintShopItemBackground(self, w, h, v)
  1190.                                 end
  1191.                                 button.PaintOver = function(self, w, h)
  1192.                                     return METAMOD_paintShopItemForeground(self, w, h, v)
  1193.                                 end
  1194.                                 --button.PaintOver = function(self,w,h)
  1195.                                  --       if self.Hovered then
  1196.                                  --               draw.RoundedBoxEx(4,0,h-20,w,20,Colors.ShopDescriptionBackground,false,false,true,true)
  1197.                                   --              draw.SimpleText(description,'DefaultSmall',w/2,h-10,nil,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  1198.                                  --       end
  1199.                                 --end
  1200.                                 button.DoClick = function() RunCmd(command) end
  1201.                                 button:SetToolTip(description)
  1202.                                 local icon = vgui.Create("SpawnIcon",button)
  1203.                                 icon:InvalidateLayout( true )
  1204.                                 icon:SetModel(v.model)
  1205.                                 icon:SetSize(64, 64)
  1206.                                 icon:SetPos(8,8)
  1207.                                 icon:SetMouseInputEnabled(false)
  1208.                                 list:AddItem(button)
  1209.                             end
  1210.                         end
  1211.                     end)
  1212.  
  1213.                     for k, v in ipairs(panels) do
  1214.                         v.catPnl.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,v.catData.color) end
  1215.                         v.catPnl:SetExpanded(v.catData.startExpanded or true)
  1216.  
  1217.                         ItemList:AddItem(v.catPnl)
  1218.                     end
  1219.                 end
  1220.  
  1221.                 if #DarkRPEntities > 0 then
  1222.                         /*
  1223.                         if FoodItems and (GAMEMODE.Config.foodspawn or LocalPlayer():Team() == TEAM_COOK) and (GAMEMODE.Config.hungermod or LocalPlayer():Team() == TEAM_COOK) then
  1224.                                 for k,v in pairs(FoodItems) do
  1225.                                         AddEntIcon(v.model, k .. ": " .. GAMEMODE.Config.currency .. "15", "/buyfood "..k)
  1226.                                         shown = shown + 1
  1227.                                 end
  1228.                         end
  1229.                         */
  1230.  
  1231.  
  1232.                         local shipmentPanels = METAMOD_createCategories(DarkRP.getCategories().shipments, function(data, list)
  1233.                             for k, v in pairs(data.members) do
  1234.                                 if not v.allowed or (type(v.allowed) == "table" and table.HasValue(v.allowed, LocalPlayer():Team()))
  1235.                                         and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
  1236.                                     local description = string.format(LANGUAGE.buy_a, "a "..v.name .." shipment", GAMEMODE.Config.currency .. tostring(v.price))
  1237.                                     local command = "/buyshipment "..v.name
  1238.  
  1239.                                     local button = vgui.Create("DButton")
  1240.                                     button:SetSize(80,80)
  1241.                                     button.Paint = function(self, w, h)
  1242.                                         return METAMOD_paintShopItemBackground(self, w, h, v)
  1243.                                     end
  1244.                                     button.PaintOver = function(self, w, h)
  1245.                                         return METAMOD_paintShopItemForeground(self, w, h, v)
  1246.                                     end
  1247.                                     button.DoClick = function() RunCmd(command) end
  1248.                                     button:SetToolTip(description)
  1249.                                     local icon = vgui.Create("SpawnIcon",button)
  1250.                                     icon:InvalidateLayout( true )
  1251.                                     icon:SetModel(v.model)
  1252.                                     icon:SetSize(64, 64)
  1253.                                     icon:SetPos(8,8)
  1254.                                     icon:SetMouseInputEnabled(false)
  1255.                                     list:AddItem(button)
  1256.                                 end
  1257.                             end
  1258.                         end, "Shipments")
  1259.  
  1260.                         for k, v in ipairs(shipmentPanels) do
  1261.                             v.catPnl.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,v.catData.color) end
  1262.                             v.catPnl:SetExpanded(v.catData.startExpanded or true)
  1263.  
  1264.                             ItemList:AddItem(v.catPnl)
  1265.                         end
  1266.  
  1267.                         local entityPanels = METAMOD_createCategories(DarkRP.getCategories().entities, function(data, list)
  1268.                             for k, v in pairs(data.members) do
  1269.                                 if not v.allowed or (type(v.allowed) == "table" and table.HasValue(v.allowed, LocalPlayer():Team()))
  1270.                                         and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
  1271.                                     local description = v.name ..": " .. GAMEMODE.Config.currency .. v.price
  1272.                                     local command = "/" .. v.cmd
  1273.  
  1274.                                     local button
  1275.                                     if v.attach and v.material then
  1276.                                         button = vgui.Create("DImageButton")
  1277.                                         button:SetImage("vgui/entities/" .. v.material)
  1278.                                     else
  1279.                                         button = vgui.Create("DButton")
  1280.  
  1281.                                         local icon = vgui.Create("SpawnIcon",button)
  1282.                                         icon:InvalidateLayout( true )
  1283.                                         icon:SetModel(v.model)
  1284.                                         icon:SetSize(64, 64)
  1285.                                         icon:SetPos(8,8)
  1286.                                         icon:SetMouseInputEnabled(false)
  1287.                                     end
  1288.                                     button.DoClick = function() RunCmd(command) end
  1289.                                     button:SetToolTip(description)
  1290.                                     button:SetSize(80, 80)
  1291.  
  1292.                                     button.Paint = function(self, w, h)
  1293.                                         return METAMOD_paintShopItemBackground(self, w, h, v)
  1294.                                     end
  1295.                                     button.PaintOver = function(self, w, h)
  1296.                                         return METAMOD_paintShopItemForeground(self, w, h, v)
  1297.                                     end
  1298.  
  1299.                                     list:AddItem(button)
  1300.                                 end
  1301.                             end
  1302.                         end)
  1303.  
  1304.                         for k, v in ipairs(entityPanels) do
  1305.                             v.catPnl.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,v.catData.color) end
  1306.                             v.catPnl:SetExpanded(v.catData.startExpanded or true)
  1307.  
  1308.                             ItemList:AddItem(v.catPnl)
  1309.                         end
  1310.                 end
  1311.                 if #GAMEMODE.AmmoTypes > 0 then
  1312.                         local AmmoCat = vgui.Create("DCollapsibleCategory")
  1313.                         AmmoCat.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Colors.CategoryBackground) end
  1314.                         AmmoCat:SetLabel("Ammo")
  1315.                                 local AmmoPanel = vgui.Create("DPanelList")
  1316.                                 AmmoPanel:SetSize(470, 200)
  1317.                                 AmmoPanel:SetAutoSize(true)
  1318.                                 AmmoPanel:EnableHorizontal(true)
  1319.                                 AmmoPanel:SetPadding(5)
  1320.                                 AmmoPanel:SetSpacing(5)
  1321.                                 local function AddAmmoIcon(Model, description, command)
  1322.                                         local button = vgui.Create("DButton")
  1323.                                         button:SetSize(80,80)
  1324.                                         button.Paint = function(self,w,h)
  1325.                                                 draw.RoundedBox(4,0,0,w,h,Colors.ButtonBackground)
  1326.                                                 return true
  1327.                                         end
  1328.  
  1329.                                         button.DoClick = function() RunConsoleCommand("DarkRP", "buyammo", command) end
  1330.                                         button:SetToolTip(description)
  1331.                                         local icon = vgui.Create("SpawnIcon",button)
  1332.                                         icon:InvalidateLayout( true )
  1333.                                         icon:SetModel(Model)
  1334.                                         icon:SetSize(64, 64)
  1335.                                         icon:SetPos(8,8)
  1336.                                         icon:SetMouseInputEnabled(false)
  1337.                                         AmmoPanel:AddItem(button)
  1338.                                 end
  1339.  
  1340.                                 local shown = 0
  1341.                                 for k,v in pairs(GAMEMODE.AmmoTypes) do
  1342.                                         if not v.allowed or (type(v.allowed) == "table" and table.HasValue(v.allowed, LocalPlayer():Team()))
  1343.                                                 and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
  1344.  
  1345.                                                 AddAmmoIcon(v.model, v.name ..": " .. GAMEMODE.Config.currency .. v.price, v.ammoType)
  1346.                                                 shown = shown + 1
  1347.                                         end
  1348.                                 end
  1349.                         if shown > 0 then
  1350.                                 AmmoCat:SetContents(AmmoPanel)
  1351.                                 ItemList:AddItem(AmmoCat)
  1352.                         else
  1353.                                 AmmoPanel:Remove()
  1354.                                 AmmoCat:Remove()
  1355.                         end
  1356.                 end
  1357.                 if #CustomVehicles > 0 then
  1358.                         local VehCat = vgui.Create("DCollapsibleCategory")
  1359.                         VehCat.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Colors.CategoryBackground) end
  1360.                         VehCat:SetLabel("Vehicles")
  1361.                                 local VehPanel = vgui.Create("DPanelList")
  1362.                                 VehPanel:SetSize(470, 200)
  1363.                                 VehPanel:SetAutoSize(true)
  1364.                                 VehPanel:EnableHorizontal(true)
  1365.                                 VehPanel:SetPadding(5)
  1366.                                 VehPanel:SetSpacing(5)
  1367.                                 local function AddVehIcon(Model, skin, description, command)
  1368.                                         local button = vgui.Create("DButton")
  1369.                                         button:SetSize(80,80)
  1370.                                         button.Paint = function(self,w,h)
  1371.                                                 draw.RoundedBox(4,0,0,w,h,Colors.ButtonBackground)
  1372.                                                 return true
  1373.                                         end
  1374.                                         button.PaintOver = function(self,w,h)
  1375.                                                 if self.Hovered then
  1376.                                                         draw.RoundedBoxEx(4,0,h-20,w,20,Color(0,0,0,200),false,false,true,true)
  1377.                                                         draw.SimpleText(description,'DefaultSmall',w/2,h-10,nil,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  1378.                                                 end
  1379.                                         end
  1380.                                         button.DoClick = function() RunCmd(command) end
  1381.                                         button:SetToolTip(description)
  1382.                                         local icon = vgui.Create("SpawnIcon",button)
  1383.                                         icon:InvalidateLayout( true )
  1384.                                         icon:SetModel(Model)
  1385.                                         icon:SetSize(64, 64)
  1386.                                         icon:SetPos(8,8)
  1387.                                         icon:SetMouseInputEnabled(false)
  1388.                                         VehPanel:AddItem(button)
  1389.                                 end
  1390.  
  1391.                                 local shown = 0
  1392.                                 for k,v in pairs(CustomVehicles) do
  1393.                                         if (not v.allowed or table.HasValue(v.allowed, LocalPlayer():Team())) and (not v.customCheck or v.customCheck(LocalPlayer())) then
  1394.                                                 local Skin = (list.Get("Vehicles")[v.name] and list.Get("Vehicles")[v.name].KeyValues and list.Get("Vehicles")[v.name].KeyValues.Skin) or "0"
  1395.                                                 AddVehIcon(v.model or "models/buggy.mdl", Skin, "Buy a "..v.name.." for "..GAMEMODE.Config.currency..v.price, "/buyvehicle "..v.name)
  1396.                                                 shown = shown + 1
  1397.                                         end
  1398.                                 end
  1399.                         if shown > 0 then
  1400.                                 VehCat:SetContents(VehPanel)
  1401.                                 ItemList:AddItem(VehCat)
  1402.                         else
  1403.                                 VehPanel:Remove()
  1404.                                 VehCat:Remove()
  1405.                         end
  1406.                         ItemList:AddItem(VehCat)
  1407.                 end
  1408.         end
  1409.  
  1410.         ItemList = vgui.Create('DPanelList',ShopTab)
  1411.         ItemList:SetPos(5,5)
  1412.         ItemList:SetSize(ShopTab:GetWide()-10,ShopTab:GetTall()-10)
  1413.         ItemList:EnableVerticalScrollbar(true)
  1414.         ItemList:SetSpacing(5)
  1415.  
  1416.         F4Menu.Tabs[ShopButton] = ShopTab
  1417.         return ShopButton
  1418. end
  1419. local function AddForumTab()
  1420.         local ForumButton = vgui.Create('DButton',F4Menu)
  1421.         ForumButton:SetPos(1035,F4Menu.Canvas.y-35)
  1422.         ForumButton:SetSize(75,35)
  1423.         ForumButton.Icon = Material('icon16/application_view_list.png')
  1424.         ForumButton.Text = Texts.ForumTabTitle
  1425.         ForumButton.DoClick = function(self) F4Menu:OpenTab(self) end
  1426.         ForumButton.Paint = function(self,w,h)
  1427.                 local ry,rh
  1428.                 if self.Toggled then
  1429.                         ry,rh = 0,h
  1430.                         draw.RoundedBoxEx(4,0,ry,w,rh,Color(26,26,26,220),true,true)
  1431.                 else
  1432.                         ry,rh = 5,h-5
  1433.                         draw.RoundedBoxEx(4,0,ry,w,rh,Color(60,60,60,220),true,true)
  1434.                 end
  1435.                 surface.SetDrawColor(Color(255,255,255,255))
  1436.                 surface.SetMaterial(self.Icon)
  1437.                 surface.DrawTexturedRect(8,ry+rh/2-8,16,16)
  1438.                 draw.SimpleText(self.Text,"DermaDefaultBold",32,ry+rh/2,Color(255,255,255,255),nil,TEXT_ALIGN_CENTER)
  1439.                 return true
  1440.         end
  1441.  
  1442.         local ForumTab = vgui.Create('DPanel',F4Menu.Canvas)
  1443.         ForumTab:SetSize(F4Menu.Canvas:GetSize())
  1444.         ForumTab.Paint = function()end
  1445.         ForumTab.Refresh = function()end
  1446.  
  1447.         local HTML = vgui.Create('HTML',ForumTab)
  1448.         HTML:SetPos(0,0)
  1449.         HTML:SetSize(ForumTab:GetWide(),ForumTab:GetTall())
  1450.         HTML:OpenURL('http://viscagaming.com/drprules.php')
  1451.  
  1452.  
  1453.         F4Menu.Tabs[ForumButton] = ForumTab
  1454.         return  ForumButton
  1455. end
  1456.  
  1457. local function AddCommunityTab()
  1458.         local CommunityButton = vgui.Create('DButton',F4Menu)
  1459.         CommunityButton:SetPos(1030- 95,F4Menu.Canvas.y-35)
  1460.         CommunityButton:SetSize(95,35)
  1461.         CommunityButton.Icon = Material('icon16/note_add.png')
  1462.         CommunityButton.Text = "Changelog"
  1463.         CommunityButton.DoClick = function(self) F4Menu:OpenTab(self) end
  1464.         CommunityButton.Paint = function(self,w,h)
  1465.                 local ry,rh
  1466.                 if self.Toggled then
  1467.                         ry,rh = 0,h
  1468.                         draw.RoundedBoxEx(4,0,ry,w,rh,Color(26,26,26,220),true,true)
  1469.                 else
  1470.                         ry,rh = 5,h-5
  1471.                         draw.RoundedBoxEx(4,0,ry,w,rh,Color(60,60,60,220),true,true)
  1472.                 end
  1473.                 surface.SetDrawColor(Color(255,255,255,255))
  1474.                 surface.SetMaterial(self.Icon)
  1475.                 surface.DrawTexturedRect(8,ry+rh/2-8,16,16)
  1476.                 draw.SimpleText("Changelog","DermaDefaultBold",32,ry+rh/2,Color(255,255,255,255),nil,TEXT_ALIGN_CENTER)
  1477.                 return true
  1478.         end
  1479.  
  1480.         local CommunityTab = vgui.Create('DPanel',F4Menu.Canvas)
  1481.         CommunityTab:SetSize(F4Menu.Canvas:GetSize())
  1482.         CommunityTab.Paint = function()end
  1483.         CommunityTab.Refresh = function()end
  1484.  
  1485.         local HTML = vgui.Create('HTML',CommunityTab)
  1486.         HTML:SetPos(0,0)
  1487.         HTML:SetSize(CommunityTab:GetWide(),CommunityTab:GetTall())
  1488.         HTML:OpenURL('http://viscagaming.com/forumdisplay.php?fid=31')
  1489.  
  1490.  
  1491.         F4Menu.Tabs[CommunityButton] = CommunityTab
  1492.         return  CommunityButton
  1493. end
  1494.  
  1495. local function AddDonateTab()
  1496.         local DonateButton = vgui.Create('DButton',F4Menu)
  1497.         DonateButton:SetPos(1115,F4Menu.Canvas.y-35)
  1498.         DonateButton:SetSize(80,35)
  1499.         DonateButton.Icon = Material('icon16/heart.png')
  1500.         DonateButton.Text = "Donate"
  1501.         DonateButton.DoClick = function(self) F4Menu:OpenTab(self) end
  1502.         DonateButton.Paint = function(self,w,h)
  1503.                 local ry,rh
  1504.                 if self.Toggled then
  1505.                         ry,rh = 0,h
  1506.                         draw.RoundedBoxEx(4,0,ry,w,rh,Color(26,26,26,220),true,true)
  1507.                 else
  1508.                         ry,rh = 5,h-5
  1509.                         draw.RoundedBoxEx(4,0,ry,w,rh,Color(60,60,60,220),true,true)
  1510.                 end
  1511.                 surface.SetDrawColor(Color(255,255,255,255))
  1512.                 surface.SetMaterial(self.Icon)
  1513.                 surface.DrawTexturedRect(8,ry+rh/2-8,16,16)
  1514.                 draw.SimpleText(self.Text,"DermaDefaultBold",32,ry+rh/2,Color(255,255,255,255),nil,TEXT_ALIGN_CENTER)
  1515.                 return true
  1516.         end
  1517.  
  1518.         local DonateTab = vgui.Create('DPanel',F4Menu.Canvas)
  1519.         DonateTab:SetSize(F4Menu.Canvas:GetSize())
  1520.         DonateTab.Paint = function()end
  1521.         DonateTab.Refresh = function()end
  1522.  
  1523.         local TheButton = vgui.Create('DButton',DonateTab)
  1524.         TheButton:SetPos(DonateTab:GetWide() / 2 - 160,DonateTab:GetTall() / 2 - 40)
  1525.         TheButton:SetSize(350, 60)
  1526.         TheButton:SetText("")
  1527.         TheButton.Paint = function()
  1528.          draw.RoundedBox( 4, 0, 0, 350, 60, Color( 15, 15, 15, 255 ) )
  1529.          draw.RoundedBox( 2, 0, -22, 350, 50, Color( 25, 25, 25, 255 ) )
  1530.          draw.SimpleText("Click HERE To Open Donation Page In Steam Overlay!", "DermaDefaultBold", 170, 27, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1531.          end
  1532.         TheButton.DoClick = function() gui.OpenURL("http://viscagaming.com/donate/") end
  1533.         F4Menu.Tabs[DonateButton] = DonateTab
  1534.         return  DonateButton
  1535. end
  1536.  
  1537.  
  1538.  
  1539. //A small trebuchet20 fix
  1540. surface.CreateFont(Texts.TabTitleFont, {
  1541.         font = "Tahoma",
  1542.         size = 16,
  1543.         weight = 900
  1544. })
  1545. local function ChangeJobVGUI()
  1546.         if F4Menu and F4Menu:IsValid() then
  1547.             F4Menu:Remove()
  1548.         end
  1549.  
  1550.         if F4Menu and F4Menu:IsValid() then
  1551.                 F4Menu:SetVisible(true)
  1552.                 F4Menu:OpenTab()
  1553.                 return
  1554.         end
  1555.         CreateMenu()
  1556.         AddJobsTab()
  1557.         AddShopTab()
  1558.         AddForumTab()
  1559.         AddDonateTab()
  1560.         AddCommunityTab()
  1561.         AddActionsTab()
  1562. end
  1563.  
  1564.  
  1565. local _CreateButton = CreateButton
  1566. local function CreateButton(...)
  1567.         local p = _CreateButton(...)
  1568.         p:SetTextColor(Color(255,255,255))
  1569.         p:SetTextStyleColor(Color(85,85,85,255))
  1570.         return p
  1571. end
  1572. local function CreateButtonDialog()
  1573.         local dialog = vgui.Create('DPanelList')
  1574.         dialog:SetSize(195,25)
  1575.         dialog:SetPadding(5)
  1576.         dialog:SetSpacing(5)
  1577.         dialog:EnableHorizontal(true)
  1578.         dialog:SetAutoSize(true)
  1579.         dialog:MakePopup()
  1580.         dialog:ParentToHUD()
  1581.         dialog.PerformLayout = function(self,...)
  1582.                 DPanelList.PerformLayout(self,...)
  1583.                 self:Center()
  1584.         end
  1585.         dialog.Paint = function(self,w,h)
  1586.                 draw.RoundedBox(4,0,0,w,h,Color(50,50,50,255))
  1587.         end
  1588.         dialog:AddItem(CreateButton(1,'Close','icon16/delete.png',function()dialog:Remove()end))
  1589.         return dialog
  1590. end
  1591. local dialog
  1592. local function KeysMenu(um)
  1593.         if dialog and dialog:IsValid() then return end
  1594.         local trace = LocalPlayer():GetEyeTraceNoCursor()
  1595.         if !trace or !trace.Entity or !trace.Entity:IsValid() then return end
  1596.         --local Vehicle = um:ReadBool()
  1597.         dialog = CreateButtonDialog()
  1598.  
  1599.         local DisplayType = Vehicle and "vehicle" or "door"
  1600.  
  1601.         local _RunCmd = RunCmd
  1602.         local function RunCmd(...)
  1603.                 _RunCmd(...)
  1604.                 if ValidPanel(dialog) then
  1605.                         dialog:Remove()
  1606.                 end
  1607.         end
  1608.         local function EditDoorGroup()
  1609.                 local menu = DermaMenu()
  1610.                 local groups = menu:AddSubMenu("Door Groups")
  1611.                 local teams = menu:AddSubMenu("Jobs")
  1612.                 local add = teams:AddSubMenu("Add")
  1613.                 local remove = teams:AddSubMenu("Remove")
  1614.  
  1615.                 menu:AddOption("None", function() RunCmd("/togglegroupownable") end)
  1616.                 for k,v in pairs(RPExtraTeamDoors) do
  1617.                         groups:AddOption(k, function() RunCmd("/togglegroupownable",k) end)
  1618.                 end
  1619.  
  1620.                 if not trace.Entity.DoorData then return end
  1621.  
  1622.                 for k,v in pairs(RPExtraTeams) do
  1623.                         if not trace.Entity.DoorData.TeamOwn or not trace.Entity.DoorData.TeamOwn[k] then
  1624.                                 add:AddOption( v.name, function() RunCmd("/toggleteamownable",k) end )
  1625.                         else
  1626.                                 remove:AddOption( v.name, function() RunCmd("/toggleteamownable",k) end )
  1627.                         end
  1628.                 end
  1629.  
  1630.                 menu:Open()
  1631.         end
  1632.         local function EditDoorTitle()
  1633.                 Derma_StringRequest("Set door title", "Set the title of the "..DisplayType.." you're looking at", "", function(text)
  1634.                         RunCmd("/title",text)
  1635.                 end, function() end, "Ok", "Cancel")
  1636.         end
  1637.  
  1638.         if trace.Entity:isKeysOwnedBy(LocalPlayer()) then
  1639.                 if trace.Entity:isMasterOwner(LocalPlayer()) then
  1640.                         dialog:AddItem(CreateButton(1,'Sell '..DisplayType,'icon16/money_add.png',function()RunCmd("/toggleown")end))
  1641.                         dialog:AddItem(CreateButton(1,'Add owner','icon16/user_add.png',function()
  1642.                                 local menu = DermaMenu()
  1643.                                 menu.found = false
  1644.                                 for k,v in pairs(player.GetAll()) do
  1645.                                         if not trace.Entity:isKeysOwnedBy(v) and not trace.Entity:isKeysAllowedToOwn(v) then
  1646.                                                 menu.found = true
  1647.                                                 menu:AddOption(v:Nick(), function() RunCmd("/ao ", v:UserID()) end)
  1648.                                         end
  1649.                                 end
  1650.                                 if not menu.found then
  1651.                                         menu:AddOption("Noone available", function() end)
  1652.                                 end
  1653.                                 menu:Open() end))
  1654.                         dialog:AddItem(CreateButton(1,'Remove owner','icon16/user_delete.png',function()
  1655.                         local menu = DermaMenu()
  1656.                         for k,v in pairs(player.GetAll()) do
  1657.                                 if (trace.Entity:isKeysOwnedBy(v) and not trace.Entity:isMasterOwner(v)) or trace.Entity:isKeysAllowedToOwn(v) then
  1658.                                         menu.found = true
  1659.                                         menu:AddOption(v:Nick(), function() RunCmd("/ro",v:UserID()) end)
  1660.                                 end
  1661.                         end
  1662.                         if not menu.found then
  1663.                                 menu:AddOption("Noone available", function() end)
  1664.                         end
  1665.                         menu:Open() end))
  1666.                 else
  1667.                         dialog:AddItem(CreateButton(1,'Unown '..DisplayType,'icon16/money_add.png',function()RunCmd("/toggleown")end))
  1668.                 end
  1669.                 dialog:AddItem(CreateButton(1,'Set '..DisplayType..' title','icon16/note_edit.png',EditDoorTitle))
  1670.                 if LocalPlayer():IsSuperAdmin() or LocalPlayer():IsAdmin() and not Vehicle then
  1671.                         dialog:AddItem(CreateButton(1,'Edit '..DisplayType..' group','icon16/group_edit.png',EditDoorGroup))
  1672.                 end
  1673.         elseif not trace.Entity:isKeysOwned(LocalPlayer()) and trace.Entity:isKeysOwnable() and not trace.Entity:isKeysOwned() and not trace.Entity.DoorData.NonOwnable then
  1674.                 if LocalPlayer():IsSuperAdmin() or LocalPlayer():IsAdmin() then
  1675.                         if not trace.Entity.DoorData.GroupOwn then
  1676.                                 dialog:AddItem(CreateButton(1,'Purchase '..DisplayType,'icon16/money_delete.png',function()RunCmd("/toggleown")end))
  1677.                         end
  1678.                         dialog:AddItem(CreateButton(1,'Disable ownership','icon16/cancel.png',function()RunCmd("/toggleownable")end))
  1679.                         dialog:AddItem(CreateButton(1,'Edit '..DisplayType..' group','icon16/group_edit.png',EditDoorGroup))
  1680.                 elseif not trace.Entity.DoorData.GroupOwn then
  1681.                         RunCmd("/toggleown")
  1682.                 else
  1683.                         dialog:Remove()
  1684.                 end
  1685.         elseif not trace.Entity:OwnedBy(LocalPlayer()) and trace.Entity:AllowedToOwn(LocalPlayer()) then
  1686.                 if LocalPlayer():IsSuperAdmin() or LocalPlayer():IsAdmin() then
  1687.                         dialog:AddItem(CreateButton(1,'Co-own '..DisplayType,'icon16/money_delete.png',function()RunCmd("/toggleown")end))
  1688.                         dialog:AddItem(CreateButton(1,'Edit '..DisplayType..' group','icon16/group_edit.png',EditDoorGroup))
  1689.                 elseif not trace.Entity.DoorData.GroupOwn then
  1690.                         RunCmd("/toggleown")
  1691.                         dialog:Remove()
  1692.                 end
  1693.         elseif LocalPlayer():IsSuperAdmin() or LocalPlayer():IsAdmin() and trace.Entity.DoorData.NonOwnable then
  1694.                 dialog:AddItem(CreateButton(1,'Enable ownership','icon16/accept.png',function() RunCmd("/toggleownable") end))
  1695.                 dialog:AddItem(CreateButton(1,'Set '..DisplayType..' title','icon16/note_edit.png',EditDoorTitle))
  1696.         elseif LocalPlayer():IsSuperAdmin() and not trace.Entity:OwnedBy(LocalPlayer()) and trace.Entity:IsOwned() and not trace.Entity:AllowedToOwn(LocalPlayer()) then
  1697.                 dialog:AddItem(CreateButton(1,'Disable ownership','icon16/cancel.png',function() RunCmd("/toggleownable") end))
  1698.                 dialog:AddItem(CreateButton(1,'Set '..DisplayType..' title','icon16/note_edit.png',EditDoorTitle))
  1699.                 dialog:AddItem(CreateButton(1,'Edit '..DisplayType..' group','icon16/group_edit.png',EditDoorGroup))
  1700.         else
  1701.                 dialog:Remove()
  1702.         end
  1703. end
  1704. --GM.ShowTeam = KeysMenu
  1705. --GAMEMODE.ShowSpare2 = ChangeJobVGUI
  1706. --GAMEMODE.ShowSpare2X = ChangeJobVGUI
  1707. hook.Add("ShowSpare2", "F4_ChangeJobVGUI", ChangeJobVGUI)
  1708. --hook.Add("ShowTeam", "j0rpiKeysMenu", KeysMenu)
  1709. usermessage.Hook("ChangeJobVGUI", ChangeJobVGUI)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement