Guest User

Untitled

a guest
Dec 6th, 2016
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 238.01 KB | None | 0 0
  1.  
  2. -----------------------------------------------------
  3. local zm = {}
  4.  
  5.  
  6.  
  7. -- General configuration
  8.  
  9. zm.key = KEY_F4
  10.  
  11. zm.logo = Material("zarp/zarplogo.png","noclamp smooth")
  12.  
  13. zm.font_cat = "Bebas24Font"
  14.  
  15.  
  16.  
  17. -- Main frame metrics
  18.  
  19. zm.w = 900
  20.  
  21. zm.h = 600 + 30
  22.  
  23. zm.logo_h = 60 + 40
  24.  
  25. zm.frame_size = 20
  26.  
  27.  
  28.  
  29. zm.content_padding = 5
  30.  
  31. zm.content_w = zm.w - 10
  32.  
  33. zm.content_h = zm.h - zm.logo_h - 10
  34.  
  35.  
  36.  
  37. -- Colors
  38.  
  39. zm.color_frame = Color( 51,51,51,200 )
  40.  
  41. zm.color_frame_outline = Color( 51,51,51,200 )
  42.  
  43. zm.color_bg = Color( 30, 30, 30, 250 )
  44.  
  45. zm.color_logo_bg = Color( 30, 30, 30, 200 )
  46.  
  47. zm.color_cat_text = Color( 200, 200, 200, 255 )
  48.  
  49. zm.color_cat_text_hover = Color( 255, 255, 255, 255 )
  50.  
  51. zm.color_cat = Color( 55, 100, 5,200 )
  52.  
  53. zm.color_cat_active = zm.color_bg
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. -- Category button metrics
  62.  
  63. zm.cat_offset = 240
  64.  
  65. zm.cat_padding = 18
  66.  
  67. zm.cat_w = 140
  68.  
  69. zm.cat_h = 45
  70.  
  71.  
  72.  
  73. zm.open = false
  74.  
  75. zm.ctl = {}
  76.  
  77. zm.tabs = false
  78.  
  79.  
  80.  
  81. --[[
  82.  
  83.  
  84.  
  85. DRAW (BACKGROUND)
  86.  
  87.  
  88.  
  89. --]]
  90.  
  91. function zm.Draw()
  92.  
  93. if not zm.IsOpen() then return end
  94.  
  95.  
  96.  
  97. local sw, sh = ScrW(), ScrH()
  98.  
  99.  
  100.  
  101. local x = sw / 2 - zm.w / 2
  102.  
  103. local y = sh / 2 - zm.h / 2
  104.  
  105.  
  106.  
  107. draw.RoundedBox( 4, sw / 2 - (zm.w + zm.frame_size) / 2, sh / 2 - (zm.h + zm.frame_size) / 2, zm.w + zm.frame_size, zm.h + zm.frame_size, zm.color_frame )
  108.  
  109.  
  110.  
  111. surface.SetDrawColor( zm.color_frame_outline )
  112.  
  113. surface.DrawOutlinedRect( sw / 2 - (zm.w + zm.frame_size) / 2, sh / 2 - (zm.h + zm.frame_size) / 2, zm.w + zm.frame_size, zm.h + zm.frame_size )
  114.  
  115.  
  116.  
  117. --draw.RoundedBox( 10, x, y + zm.logo_h, zm.w, zm.h - zm.logo_h, zm.color_bg )
  118.  
  119.  
  120.  
  121. --draw.RoundedBox( 4, x + 12, y - 45, 25, 100, Color( 200, 255, 200, 255 ) )
  122.  
  123.  
  124.  
  125. surface.SetDrawColor( 255, 255, 255, 255 )
  126.  
  127. surface.SetMaterial( zm.logo )
  128.  
  129. surface.DrawTexturedRect( x + 6, y+10, 250, 79 )
  130.  
  131. end
  132.  
  133. hook.Add( "HUDPaint", "DrawZARPMenu", zm.Draw )
  134.  
  135.  
  136.  
  137. --[[
  138.  
  139.  
  140.  
  141. OPEN / CLOSE
  142.  
  143.  
  144.  
  145. --]]
  146.  
  147. function zm.Open(tab)
  148.  
  149. if LocalPlayer():IsInEvent() then return end
  150.  
  151. ZARP.SetNewItemLogSuppressed(false)
  152.  
  153. if ZFrame and IsValid(ZFrame) then ZFrame.Close() end
  154.  
  155. zm.open = true
  156.  
  157. gui.EnableScreenClicker( true )
  158.  
  159. local sw, sh = ScrW(), ScrH()
  160.  
  161. local x = sw / 2 - zm.w / 2
  162.  
  163. local y = sh / 2 - zm.h / 2
  164.  
  165.  
  166.  
  167. if not zm.mposx then zm.mposx, zm.mposy = gui.MousePos() end
  168.  
  169. --gui.SetMousePos( zm.mposx, zm.mposy )
  170.  
  171.  
  172.  
  173. local cx = x + zm.cat_offset
  174.  
  175. local cy = y
  176.  
  177.  
  178.  
  179. zm.ctl.bgpanel = zm.ctl.bgpanel or vgui.Create( "DPanel" )
  180.  
  181. zm.ctl.bgpanel:SetPos( x, y + zm.logo_h)
  182.  
  183. zm.ctl.bgpanel:SetSize( zm.w, zm.h - zm.logo_h )
  184.  
  185. zm.ctl.bgpanel:SetVisible( true )
  186.  
  187. function zm.ctl.bgpanel:Paint()
  188.  
  189. draw.RoundedBox( 10, 0, 0, zm.w, zm.h - zm.logo_h, zm.color_bg )
  190.  
  191. end
  192.  
  193.  
  194.  
  195.  
  196.  
  197. -- Make category tabs
  198.  
  199. for i = 1, #zm.categories do
  200.  
  201. zm.ctl[ "cat_btn_" .. i ] = zm.ctl[ "cat_btn_" .. i ] or vgui.Create( "DButton", self )
  202.  
  203.  
  204.  
  205. local cat = zm.categories[ i ]
  206.  
  207. local btn = zm.ctl[ "cat_btn_" .. i ]
  208.  
  209.  
  210.  
  211. btn:SetText( cat.title )
  212.  
  213. DLabel.SetFont( btn, zm.font_cat )
  214.  
  215. if zm.active == btn then
  216.  
  217. btn:SetSize( zm.cat_w, zm.cat_h )
  218.  
  219.  
  220.  
  221. if i > 4 then
  222.  
  223. btn:SetPos( btn.cx + 34 - zm.cat_w * 2 - 176 * 2, btn.cy + 15 + 40 - zm.cat_h - 5)
  224.  
  225. else
  226.  
  227. btn:SetPos( btn.cx + 34, btn.cy + 15 + 40 )
  228.  
  229. end
  230.  
  231.  
  232.  
  233. btn:SetTextColor( zm.color_cat_text_hover )
  234.  
  235. else
  236.  
  237. btn:SetSize( zm.cat_w, zm.cat_h - 5 )
  238.  
  239.  
  240.  
  241. if i > 4 then
  242.  
  243. btn:SetPos( cx + 34 - zm.cat_w * 2 - 176 * 2, cy + 20 + 40 - zm.cat_h - 5)
  244.  
  245. else
  246.  
  247. btn:SetPos( cx + 34, cy + 20 + 40 )
  248.  
  249. end
  250.  
  251.  
  252.  
  253. btn:SetTextColor( zm.color_cat_text )
  254.  
  255. end
  256.  
  257. btn:SetVisible( true )
  258.  
  259. btn:SetImage( cat.icon )
  260.  
  261. DLabel.SetExpensiveShadow( btn, 2, Color( 0,0,0,255 ) )
  262.  
  263.  
  264.  
  265. btn.cat = i
  266.  
  267. btn.cx = cx
  268.  
  269. btn.cy = cy
  270.  
  271.  
  272.  
  273. function btn:Paint()
  274.  
  275. local w, h = btn:GetWide(), btn:GetTall()
  276.  
  277.  
  278.  
  279. local col
  280.  
  281.  
  282.  
  283. if zm.active == btn then
  284.  
  285. col = zm.color_cat_active
  286.  
  287. else
  288.  
  289. col = zm.color_cat
  290.  
  291. end
  292.  
  293.  
  294.  
  295. if i > 4 then
  296.  
  297. draw.RoundedBox( 6, 0, 0, w, h, col)
  298.  
  299. else
  300.  
  301. draw.RoundedBoxEx( 6, 0, 0, w, h, col, true, true, false, false )
  302.  
  303. end
  304.  
  305.  
  306.  
  307. end
  308.  
  309.  
  310.  
  311. if cat.inventory then
  312.  
  313. function btn:PaintOver(w,h)
  314.  
  315. if ZARP.GetNumberNewItemsInLog() >= 1 then
  316.  
  317. surface.SetFont("Bebas24Font")
  318.  
  319. local str = string.format("%i NEW",ZARP.GetNumberNewItemsInLog())
  320.  
  321. local tw,th = surface.GetTextSize(str)
  322.  
  323. draw.WordBox( 6, w - (tw + 14), 2, str, "Bebas24Font", Color(255,51,51), color_white )
  324.  
  325. end
  326.  
  327. end
  328.  
  329. end
  330.  
  331.  
  332.  
  333. function btn:DoClick()
  334.  
  335. if zm.hiddentab then zm.hiddentab:Remove() end
  336.  
  337. if zm.categories[ self.cat ].specialfunc then
  338.  
  339. zm.categories[ self.cat ].specialfunc()
  340.  
  341. return
  342.  
  343. end
  344.  
  345.  
  346.  
  347. if zm.active then
  348.  
  349. zm.active:MakeInactive()
  350.  
  351. end
  352.  
  353. zm.active = btn
  354.  
  355. btn:SetTall( zm.cat_h )
  356.  
  357.  
  358.  
  359. if i > 4 then
  360.  
  361. btn:SetPos( btn.cx + 34 - zm.cat_w * 2 - 176 * 2, btn.cy + 15 + 40 - zm.cat_h - 5)
  362.  
  363. else
  364.  
  365. btn:SetPos( btn.cx + 34, btn.cy + 15 + 40 )
  366.  
  367. end
  368.  
  369.  
  370.  
  371. if zm.tabs and isfunction(zm.tabs[ zm.active.cat ]) then
  372.  
  373. zm.tabs[ zm.active.cat ] = zm.tabs[ zm.active.cat ]()
  374.  
  375. zm.tabs[ zm.active.cat ]:SetPos( x + 5, y + zm.logo_h + 5 )
  376.  
  377. zm.tabs[ zm.active.cat ]:SetSize( zm.content_w, zm.content_h )
  378.  
  379. elseif zm.tabs then
  380.  
  381. zm.tabs[ zm.active.cat ]:SetVisible(true)
  382.  
  383. end
  384.  
  385. end
  386.  
  387.  
  388.  
  389. function btn:MakeInactive()
  390.  
  391. btn:SetTextColor( zm.color_cat_text )
  392.  
  393. btn:SetTall( zm.cat_h - 5 )
  394.  
  395.  
  396.  
  397. if i > 4 then
  398.  
  399. btn:SetPos( btn.cx + 34 - zm.cat_w * 2 - 176 * 2, btn.cy + 20 + 40 - zm.cat_h - 5)
  400.  
  401. else
  402.  
  403. btn:SetPos( btn.cx + 34, btn.cy + 20 + 40 )
  404.  
  405. end
  406.  
  407.  
  408.  
  409. if zm.tabs then
  410.  
  411. if ispanel(zm.tabs[ zm.active.cat ]) then zm.tabs[ zm.active.cat ]:SetVisible( false ) end
  412.  
  413. end
  414.  
  415. end
  416.  
  417.  
  418.  
  419. function btn:OnCursorEntered()
  420.  
  421. btn:SetTextColor( zm.color_cat_text_hover )
  422.  
  423. end
  424.  
  425.  
  426.  
  427. function btn:OnCursorExited()
  428.  
  429. if zm.active ~= btn then
  430.  
  431. btn:SetTextColor( zm.color_cat_text )
  432.  
  433. end
  434.  
  435. end
  436.  
  437.  
  438.  
  439. function btn:PerformLayout()
  440.  
  441. if ( IsValid( self.m_Image ) ) then
  442.  
  443.  
  444.  
  445. self.m_Image:SetPos( 15, (self:GetTall() - self.m_Image:GetTall()) * 0.5 )
  446.  
  447.  
  448.  
  449. self:SetTextInset( -10, 0 )
  450.  
  451. end
  452.  
  453. DLabel.PerformLayout( self )
  454.  
  455. end
  456.  
  457.  
  458.  
  459. cx = cx + zm.cat_w + zm.cat_padding
  460.  
  461. if not zm.active and i == 1 then btn:DoClick()
  462.  
  463. elseif tab and i == tab then btn:DoClick() end
  464.  
  465. end
  466.  
  467.  
  468.  
  469. -- Fill category tabs
  470.  
  471. if not zm.tabs then
  472.  
  473. zm.tabs = {}
  474.  
  475. for k, v in pairs( zm.categories ) do
  476.  
  477. if v.func then
  478.  
  479. zm.tabs[ k ] = v.func
  480.  
  481. //zm.tabs[ k ]:SetVisible( false )
  482.  
  483. //zm.tabs[ k ]:SetPos( x + 5, y + zm.logo_h + 5 )
  484.  
  485. //zm.tabs[ k ]:SetSize( zm.content_w, zm.content_h )
  486.  
  487. end
  488.  
  489. end
  490.  
  491. else
  492.  
  493. for k, v in pairs( zm.tabs ) do
  494.  
  495. if ispanel(v) and v.Update then v:Update() end
  496.  
  497. end
  498.  
  499. end
  500.  
  501.  
  502.  
  503. if zm.active and zm.active.cat then
  504.  
  505. if ispanel(zm.tabs[ zm.active.cat ]) then
  506.  
  507. zm.tabs[ zm.active.cat ]:SetVisible( true )
  508.  
  509. else
  510.  
  511. zm.tabs[ zm.active.cat ] = zm.tabs[ zm.active.cat ]()
  512.  
  513. zm.tabs[ zm.active.cat ]:SetPos( x + 5, y + zm.logo_h + 5 )
  514.  
  515. zm.tabs[ zm.active.cat ]:SetSize( zm.content_w, zm.content_h )
  516.  
  517. end
  518.  
  519. end
  520.  
  521.  
  522.  
  523. end
  524.  
  525.  
  526.  
  527. function zm.OpenHiddenTab(tab)
  528.  
  529. if not tab then return end
  530.  
  531. for k, v in pairs( zm.categories ) do
  532.  
  533. if ispanel(zm.tabs[ k ]) then zm.tabs[ k ]:SetVisible( false ) end
  534.  
  535. end
  536.  
  537.  
  538.  
  539. if zm.hiddentab then zm.hiddentab:Remove() end
  540.  
  541. local sw, sh = ScrW(), ScrH()
  542.  
  543. local x = sw / 2 - zm.w / 2
  544.  
  545. local y = sh / 2 - zm.h / 2
  546.  
  547. zm.hiddentab = tab
  548.  
  549. zm.hiddentab:SetVisible( true )
  550.  
  551. zm.hiddentab:SetPos( x + 5, y + zm.logo_h + 5 )
  552.  
  553. zm.hiddentab:SetSize( zm.content_w, zm.content_h )
  554.  
  555. end
  556.  
  557.  
  558.  
  559. local AdventCalendarLoop = AdventCalendarLoop or false
  560.  
  561. function zm.Close()
  562.  
  563. zm.open = false
  564.  
  565. zm.mposx, zm.mposy = gui.MousePos()
  566.  
  567. gui.EnableScreenClicker( false )
  568.  
  569. if zm.ctl then
  570.  
  571. for k, v in pairs( zm.ctl ) do
  572.  
  573. v:SetVisible( false )
  574.  
  575. end
  576.  
  577. end
  578.  
  579. if zm.tabs then
  580.  
  581. for k, v in pairs( zm.tabs ) do
  582.  
  583. if ispanel(v) then v:SetVisible( false ) end
  584.  
  585. end
  586.  
  587. if zm.hiddentab then zm.hiddentab:Remove() end
  588.  
  589. end
  590.  
  591. ZARP.SetNewItemLogSuppressed(false)
  592.  
  593. //Remove after christmas event
  594.  
  595. if IsValid(AdventCalendarLoop) then AdventCalendarLoop:Stop() AdventCalendarLoop = nil end
  596.  
  597. end
  598.  
  599.  
  600.  
  601. function zm.IsOpen()
  602.  
  603. return zm.open
  604.  
  605. end
  606.  
  607.  
  608.  
  609. function zm.PlayerBindPress(ply, bind, down)
  610.  
  611. if (bind=="gm_showspare2") and down then
  612.  
  613. if zm.IsOpen() then zm.Close()
  614.  
  615. else zm.Open() end
  616.  
  617. return true
  618.  
  619. end
  620.  
  621.  
  622.  
  623. end
  624.  
  625. hook.Add( "PlayerBindPress", "ZARPMenu_PlayerBindPress", zm.PlayerBindPress )
  626.  
  627.  
  628.  
  629. function ZARP.OpenMenu(tab, vaulttab, banktab)
  630.  
  631. zm.Open(tab)
  632.  
  633. if vaulttab then zm.OpenHiddenTab(zm.VaultTab())
  634.  
  635. elseif banktab then zm.OpenHiddenTab(zm.BankTab())
  636.  
  637. end
  638.  
  639. end
  640.  
  641.  
  642.  
  643. local RankData =
  644.  
  645. {
  646.  
  647. ["vip"] = { "vip-iconzarp.png", Color( 150, 150, 170, 255 ) },
  648.  
  649. ["moderator"] = { "icon16/award_star_gold_3.png", Color( 200, 100, 0, 255 ) },
  650.  
  651. ["admin"] = { "icon16/shield.png", Color( 200, 0, 0, 255 ) },
  652.  
  653. ["superadmin"] = { "icon16/shield_add.png", Color( 200, 0, 0, 255 ) },
  654.  
  655. ["headadmin"] = { "icon16/star.png", Color( 4, 6, 167, 255 ) },
  656.  
  657. ["Developer"] = { "icon16/award_star_bronze_1.png" , Color( 0, 175, 175, 200 ) },
  658.  
  659. ["Co-Owner"] = { "icon16/asterisk_orange.png" , Color( 0, 175, 175, 200 ) },
  660.  
  661. ["Owner"] = { "icon16/asterisk_yellow.png", Color( 0, 175, 175, 200 ) }
  662.  
  663. }
  664.  
  665.  
  666.  
  667. local function MakeSign( rankname, parent )
  668.  
  669. local rank = RankData[ rankname ]
  670.  
  671. local icon = vgui.Create( "DImage", parent )
  672.  
  673. icon:SetImage( rank[1] )
  674.  
  675. icon:SetPos( 64 -8, 64 -8 )
  676.  
  677. icon:SetMouseInputEnabled( false )
  678.  
  679. if rank == "vip" then
  680.  
  681. icon:SetSize( 20, 20 )
  682.  
  683. else
  684.  
  685. icon:SetSize( 16, 16 )
  686.  
  687. end
  688.  
  689.  
  690.  
  691. return icon
  692.  
  693. end
  694.  
  695.  
  696.  
  697. --[[
  698.  
  699.  
  700.  
  701. ACTIONS TAB
  702.  
  703.  
  704.  
  705. --]]
  706.  
  707.  
  708.  
  709. CreateClientConVar("rp_playermodel", "", true, true)
  710.  
  711.  
  712.  
  713. local _actpanel
  714.  
  715.  
  716.  
  717. local function MakeNiceButton(auto, text,clr,txtclr)
  718.  
  719. local btn = vgui.Create("DButton")
  720.  
  721. btn.bgcol = clr or Color( 200, 200, 200, 255 )
  722.  
  723.  
  724.  
  725. function btn:Paint()
  726.  
  727. if not self.drawcol then self.drawcol = self.bgcol end
  728.  
  729. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.drawcol )
  730.  
  731. end
  732.  
  733.  
  734.  
  735. if text then
  736.  
  737. btn.PaintOver = function(s,w,h)
  738.  
  739. draw.WordBox( 6, s:GetWide() - 45, 2, text, "Bebas24Font", Color(255,51,51), color_white )
  740.  
  741. end
  742.  
  743. end
  744.  
  745.  
  746.  
  747. function btn:OnCursorEntered()
  748.  
  749. self.hover = true
  750.  
  751. self.drawcol = Color( self.bgcol.r + 25, self.bgcol.g + 25, self.bgcol.b + 25, self.bgcol.a )
  752.  
  753. end
  754.  
  755.  
  756.  
  757. function btn:OnCursorExited()
  758.  
  759. self.hover = false
  760.  
  761. self.drawcol = self.bgcol
  762.  
  763. end
  764.  
  765.  
  766.  
  767. function btn:OnMouseWheeled(d)
  768.  
  769. _actpanel:OnMouseWheeled(d)
  770.  
  771. end
  772.  
  773.  
  774.  
  775. if auto then
  776.  
  777. btn:DockMargin(5,0,5,5)
  778.  
  779. btn:SetTall(40)
  780.  
  781. end
  782.  
  783.  
  784.  
  785. if txtclr then btn:SetTextColor(txtclr) end
  786.  
  787.  
  788.  
  789. return btn
  790.  
  791. end
  792.  
  793.  
  794.  
  795. local function MakeCategoryNice( cat, color )
  796.  
  797. cat.bgcol = color or Color( 150, 150, 150, 255 )
  798.  
  799. function cat:Paint()
  800.  
  801. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.bgcol )
  802.  
  803. end
  804.  
  805. cat.Header:SetFont( "Tre20" )
  806.  
  807. cat.Header:SetColor( Color( 255, 255, 255, 255 ) )
  808.  
  809.  
  810.  
  811. function cat:OnMouseWheeled(d)
  812.  
  813. _actpanel:OnMouseWheeled(d)
  814.  
  815. end
  816.  
  817.  
  818.  
  819. function cat.Header:OnMouseWheeled(d)
  820.  
  821. _actpanel:OnMouseWheeled(d)
  822.  
  823. end
  824.  
  825. end
  826.  
  827.  
  828.  
  829. local function MayorOptns()
  830.  
  831. local MayCat = vgui.Create("DCollapsibleCategory")
  832.  
  833.  
  834.  
  835. MakeCategoryNice( MayCat )
  836.  
  837. MayCat:SetLabel("Mayor Actions")
  838.  
  839. MayCat.bgcol = team.GetColor(LocalPlayer():Team())
  840.  
  841.  
  842.  
  843. local maypanel = vgui.Create("DPanelList")
  844.  
  845. maypanel:SetSize(470, 200)
  846.  
  847. maypanel:SetAutoSize(true)
  848.  
  849. maypanel:SetSpacing(5)
  850.  
  851. maypanel:SetPadding(5)
  852.  
  853. maypanel:EnableHorizontal(true)
  854.  
  855. maypanel:EnableVerticalScrollbar(false)
  856.  
  857.  
  858.  
  859. local buttonw, buttonh = 207, 40
  860.  
  861.  
  862.  
  863. local SearchWarrant = MakeNiceButton()
  864.  
  865. SearchWarrant:SetText(LANGUAGE.GetPhrase("request_warrant"))
  866.  
  867. SearchWarrant.DoClick = function()
  868.  
  869. local menu = DermaMenu()
  870.  
  871. for _,ply in pairs(NickSortedPlayers()) do
  872.  
  873. if not ply.DarkRPVars.warrant then
  874.  
  875. menu:AddOption(ply:Nick(), function()
  876.  
  877. Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil,
  878.  
  879. function(a)
  880.  
  881. LocalPlayer():ConCommand("say /warrant ".. tostring(ply:UserID()).." ".. a)
  882.  
  883. end, function() end ) end)
  884.  
  885. end
  886.  
  887. end
  888.  
  889. menu:Open()
  890.  
  891. end
  892.  
  893. SearchWarrant:SetSize( buttonw, buttonh )
  894.  
  895. maypanel:AddItem( SearchWarrant )
  896.  
  897.  
  898.  
  899. local Warrant = MakeNiceButton()
  900.  
  901. Warrant:SetText(LANGUAGE.GetPhrase("make_wanted"))
  902.  
  903. Warrant.DoClick = function()
  904.  
  905. local menu = DermaMenu()
  906.  
  907. for _,ply in pairs(NickSortedPlayers()) do
  908.  
  909. if not ply.DarkRPVars.wanted then
  910.  
  911. menu:AddOption(ply:Nick(), function() Derma_StringRequest("wanted", "Why would you make "..ply:Nick().." wanted?", nil,
  912.  
  913. function(a)
  914.  
  915. LocalPlayer():ConCommand("say /wanted ".. tostring(ply:UserID()).." ".. a)
  916.  
  917. end, function() end ) end)
  918.  
  919. end
  920.  
  921. end
  922.  
  923. menu:Open()
  924.  
  925. end
  926.  
  927. Warrant:SetSize( buttonw, buttonh )
  928.  
  929. maypanel:AddItem( Warrant )
  930.  
  931.  
  932.  
  933.  
  934.  
  935. local UnWarrant = MakeNiceButton()
  936.  
  937. UnWarrant:SetText(LANGUAGE.GetPhrase("make_unwanted"))
  938.  
  939. UnWarrant.DoClick = function()
  940.  
  941. local menu = DermaMenu()
  942.  
  943. for _,ply in pairs(NickSortedPlayers()) do
  944.  
  945. if ply.DarkRPVars.wanted then
  946.  
  947. menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("say /unwanted " .. tostring(ply:UserID())) end)
  948.  
  949. end
  950.  
  951. end
  952.  
  953. menu:Open()
  954.  
  955. end
  956.  
  957. UnWarrant:SetSize( buttonw, buttonh )
  958.  
  959. maypanel:AddItem( UnWarrant )
  960.  
  961.  
  962.  
  963.  
  964.  
  965. local Lockdown = MakeNiceButton()
  966.  
  967. Lockdown:SetText(LANGUAGE.GetPhrase("initiate_lockdown"))
  968.  
  969. Lockdown.DoClick = function()
  970.  
  971. LocalPlayer():ConCommand("say /lockdown")
  972.  
  973. end
  974.  
  975. Lockdown:SetSize( buttonw, buttonh )
  976.  
  977. maypanel:AddItem( Lockdown )
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985. local UnLockdown = MakeNiceButton()
  986.  
  987. UnLockdown:SetText(LANGUAGE.GetPhrase("stop_lockdown"))
  988.  
  989. UnLockdown.DoClick = function()
  990.  
  991. LocalPlayer():ConCommand("say /unlockdown")
  992.  
  993. end
  994.  
  995. UnLockdown:SetSize( buttonw, buttonh )
  996.  
  997. maypanel:AddItem( UnLockdown )
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003. local Lottery = MakeNiceButton()
  1004.  
  1005. Lottery:SetText(LANGUAGE.GetPhrase("start_lottery"))
  1006.  
  1007. Lottery.DoClick = function()
  1008.  
  1009. Derma_StringRequest("Lottery",string.format("Enter the lottery ticket price: ($%s-%s)",GAMEMODE.Config.minlotterycost,GAMEMODE.Config.maxlotterycost),tostring(GAMEMODE.Config.maxlotterycost),function(val)
  1010.  
  1011. LocalPlayer():ConCommand("say /lottery "..val)
  1012.  
  1013. end)
  1014.  
  1015. end
  1016.  
  1017. Lottery:SetSize( buttonw, buttonh )
  1018.  
  1019. maypanel:AddItem( Lottery )
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025. local GiveLicense = MakeNiceButton()
  1026.  
  1027. GiveLicense:SetText(LANGUAGE.GetPhrase("give_license_lookingat"))
  1028.  
  1029. GiveLicense.DoClick = function()
  1030.  
  1031. LocalPlayer():ConCommand("say /givelicense")
  1032.  
  1033. end
  1034.  
  1035. GiveLicense:SetSize( buttonw, buttonh )
  1036.  
  1037. maypanel:AddItem( GiveLicense )
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043. local PlaceLaws = MakeNiceButton()
  1044.  
  1045. PlaceLaws:SetText("Place a screen containing the laws.")
  1046.  
  1047. PlaceLaws.DoClick = function()
  1048.  
  1049. LocalPlayer():ConCommand("say /placelaws")
  1050.  
  1051. end
  1052.  
  1053. PlaceLaws:SetSize( buttonw, buttonh )
  1054.  
  1055. maypanel:AddItem( PlaceLaws )
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061. local AddLaws = MakeNiceButton()
  1062.  
  1063. AddLaws:SetText("Add a law.")
  1064.  
  1065. AddLaws.DoClick = function()
  1066.  
  1067. Derma_StringRequest("Add a law", "Type the law you would like to add here.", "", function(law)
  1068.  
  1069. LocalPlayer():ConCommand("say /addlaw " .. law)
  1070.  
  1071. end)
  1072.  
  1073. end
  1074.  
  1075. AddLaws:SetSize( buttonw, buttonh )
  1076.  
  1077. maypanel:AddItem( AddLaws )
  1078.  
  1079.  
  1080.  
  1081. local RemLaws = MakeNiceButton()
  1082.  
  1083. RemLaws:SetText("Remove a law.")
  1084.  
  1085. RemLaws.DoClick = function()
  1086.  
  1087. Derma_StringRequest("Remove a law", "Enter the number of the law you would like to remove here.", "", function(num)
  1088.  
  1089. LocalPlayer():ConCommand("say /removelaw " .. num)
  1090.  
  1091. end)
  1092.  
  1093. end
  1094.  
  1095. RemLaws:SetSize( buttonw, buttonh )
  1096.  
  1097. maypanel:AddItem( RemLaws )
  1098.  
  1099.  
  1100.  
  1101. local OpenBail = MakeNiceButton()
  1102.  
  1103. OpenBail:SetText("Open/Close Bail")
  1104.  
  1105. OpenBail.DoClick = function()
  1106.  
  1107. local menu = DermaMenu()
  1108.  
  1109. menu:AddOption("Open Bail", function() LocalPlayer():ConCommand("say /bailsettings open 1") end)
  1110.  
  1111. menu:AddOption("Close Bail", function() LocalPlayer():ConCommand("say /bailsettings open 0") end)
  1112.  
  1113. menu:Open()
  1114.  
  1115. end
  1116.  
  1117. OpenBail:SetSize( buttonw, buttonh )
  1118.  
  1119. maypanel:AddItem( OpenBail )
  1120.  
  1121.  
  1122.  
  1123. local PayCops = MakeNiceButton()
  1124.  
  1125. PayCops:SetText("Bail Payment")
  1126.  
  1127. PayCops.DoClick = function()
  1128.  
  1129. local menu = DermaMenu()
  1130.  
  1131. menu:AddOption("Pay CP for Bail's", function() LocalPlayer():ConCommand("say /bailsettings pay 1") end)
  1132.  
  1133. menu:AddOption("Do Not Pay CP for Bail's", function() LocalPlayer():ConCommand("say /bailsettings pay 0") end)
  1134.  
  1135. menu:Open()
  1136.  
  1137. end
  1138.  
  1139. PayCops:SetSize( buttonw, buttonh )
  1140.  
  1141. maypanel:AddItem( PayCops )
  1142.  
  1143.  
  1144.  
  1145. local RequireBail = MakeNiceButton()
  1146.  
  1147. RequireBail:SetText("Bail Requirement")
  1148.  
  1149. RequireBail.DoClick = function()
  1150.  
  1151. local menu = DermaMenu()
  1152.  
  1153. menu:AddOption("Require Approval For Bail", function() LocalPlayer():ConCommand("say /bailsettings required 1") end)
  1154.  
  1155. menu:AddOption("Do Not Require Approval For Bail", function() LocalPlayer():ConCommand("say /bailsettings required 0") end)
  1156.  
  1157. menu:Open()
  1158.  
  1159. end
  1160.  
  1161. RequireBail:SetSize( buttonw, buttonh )
  1162.  
  1163. maypanel:AddItem( RequireBail )
  1164.  
  1165.  
  1166.  
  1167. MayCat:SetContents(maypanel)
  1168.  
  1169. return MayCat
  1170.  
  1171. end
  1172.  
  1173.  
  1174.  
  1175. local function CPOptns()
  1176.  
  1177. local CPCat = vgui.Create("DCollapsibleCategory")
  1178.  
  1179. MakeCategoryNice( CPCat )
  1180.  
  1181. CPCat.bgcol = team.GetColor(LocalPlayer():Team())
  1182.  
  1183.  
  1184.  
  1185. CPCat:SetLabel("Law Enforcement Actions")
  1186.  
  1187. local CPPanel = vgui.Create("DPanelList")
  1188.  
  1189. CPPanel:SetSize(470, 200)
  1190.  
  1191. CPPanel:SetAutoSize(true)
  1192.  
  1193. CPPanel:SetSpacing(5)
  1194.  
  1195. CPPanel:SetPadding(5)
  1196.  
  1197. CPPanel:EnableHorizontal(true)
  1198.  
  1199. CPPanel:EnableVerticalScrollbar(false)
  1200.  
  1201.  
  1202.  
  1203. local buttonw, buttonh = 207, 40
  1204.  
  1205.  
  1206.  
  1207. local SearchWarrant = MakeNiceButton()
  1208.  
  1209. SearchWarrant:SetText(LANGUAGE.GetPhrase("request_warrant"))
  1210.  
  1211. SearchWarrant.DoClick = function()
  1212.  
  1213. local menu = DermaMenu()
  1214.  
  1215. for _,ply in pairs(NickSortedPlayers()) do
  1216.  
  1217. if not ply.DarkRPVars.warrant then
  1218.  
  1219. menu:AddOption(ply:Nick(), function()
  1220.  
  1221. Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil,
  1222.  
  1223. function(a)
  1224.  
  1225. LocalPlayer():ConCommand("say /warrant ".. tostring(ply:UserID()).." ".. a)
  1226.  
  1227. end, function() end ) end)
  1228.  
  1229. end
  1230.  
  1231. end
  1232.  
  1233. menu:Open()
  1234.  
  1235. end
  1236.  
  1237. SearchWarrant:SetSize( buttonw, buttonh )
  1238.  
  1239. CPPanel:AddItem( SearchWarrant )
  1240.  
  1241.  
  1242.  
  1243. local Warrant = MakeNiceButton()
  1244.  
  1245. Warrant:SetText(LANGUAGE.GetPhrase("searchwarrantbutton"))
  1246.  
  1247. Warrant.DoClick = function()
  1248.  
  1249. local menu = DermaMenu()
  1250.  
  1251. for _,ply in pairs(NickSortedPlayers()) do
  1252.  
  1253. if not ply.DarkRPVars.wanted then
  1254.  
  1255. menu:AddOption(ply:Nick(), function() Derma_StringRequest("wanted", "Why would you make "..ply:Nick().." wanted?", nil,
  1256.  
  1257. function(a)
  1258.  
  1259. if not IsValid(ply) then return end
  1260.  
  1261. LocalPlayer():ConCommand("say /wanted ".. tostring(ply:UserID()).." ".. a)
  1262.  
  1263. end, function() end ) end)
  1264.  
  1265. end
  1266.  
  1267. end
  1268.  
  1269. menu:Open()
  1270.  
  1271. end
  1272.  
  1273. Warrant:SetSize( buttonw, buttonh )
  1274.  
  1275. CPPanel:AddItem( Warrant )
  1276.  
  1277.  
  1278.  
  1279. local UnWarrant = MakeNiceButton()
  1280.  
  1281. UnWarrant:SetText(LANGUAGE.GetPhrase("unwarrantbutton"))
  1282.  
  1283. UnWarrant.DoClick = function()
  1284.  
  1285. local menu = DermaMenu()
  1286.  
  1287. for _,ply in pairs(NickSortedPlayers()) do
  1288.  
  1289. if ply.DarkRPVars.wanted then
  1290.  
  1291. menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("say /unwanted " .. tostring(ply:UserID())) end)
  1292.  
  1293. end
  1294.  
  1295. end
  1296.  
  1297. menu:Open()
  1298.  
  1299. end
  1300.  
  1301. UnWarrant:SetSize( buttonw, buttonh )
  1302.  
  1303. CPPanel:AddItem( UnWarrant )
  1304.  
  1305.  
  1306.  
  1307. if LocalPlayer():Team() == TEAM_CHIEF or LocalPlayer():Team() == TEAM_PRISONGUARD or LocalPlayer():IsAdmin() then
  1308.  
  1309. local SetJailPos = MakeNiceButton()
  1310.  
  1311. SetJailPos:SetText(LANGUAGE.GetPhrase("set_jailpos"))
  1312.  
  1313. SetJailPos.DoClick = function() LocalPlayer():ConCommand("say /jailpos") end
  1314.  
  1315. SetJailPos:SetSize( buttonw, buttonh )
  1316.  
  1317. CPPanel:AddItem( SetJailPos )
  1318.  
  1319.  
  1320.  
  1321. local AddJailPos = MakeNiceButton()
  1322.  
  1323. AddJailPos:SetText(LANGUAGE.GetPhrase("add_jailpos"))
  1324.  
  1325. AddJailPos.DoClick = function() LocalPlayer():ConCommand("say /addjailpos") end
  1326.  
  1327. AddJailPos:SetSize( buttonw, buttonh )
  1328.  
  1329. CPPanel:AddItem( AddJailPos )
  1330.  
  1331. end
  1332.  
  1333.  
  1334.  
  1335. local ismayor -- Firstly look if there's a mayor
  1336.  
  1337. local ischief -- Then if there's a chief
  1338.  
  1339. for k,v in pairs(player.GetAll()) do
  1340.  
  1341. if v:Team() == TEAM_MAYOR then
  1342.  
  1343. ismayor = true
  1344.  
  1345. break
  1346.  
  1347. end
  1348.  
  1349. end
  1350.  
  1351.  
  1352.  
  1353. if not ismayor then
  1354.  
  1355. for k,v in pairs(player.GetAll()) do
  1356.  
  1357. if v:Team() == TEAM_CHIEF then
  1358.  
  1359. ischief = true
  1360.  
  1361. break
  1362.  
  1363. end
  1364.  
  1365. end
  1366.  
  1367. end
  1368.  
  1369.  
  1370.  
  1371. local Team = LocalPlayer():Team()
  1372.  
  1373. if not ismayor and (Team == TEAM_CHIEF or (not ischief and Team == TEAM_POLICE)) then
  1374.  
  1375. local GiveLicense = MakeNiceButton()
  1376.  
  1377. GiveLicense:SetText(LANGUAGE.GetPhrase("give_license_lookingat"))
  1378.  
  1379. GiveLicense.DoClick = function()
  1380.  
  1381. LocalPlayer():ConCommand("say /givelicense")
  1382.  
  1383. end
  1384.  
  1385. GiveLicense:SetSize( buttonw, buttonh )
  1386.  
  1387. CPPanel:AddItem( GiveLicense )
  1388.  
  1389. end
  1390.  
  1391. CPCat:SetContents(CPPanel)
  1392.  
  1393. return CPCat
  1394.  
  1395. end
  1396.  
  1397.  
  1398.  
  1399. local function MobOptns()
  1400.  
  1401. local MobCat = vgui.Create("DCollapsibleCategory")
  1402.  
  1403. MakeCategoryNice( MobCat )
  1404.  
  1405. MobCat.bgcol = team.GetColor(LocalPlayer():Team())
  1406.  
  1407. MobCat:SetLabel("Mobboss options")
  1408.  
  1409. local Mobpanel = vgui.Create("DPanelList")
  1410.  
  1411. Mobpanel:SetSize(470, 200)
  1412.  
  1413. Mobpanel:SetAutoSize(true)
  1414.  
  1415. Mobpanel:SetSpacing(5)
  1416.  
  1417. Mobpanel:SetPadding(5)
  1418.  
  1419. Mobpanel:EnableHorizontal(true)
  1420.  
  1421. Mobpanel:EnableVerticalScrollbar(false)
  1422.  
  1423.  
  1424.  
  1425. local buttonw, buttonh = 207, 40
  1426.  
  1427.  
  1428.  
  1429. local AgendaButton = MakeNiceButton()
  1430.  
  1431. AgendaButton:SetText( "Set the Agenda" )
  1432.  
  1433. AgendaButton.DoClick = function()
  1434.  
  1435. Derma_StringRequest("Set Agenda", "New Agenda:", "", function(a) LocalPlayer():ConCommand("say /agenda " .. tostring(a)) end)
  1436.  
  1437. end
  1438.  
  1439. AgendaButton:SetSize( buttonw, buttonh )
  1440.  
  1441. AgendaButton:SetImage( "icon16/vcard_edit.png" )
  1442.  
  1443. Mobpanel:AddItem( AgendaButton )
  1444.  
  1445.  
  1446.  
  1447. MobCat:SetContents(Mobpanel)
  1448.  
  1449. return MobCat
  1450.  
  1451. end
  1452.  
  1453.  
  1454.  
  1455. local function HitOpts()
  1456.  
  1457. local HitsCat = vgui.Create("DCollapsibleCategory")
  1458.  
  1459. MakeCategoryNice( HitsCat )
  1460.  
  1461. HitsCat.bgcol = team.GetColor(LocalPlayer():Team())
  1462.  
  1463. HitsCat:SetLabel("Hit List")
  1464.  
  1465. local panel = vgui.Create("DPanelList")
  1466.  
  1467. panel:SetSize(470, 200)
  1468.  
  1469. panel:SetAutoSize(true)
  1470.  
  1471. panel:SetSpacing(5)
  1472.  
  1473. panel:SetPadding(5)
  1474.  
  1475. panel:EnableHorizontal(true)
  1476.  
  1477. panel:EnableVerticalScrollbar(false)
  1478.  
  1479.  
  1480.  
  1481. local buttonw, buttonh = 207, 40
  1482.  
  1483.  
  1484.  
  1485. local HitListBtn = MakeNiceButton()
  1486.  
  1487. HitListBtn:SetText( "View the current hits" )
  1488.  
  1489. HitListBtn.DoClick = function()
  1490.  
  1491. zm.OpenHiddenTab(zm.HitListTab())
  1492.  
  1493. end
  1494.  
  1495. HitListBtn:SetSize( buttonw, buttonh )
  1496.  
  1497. HitListBtn:SetImage( "icon16/gun.png" )
  1498.  
  1499. panel:AddItem( HitListBtn )
  1500.  
  1501.  
  1502.  
  1503. HitsCat:SetContents(panel)
  1504.  
  1505. return HitsCat
  1506.  
  1507. end
  1508.  
  1509.  
  1510.  
  1511. function zm.Actions()
  1512.  
  1513. local mainframe = vgui.Create( "DPanel" )
  1514.  
  1515. mainframe:SetSize( zm.content_w, zm.content_h )
  1516.  
  1517. function mainframe:Paint() end
  1518.  
  1519.  
  1520.  
  1521. local actionframe = vgui.Create( "DPanel", mainframe )
  1522.  
  1523. actionframe:SetSize( zm.content_w / 2, zm.content_h )
  1524.  
  1525. function actionframe:Paint() end
  1526.  
  1527.  
  1528.  
  1529. local actionpanel = vgui.Create("DPanelList",actionframe)
  1530.  
  1531. actionpanel:SetKeyboardInputEnabled(true)
  1532.  
  1533. actionpanel:SetSpacing( 5 )
  1534.  
  1535. actionpanel:SetPadding( 5 )
  1536.  
  1537. actionpanel:SetSize( zm.content_w / 2 + 5, zm.content_h )
  1538.  
  1539. --actionpanel:SetAutoSize( true )
  1540.  
  1541.  
  1542.  
  1543. _actpanel = actionpanel
  1544.  
  1545.  
  1546.  
  1547. actionpanel:EnableVerticalScrollbar( true )
  1548.  
  1549. function actionpanel:Update()
  1550.  
  1551. self:Clear(true)
  1552.  
  1553. local MoneyCat = vgui.Create("DCollapsibleCategory")
  1554.  
  1555. MakeCategoryNice( MoneyCat )
  1556.  
  1557. MoneyCat.bgcol = Color( 112, 158, 63, 255 )
  1558.  
  1559.  
  1560.  
  1561. MoneyCat:SetLabel("General")
  1562.  
  1563. local MoneyPanel = vgui.Create("DPanelList")
  1564.  
  1565. MoneyPanel:SetSize(470, 200)
  1566.  
  1567. MoneyPanel:SetAutoSize(true)
  1568.  
  1569. MoneyPanel:SetSpacing(5)
  1570.  
  1571. MoneyPanel:SetPadding(5)
  1572.  
  1573. MoneyPanel:EnableHorizontal(true)
  1574.  
  1575. MoneyPanel:EnableVerticalScrollbar(false)
  1576.  
  1577.  
  1578.  
  1579. local buttonw, buttonh = 207, 40
  1580.  
  1581.  
  1582.  
  1583. local TradeBtn = MakeNiceButton()
  1584.  
  1585. TradeBtn:SetText( "Send a trade request." )
  1586.  
  1587. TradeBtn.DoClick = function()
  1588.  
  1589. local menu = DermaMenu()
  1590.  
  1591. for _,ply in pairs(NickSortedPlayers()) do
  1592.  
  1593. if ply ~= LocalPlayer() then
  1594.  
  1595. menu:AddOption(ply:Nick(), function()
  1596.  
  1597. RunConsoleCommand("__trd","start",ply:UserID())
  1598.  
  1599. end)
  1600.  
  1601. end
  1602.  
  1603. end
  1604.  
  1605. menu:Open()
  1606.  
  1607. end
  1608.  
  1609. TradeBtn:SetSize( buttonw, buttonh )
  1610.  
  1611. TradeBtn:SetImage( "icon16/arrow_switch.png" )
  1612.  
  1613. MoneyPanel:AddItem( TradeBtn )
  1614.  
  1615.  
  1616.  
  1617. local SpawnMoneyButton = MakeNiceButton()
  1618.  
  1619. SpawnMoneyButton:SetText(LANGUAGE.GetPhrase("drop_money"))
  1620.  
  1621. SpawnMoneyButton.DoClick = function()
  1622.  
  1623. Derma_StringRequest("Amount of money", "How much money do you want to drop?", "", function(a) LocalPlayer():ConCommand("say /dropmoney " .. tostring(a)) end)
  1624.  
  1625. end
  1626.  
  1627. SpawnMoneyButton:SetSize( buttonw, buttonh )
  1628.  
  1629. SpawnMoneyButton:SetImage( "icon16/money.png" )
  1630.  
  1631. MoneyPanel:AddItem( SpawnMoneyButton )
  1632.  
  1633.  
  1634.  
  1635. if not LocalPlayer():IsStaff() then
  1636.  
  1637. local CallAdmin = MakeNiceButton()
  1638.  
  1639. CallAdmin:SetText( "Admin Request")
  1640.  
  1641. CallAdmin.DoClick = function() HCallAdmin.Call() end
  1642.  
  1643. CallAdmin:SetSize( buttonw, buttonh )
  1644.  
  1645. CallAdmin:SetImage( "icon16/shield_add.png" )
  1646.  
  1647. MoneyPanel:AddItem( CallAdmin )
  1648.  
  1649. end
  1650.  
  1651.  
  1652.  
  1653. local DropButton = MakeNiceButton()
  1654.  
  1655. DropButton:SetText( "Drop/Holster current weapon" )
  1656.  
  1657. DropButton.DoClick = function()
  1658.  
  1659. local menu = DermaMenu()
  1660.  
  1661. menu:AddOption("Drop", function() RunConsoleCommand("say","/drop") end)
  1662.  
  1663. menu:AddOption("Holster", function() RunConsoleCommand("say","/holster") end)
  1664.  
  1665. menu:Open()
  1666.  
  1667. end
  1668.  
  1669. DropButton:SetSize( buttonw, buttonh )
  1670.  
  1671. DropButton:SetImage( "icon16/gun.png" )
  1672.  
  1673. MoneyPanel:AddItem( DropButton )
  1674.  
  1675.  
  1676.  
  1677. local PlaceHitButton = MakeNiceButton()
  1678.  
  1679. PlaceHitButton:SetText( "Place a hit on someone" )
  1680.  
  1681. PlaceHitButton.DoClick = function()
  1682.  
  1683. local menu = DermaMenu()
  1684.  
  1685. for _,ply in pairs(NickSortedPlayers()) do
  1686.  
  1687. if ply ~= LocalPlayer() then
  1688.  
  1689. menu:AddOption(ply:Nick(), function()
  1690.  
  1691. Derma_StringRequest("Place a Hit", "How much are you willing to spend?(Minimum is $2,500)", "", function(a) LocalPlayer():ConCommand("say /hit " ..ply:UserID().." "..tonumber(a or 0)) end)
  1692.  
  1693. end)
  1694.  
  1695. end
  1696.  
  1697. end
  1698.  
  1699. menu:Open()
  1700.  
  1701. end
  1702.  
  1703. PlaceHitButton:SetSize( buttonw, buttonh )
  1704.  
  1705. PlaceHitButton:SetImage( "icon16/bomb.png" )
  1706.  
  1707. MoneyPanel:AddItem( PlaceHitButton )
  1708.  
  1709.  
  1710.  
  1711. --[[local CallPolice = MakeNiceButton()
  1712.  
  1713. CallPolice:SetText( "Call the police" )
  1714.  
  1715. CallPolice.DoClick = function()
  1716.  
  1717. Derma_StringRequest("Reason", "Why do you want to call the police and where are you?", "", function(a) LocalPlayer():ConCommand("say /911 " .. tostring(a)) end)
  1718.  
  1719. end
  1720.  
  1721. CallPolice:SetSize( buttonw, buttonh )
  1722.  
  1723. CallPolice:SetImage( "icon16/phone.png" )
  1724.  
  1725. MoneyPanel:AddItem( CallPolice )]]
  1726.  
  1727.  
  1728.  
  1729. MoneyCat:SetContents(MoneyPanel)
  1730.  
  1731.  
  1732.  
  1733. local Commands = vgui.Create("DCollapsibleCategory")
  1734.  
  1735. MakeCategoryNice( Commands )
  1736.  
  1737. Commands:SetLabel("Roleplay Options")
  1738.  
  1739. local ActionsPanel = vgui.Create("DPanelList")
  1740.  
  1741. ActionsPanel:SetSize(470, 200)
  1742.  
  1743. ActionsPanel:SetAutoSize(true)
  1744.  
  1745. ActionsPanel:SetSpacing(5)
  1746.  
  1747. ActionsPanel:SetPadding(5)
  1748.  
  1749. ActionsPanel:EnableHorizontal(true)
  1750.  
  1751. ActionsPanel:EnableVerticalScrollbar(false)
  1752.  
  1753.  
  1754.  
  1755. local buttonw, buttonh = 207, 40
  1756.  
  1757.  
  1758.  
  1759. local NameButton = MakeNiceButton()
  1760.  
  1761. NameButton:SetText( "Change your RP Name" )
  1762.  
  1763. NameButton.DoClick = function()
  1764.  
  1765. Derma_StringRequest("Change RP Name", "New RP Name:", "", function(a) LocalPlayer():ConCommand("say /rpname " .. tostring(a)) end)
  1766.  
  1767. end
  1768.  
  1769. NameButton:SetSize( buttonw, buttonh )
  1770.  
  1771. NameButton:SetImage( "icon16/vcard_edit.png" )
  1772.  
  1773. ActionsPanel:AddItem( NameButton )
  1774.  
  1775.  
  1776.  
  1777. local JobButton = MakeNiceButton()
  1778.  
  1779. JobButton:SetText( "Change your job title" )
  1780.  
  1781. JobButton.DoClick = function()
  1782.  
  1783. Derma_StringRequest("Change RP Name", "New Job Title:", "", function(a) LocalPlayer():ConCommand("say /job " .. tostring(a)) end)
  1784.  
  1785. end
  1786.  
  1787. JobButton:SetSize( buttonw, buttonh )
  1788.  
  1789. JobButton:SetImage( "icon16/vcard_edit.png" )
  1790.  
  1791. ActionsPanel:AddItem( JobButton )
  1792.  
  1793.  
  1794.  
  1795. local Demote = MakeNiceButton()
  1796.  
  1797. Demote:SetText(LANGUAGE.GetPhrase("demote_player_menu"))
  1798.  
  1799. Demote.DoClick = function()
  1800.  
  1801. local menu = DermaMenu()
  1802.  
  1803. for _,ply in pairs(NickSortedPlayers()) do
  1804.  
  1805. if ply ~= LocalPlayer() then
  1806.  
  1807. menu:AddOption(ply:Nick(), function()
  1808.  
  1809. Derma_StringRequest("Demote reason", "Why would you demote "..ply:Nick().."?", nil,
  1810.  
  1811. function(a)
  1812.  
  1813. LocalPlayer():ConCommand("say /demote ".. tostring(ply:UserID()).." ".. a)
  1814.  
  1815. end, function() end )
  1816.  
  1817. end)
  1818.  
  1819. end
  1820.  
  1821. end
  1822.  
  1823. menu:Open()
  1824.  
  1825. end
  1826.  
  1827. Demote:SetSize( buttonw, buttonh )
  1828.  
  1829. Demote:SetImage( "icon16/user_delete.png" )
  1830.  
  1831. ActionsPanel:AddItem( Demote )
  1832.  
  1833.  
  1834.  
  1835. local UnOwnAllDoors = MakeNiceButton()
  1836.  
  1837. UnOwnAllDoors:SetText("Sell all of your doors")
  1838.  
  1839. UnOwnAllDoors.DoClick = function() LocalPlayer():ConCommand("say /unownalldoors") end
  1840.  
  1841. UnOwnAllDoors:SetSize( buttonw, buttonh )
  1842.  
  1843. UnOwnAllDoors:SetImage( "icon16/table_delete.png" )
  1844.  
  1845. ActionsPanel:AddItem( UnOwnAllDoors )
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851. Commands:SetContents(ActionsPanel)
  1852.  
  1853.  
  1854.  
  1855. //Blueprints category
  1856.  
  1857. local BlueprintsCat = vgui.Create("DCollapsibleCategory")
  1858.  
  1859. MakeCategoryNice( BlueprintsCat )
  1860.  
  1861. BlueprintsCat.bgcol = Color( 102,140,255 )
  1862.  
  1863. BlueprintsCat:SetLabel("Blueprints and Upgrades")
  1864.  
  1865.  
  1866.  
  1867. local ActionsPanel = vgui.Create("DPanelList")
  1868.  
  1869. ActionsPanel:SetSize(470, 200)
  1870.  
  1871. ActionsPanel:SetAutoSize(true)
  1872.  
  1873. ActionsPanel:SetSpacing(5)
  1874.  
  1875. ActionsPanel:SetPadding(5)
  1876.  
  1877. ActionsPanel:EnableHorizontal(true)
  1878.  
  1879. ActionsPanel:EnableVerticalScrollbar(false)
  1880.  
  1881.  
  1882.  
  1883. local buttonw, buttonh = 207, 40
  1884.  
  1885.  
  1886.  
  1887. local ViewBtn = MakeNiceButton(false)
  1888.  
  1889. ViewBtn:SetText( "View My Blueprints" )
  1890.  
  1891. ViewBtn.DoClick = function()
  1892.  
  1893. zm.OpenHiddenTab(zm.BlueprintsTab())
  1894.  
  1895.  
  1896.  
  1897. end
  1898.  
  1899. ViewBtn:SetSize( buttonw, buttonh )
  1900.  
  1901. ViewBtn:SetImage( "zarp/blueprint32.png" )
  1902.  
  1903. ActionsPanel:AddItem( ViewBtn )
  1904.  
  1905.  
  1906.  
  1907. local OtherBtn = MakeNiceButton()
  1908.  
  1909. OtherBtn:SetText( "Check Bank Vault Status" )
  1910.  
  1911. OtherBtn.DoClick = function()
  1912.  
  1913. zm.OpenHiddenTab(zm.VaultTab())
  1914.  
  1915. end
  1916.  
  1917. OtherBtn:SetSize( buttonw, buttonh )
  1918.  
  1919. OtherBtn:SetImage( "zarp/vault32.png" )
  1920.  
  1921. ActionsPanel:AddItem( OtherBtn )
  1922.  
  1923.  
  1924.  
  1925. local UpgradesBtn = MakeNiceButton(false)
  1926.  
  1927. UpgradesBtn:SetText("Character Upgrades")
  1928.  
  1929. UpgradesBtn.DoClick = function()
  1930.  
  1931. zm.OpenHiddenTab(zm.UpgradesTab())
  1932.  
  1933. end
  1934.  
  1935. UpgradesBtn:SetSize( buttonw, buttonh )
  1936.  
  1937. UpgradesBtn:SetImage( "zarp/zarp-characterupgradesicon.png" )
  1938.  
  1939. ActionsPanel:AddItem( UpgradesBtn )
  1940.  
  1941.  
  1942.  
  1943. local ObjectivesBtn = MakeNiceButton(false)
  1944.  
  1945. ObjectivesBtn:SetText("Daily Objectives")
  1946.  
  1947. ObjectivesBtn.DoClick = function()
  1948.  
  1949. zm.OpenHiddenTab(zm.DailyObjectivesTab())
  1950.  
  1951. end
  1952.  
  1953. ObjectivesBtn:SetSize( buttonw, buttonh )
  1954.  
  1955. ObjectivesBtn:SetImage( "zarp/zarp-dailyobjectives.png" )
  1956.  
  1957. ActionsPanel:AddItem( ObjectivesBtn )
  1958.  
  1959.  
  1960.  
  1961. local BankBtn = MakeNiceButton(false)
  1962.  
  1963. BankBtn:SetText("National Bank")
  1964.  
  1965. BankBtn.DoClick = function()
  1966.  
  1967. zm.OpenHiddenTab(zm.BankTab())
  1968.  
  1969. end
  1970.  
  1971. BankBtn:SetSize( buttonw, buttonh )
  1972.  
  1973. BankBtn:SetImage( "zarp/bank-logo32.png" )
  1974.  
  1975. ActionsPanel:AddItem( BankBtn )
  1976.  
  1977.  
  1978.  
  1979. -- local WheelBtn = MakeNiceButton(false,nil,Color(38,38,38),color_white)
  1980.  
  1981. -- WheelBtn:SetText("Black Friday Wheel")
  1982.  
  1983. -- WheelBtn.DoClick = function()
  1984.  
  1985. -- zm.OpenHiddenTab(zm.WheelOfZARPTab())
  1986.  
  1987. -- end
  1988.  
  1989. -- WheelBtn:SetSize( buttonw, buttonh )
  1990.  
  1991. -- WheelBtn:SetImage( "zarp/zarp-blackfridaywheelicon.png" )
  1992.  
  1993. -- ActionsPanel:AddItem( WheelBtn )
  1994.  
  1995.  
  1996.  
  1997. local AdventBtn = MakeNiceButton(false,"NEW",Color(255,51,51),color_white)
  1998.  
  1999. AdventBtn:SetText( "ZARP Advent Calendar" )
  2000.  
  2001. AdventBtn.DoClick = function()
  2002.  
  2003. zm.OpenHiddenTab(zm.ZARPAdventCalendarTab())
  2004.  
  2005. end
  2006.  
  2007. AdventBtn:SetSize( buttonw, buttonh )
  2008.  
  2009. AdventBtn:SetImage( "zarp/zarp-adventcalendaricon.png" )
  2010.  
  2011. ActionsPanel:AddItem( AdventBtn )
  2012.  
  2013.  
  2014.  
  2015. BlueprintsCat:SetContents(ActionsPanel)
  2016.  
  2017.  
  2018.  
  2019. //Market category
  2020.  
  2021. local MarketCat = vgui.Create("DCollapsibleCategory")
  2022.  
  2023. MakeCategoryNice( MarketCat )
  2024.  
  2025. MarketCat.bgcol = Color(255, 75, 15, 200)
  2026.  
  2027. MarketCat:SetLabel("Shops and Events")
  2028.  
  2029.  
  2030.  
  2031. local ActionsPanel = vgui.Create("DPanelList")
  2032.  
  2033. ActionsPanel:SetSize(470, 200)
  2034.  
  2035. ActionsPanel:SetAutoSize(true)
  2036.  
  2037. ActionsPanel:SetSpacing(5)
  2038.  
  2039. ActionsPanel:SetPadding(5)
  2040.  
  2041. ActionsPanel:EnableHorizontal(true)
  2042.  
  2043. ActionsPanel:EnableVerticalScrollbar(false)
  2044.  
  2045.  
  2046.  
  2047. MarketCat:SetContents(ActionsPanel)
  2048.  
  2049.  
  2050.  
  2051. local ViewBtn = MakeNiceButton()
  2052.  
  2053. ViewBtn:SetText( "View All Shops" )
  2054.  
  2055. ViewBtn.DoClick = function()
  2056.  
  2057. zm.OpenHiddenTab(zm.ShopListTab())
  2058.  
  2059. end
  2060.  
  2061. ViewBtn:SetSize( buttonw, buttonh )
  2062.  
  2063. ViewBtn:SetImage( "zarp/zarp-shopslisticon.png" )
  2064.  
  2065. ActionsPanel:AddItem( ViewBtn )
  2066.  
  2067.  
  2068.  
  2069. local AuctionHouseBtn = MakeNiceButton()
  2070.  
  2071. AuctionHouseBtn:SetText( "Auction House" )
  2072.  
  2073. AuctionHouseBtn.DoClick = function()
  2074.  
  2075. zm.OpenHiddenTab(zm.AuctionHouseTab())
  2076.  
  2077. end
  2078.  
  2079. AuctionHouseBtn:SetSize( buttonw, buttonh )
  2080.  
  2081. AuctionHouseBtn:SetImage( "zarp/zarp-auctionhouseicon.png" )
  2082.  
  2083. ActionsPanel:AddItem( AuctionHouseBtn )
  2084.  
  2085.  
  2086.  
  2087. actionpanel:AddItem(MoneyCat)
  2088.  
  2089. actionpanel:AddItem(BlueprintsCat)
  2090.  
  2091. actionpanel:AddItem(MarketCat)
  2092.  
  2093. actionpanel:AddItem(Commands)
  2094.  
  2095.  
  2096.  
  2097. if LocalPlayer():Team() == TEAM_MAYOR then
  2098.  
  2099. actionpanel:AddItem(MayorOptns())
  2100.  
  2101. elseif LocalPlayer():Team() == TEAM_CITIZEN then
  2102.  
  2103. --actionpanel:AddItem(CitOptns())
  2104.  
  2105. elseif LocalPlayer():IsCP() then
  2106.  
  2107. actionpanel:AddItem(CPOptns())
  2108.  
  2109. elseif LocalPlayer():Team() == TEAM_MOB then
  2110.  
  2111. actionpanel:AddItem(MobOptns())
  2112.  
  2113. elseif LocalPlayer():Team() == TEAM_HITMAN then
  2114.  
  2115. actionpanel:AddItem(HitOpts())
  2116.  
  2117. end
  2118.  
  2119. end
  2120.  
  2121. actionpanel:Update()
  2122.  
  2123. function actionframe:Update() actionpanel:Update() end
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129. local infoframe = vgui.Create( "DPanel", mainframe )
  2130.  
  2131. infoframe:SetSize( zm.content_w / 2 - 5, zm.content_h )
  2132.  
  2133. infoframe:SetPos( zm.content_w / 2 + 5, 5 )
  2134.  
  2135. function infoframe:Paint() end
  2136.  
  2137.  
  2138.  
  2139. local namepart = vgui.Create( "DPanel", infoframe )
  2140.  
  2141. namepart:SetSize( zm.content_w / 2 - 5, 60 )
  2142.  
  2143. namepart.bgcol = Color( 0,0,0,0 )
  2144.  
  2145.  
  2146.  
  2147. function namepart:Paint()
  2148.  
  2149. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), namepart.bgcol )
  2150.  
  2151. end
  2152.  
  2153.  
  2154.  
  2155. local namelabel = vgui.Create( "DLabel", namepart )
  2156.  
  2157. namelabel:SetFont( "HUDNumber4" )
  2158.  
  2159. namelabel:SetPos( 5, 5 )
  2160.  
  2161. namelabel:SetTextColor( Color( 255, 255, 255, 255 ) )
  2162.  
  2163.  
  2164.  
  2165. local joblabel = vgui.Create( "DLabel", namepart )
  2166.  
  2167. joblabel:SetFont( "Tre24" )
  2168.  
  2169. joblabel:SetPos( 6.5, 30 )
  2170.  
  2171. joblabel:SetTextColor( Color( 255, 255, 255, 255 ) )
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177. local jobsinfod = vgui.Create("DPanel", infoframe )
  2178.  
  2179. jobsinfod:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
  2180.  
  2181. jobsinfod:SetSize( zm.content_w / 2 - 5, 150 )
  2182.  
  2183. jobsinfod:SetPos( 0, 65 )
  2184.  
  2185.  
  2186.  
  2187. local jobsinfodesc = vgui.Create("DTextEntry", jobsinfod)
  2188.  
  2189. --jobsinfot:SetFont( "Tre24" )
  2190.  
  2191. --jobsinfot:SetTextColor( Color( 255, 255, 255, 255 ) )
  2192.  
  2193. jobsinfodesc:SetPos( 1, 5 )
  2194.  
  2195. jobsinfodesc:SetText( "" )
  2196.  
  2197. jobsinfodesc:SetSize( zm.content_w / 2 - 75, 150 )
  2198.  
  2199. jobsinfodesc:SetFont( "JobDesc" )
  2200.  
  2201. --function jobsinfodesc:Paint() end
  2202.  
  2203. jobsinfodesc:AllowInput( false )
  2204.  
  2205. jobsinfodesc:SetMultiline( true )
  2206.  
  2207. jobsinfodesc:SetDrawBackground( false )
  2208.  
  2209. jobsinfodesc:SetDrawBorder( false )
  2210.  
  2211. jobsinfodesc:SetMouseInputEnabled( false )
  2212.  
  2213.  
  2214.  
  2215. if jobmodel and jobmodel:IsValid() then
  2216.  
  2217. jobmodel:Remove()
  2218.  
  2219. end
  2220.  
  2221. jobmodel = vgui.Create("DModelPanel", jobsinfod )
  2222.  
  2223. jobmodel:SetModel("")
  2224.  
  2225. jobmodel:SetSize(75,280)
  2226.  
  2227. jobmodel:SetAnimated(false)
  2228.  
  2229. jobmodel:SetFOV(30)
  2230.  
  2231. jobmodel:SetAnimSpeed(2)
  2232.  
  2233. jobmodel:SetPos( zm.content_w / 2 - 65, -75 )
  2234.  
  2235.  
  2236.  
  2237. function jobmodel:LayoutEntity()
  2238.  
  2239. self:RunAnimation()
  2240.  
  2241. end
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247. local function UpdateInfo( job )
  2248.  
  2249. if not job then
  2250.  
  2251. jobsinfod:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
  2252.  
  2253. jobsinfodesc:SetText("")
  2254.  
  2255. jobsinfodesc:SetVisible( false )
  2256.  
  2257. jobmodel:SetModel("")
  2258.  
  2259. return
  2260.  
  2261. end
  2262.  
  2263.  
  2264.  
  2265. joblabel:SetText( job.name )
  2266.  
  2267. joblabel:SizeToContents()
  2268.  
  2269.  
  2270.  
  2271. local desc = job.description
  2272.  
  2273. local model = LocalPlayer():GetModel()
  2274.  
  2275.  
  2276.  
  2277. jobsinfod:SetBackgroundColor( Color( 200, 200, 200, 255 ) )
  2278.  
  2279. jobsinfodesc:SetText( desc )
  2280.  
  2281. jobsinfodesc:SetVisible( true )
  2282.  
  2283.  
  2284.  
  2285. namepart.bgcol = Color( job.color.r / 2, job.color.g / 2, job.color.b / 2, 255 )
  2286.  
  2287.  
  2288.  
  2289. jobmodel:SetModel( model )
  2290.  
  2291. jobmodel:RunAnimation()
  2292.  
  2293. end
  2294.  
  2295. UpdateInfo( nil )
  2296.  
  2297.  
  2298.  
  2299. //ZARP Events Action panel
  2300.  
  2301. local ZARPEvents = vgui.Create( "DPanel", infoframe )
  2302.  
  2303. ZARPEvents:SetSize( zm.content_w / 2 - 5, 105 )
  2304.  
  2305. ZARPEvents:SetPos( 0, 150 + 70 )
  2306.  
  2307.  
  2308.  
  2309. local NoEvent
  2310.  
  2311. if !ZARP.CurrentEvent or !ZARP.CurrentEvent.EventStartsAt then NoEvent = true end
  2312.  
  2313. function ZARPEvents:Paint(w,h)
  2314.  
  2315. draw.RoundedBox( 4, 0, 0, w, h, Color(51,51,51,200) )
  2316.  
  2317. draw.DrawText("Next ZARP Event", "Tre24", 5, 5, color_white )
  2318.  
  2319. if NoEvent then
  2320.  
  2321. draw.DrawText("There is no scheduled event on this server.", "Tre22", 5, 30, color_white )
  2322.  
  2323. else
  2324.  
  2325. //Start progress bar
  2326.  
  2327. surface.SetDrawColor(Color(255,255,255,100))
  2328.  
  2329. surface.DrawRect( 74, 55, w - 79, 5 )
  2330.  
  2331.  
  2332.  
  2333. //Progress
  2334.  
  2335. local timeremaining = (ZARP.CurrentEvent.EventStartsAt - CurTime())
  2336.  
  2337. local pxtotime = (w - 79) / (60*ZARP.EventCooldownTime)
  2338.  
  2339.  
  2340.  
  2341. surface.SetDrawColor(Color(255,255,255,100))
  2342.  
  2343. surface.DrawRect( 74, 55, math.Clamp((w - 79) - (pxtotime * timeremaining),0,w - 79), 5 )
  2344.  
  2345.  
  2346.  
  2347. //Event icon
  2348.  
  2349. surface.SetMaterial(ZARP.CurrentEvent.Icon)
  2350.  
  2351. surface.SetDrawColor(color_white)
  2352.  
  2353. surface.DrawTexturedRect(5,35,64,64)
  2354.  
  2355.  
  2356.  
  2357. //Event subtitle
  2358.  
  2359. draw.DrawText(string.format("%s event on %s",ZARP.CurrentEvent.Name,ZARP.CurrentEvent.EventArena[1]), "Tre20", 74, 35, color_white )
  2360.  
  2361.  
  2362.  
  2363. //Time until
  2364.  
  2365. local timestr = string.FormattedTime(math.Clamp(timeremaining,0,ZARP.CurrentEvent.EventStartsAt),"%02i:%02i")
  2366.  
  2367. surface.SetFont("Tre24")
  2368.  
  2369. local w,h = surface.GetTextSize((timeremaining > 0) and timestr or "In progress...")
  2370.  
  2371. draw.DrawText( (timeremaining > 0) and timestr or "In progress...", "Tre24", 74, 65, color_white )
  2372.  
  2373.  
  2374.  
  2375. if (timeremaining > 0) then
  2376.  
  2377. //Cash prize
  2378.  
  2379. surface.SetMaterial(ZARP.EventCashIcon)
  2380.  
  2381. surface.SetDrawColor(color_white)
  2382.  
  2383. surface.DrawTexturedRect( 79 + w,65, 22,22 )
  2384.  
  2385. surface.SetFont("Tre22")
  2386.  
  2387. local nw,nh = surface.GetTextSize("+$"..string.Comma(ZARP.CurrentEvent.CashPrize))
  2388.  
  2389. draw.DrawText("+$"..string.Comma(ZARP.CurrentEvent.CashPrize), "Tre22", 103 + w, 65, color_white )
  2390.  
  2391.  
  2392.  
  2393. //Item prize
  2394.  
  2395. if ZARP.CurrentEvent.ItemPrize then
  2396.  
  2397. surface.SetMaterial(ZARP.EventItemIcon)
  2398.  
  2399. surface.SetDrawColor(color_white)
  2400.  
  2401. surface.DrawTexturedRect( (108 + w) + nw,65, 22,22 )
  2402.  
  2403. local itemname = LDRP_SH.NicerWepNames[ZARP.CurrentEvent.ItemPrize] or LDRP_SH.AllItems[ZARP.CurrentEvent.ItemPrize].nicename or ZARP.CurrentEvent.ItemPrize
  2404.  
  2405. draw.DrawText("+"..itemname, "Tre22", (132 + w) + nw, 65, color_white )
  2406.  
  2407. end
  2408.  
  2409. end
  2410.  
  2411. end
  2412.  
  2413. end
  2414.  
  2415.  
  2416.  
  2417. //Weapons info
  2418.  
  2419. local weaponpart = vgui.Create( "DPanel", infoframe )
  2420.  
  2421. weaponpart:SetSize( zm.content_w / 2 - 5, 190 )
  2422.  
  2423. weaponpart.bgcol = Color( 150,150,150,255 )
  2424.  
  2425. weaponpart:SetPos( 0, 260 + 70 )
  2426.  
  2427.  
  2428.  
  2429. function weaponpart:Paint()
  2430.  
  2431. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), weaponpart.bgcol )
  2432.  
  2433. end
  2434.  
  2435.  
  2436.  
  2437. local weaponlabel = vgui.Create( "DLabel", weaponpart )
  2438.  
  2439. weaponlabel:SetFont( "Tre24" )
  2440.  
  2441. weaponlabel:SetPos( 5, 5 )
  2442.  
  2443. weaponlabel:SetTextColor( Color( 255, 255, 255, 255 ) )
  2444.  
  2445. weaponlabel:SetText( "Weapons" )
  2446.  
  2447. weaponlabel:SizeToContents()
  2448.  
  2449.  
  2450.  
  2451. local weaponlist = vgui.Create( "DPanelList", weaponpart )
  2452.  
  2453. weaponlist:SetSize( zm.content_w / 2 - 10, 145 )
  2454.  
  2455. weaponlist:SetPos( 5, 35 )
  2456.  
  2457. --weaponlist:SetAutoSize( true )
  2458.  
  2459. weaponlist:EnableHorizontal( true )
  2460.  
  2461. weaponlist:EnableVerticalScrollbar( true )
  2462.  
  2463. weaponlist:SetPadding( 0 )
  2464.  
  2465. weaponlist:SetSpacing( 5 )
  2466.  
  2467.  
  2468.  
  2469. local blacklist = { "weapon_physcannon",
  2470.  
  2471. "gmod_camera",
  2472.  
  2473. "gmod_tool",
  2474.  
  2475. "weapon_keypadchecker",
  2476.  
  2477. "weapon_physgun",
  2478.  
  2479. "keys"}
  2480.  
  2481.  
  2482.  
  2483. local oldcount = 0
  2484.  
  2485. local function UpdateWeaponInfo(force)
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491. local weps = LocalPlayer():GetWeapons()
  2492.  
  2493.  
  2494.  
  2495. if not force then
  2496.  
  2497. local c = table.Count( weps )
  2498.  
  2499. if c == oldcount then return end
  2500.  
  2501. oldcount = c
  2502.  
  2503. end
  2504.  
  2505.  
  2506.  
  2507. weaponlist:Clear()
  2508.  
  2509.  
  2510.  
  2511. for k, v in pairs( weps ) do
  2512.  
  2513. if not table.HasValue( blacklist, v:GetClass() ) then
  2514.  
  2515.  
  2516.  
  2517. local pan = vgui.Create( "DButton" )
  2518.  
  2519. pan:SetSize( 140, 40 )
  2520.  
  2521. pan.drawcol = Color( 200, 200, 200, 255 )
  2522.  
  2523. function pan:Paint()
  2524.  
  2525. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.drawcol )
  2526.  
  2527. end
  2528.  
  2529. pan:SetMouseInputEnabled( true )
  2530.  
  2531. pan:SetText( "" )
  2532.  
  2533.  
  2534.  
  2535. function pan:OnCursorEntered()
  2536.  
  2537. self.hover = true
  2538.  
  2539. self.drawcol = Color( 225, 225, 225, 255 )
  2540.  
  2541. end
  2542.  
  2543.  
  2544.  
  2545. function pan:OnCursorExited()
  2546.  
  2547. self.hover = false
  2548.  
  2549. self.drawcol = Color( 200, 200, 200, 255 )
  2550.  
  2551. end
  2552.  
  2553.  
  2554.  
  2555. local cl = v:GetClass()
  2556.  
  2557.  
  2558.  
  2559. pan.DoClick = function()
  2560.  
  2561. local menu = DermaMenu()
  2562.  
  2563. menu:AddOption("Equip", function() RunConsoleCommand( "use", cl ) end)
  2564.  
  2565. menu:AddOption("Drop", function() RunConsoleCommand( "use", cl ) RunConsoleCommand( "say", "/drop" ) end)
  2566.  
  2567.  
  2568.  
  2569. local ammo = ""
  2570.  
  2571.  
  2572.  
  2573. local t = v:GetPrimaryAmmoType()
  2574.  
  2575.  
  2576.  
  2577. if t == 7 then
  2578.  
  2579. ammo = "shotgun ammo"
  2580.  
  2581. elseif t == 3 then
  2582.  
  2583. ammo = "pistol ammo"
  2584.  
  2585. elseif t == 4 then
  2586.  
  2587. ammo = "rifle ammo"
  2588.  
  2589. end
  2590.  
  2591.  
  2592.  
  2593. if ammo ~= "" then
  2594.  
  2595. menu:AddOption("Buy Ammunition", function() RunConsoleCommand( "say", "/buyammo " .. ammo ) end)
  2596.  
  2597. end
  2598.  
  2599.  
  2600.  
  2601. menu:Open()
  2602.  
  2603. end
  2604.  
  2605.  
  2606.  
  2607. local icon = vgui.Create("SpawnIcon",pan)
  2608.  
  2609. icon:InvalidateLayout( true )
  2610.  
  2611. icon:SetSize(32, 32)
  2612.  
  2613. icon:SetToolTip( desc )
  2614.  
  2615. icon:SetPos( 4, -2 )
  2616.  
  2617. icon:SetModel( v:GetModel() )
  2618.  
  2619. icon:SetTooltip( v:GetPrintName() )
  2620.  
  2621. icon:SetMouseInputEnabled( false )
  2622.  
  2623.  
  2624.  
  2625. local label = vgui.Create("DLabel", pan)
  2626.  
  2627. label:SetText( v:GetPrintName() )
  2628.  
  2629. label:SizeToContents()
  2630.  
  2631. label:SetPos( 35, 0 )
  2632.  
  2633. label:CenterVertical()
  2634.  
  2635. label:SetTextColor( Color(0,0,0,255))
  2636.  
  2637. label:SetMouseInputEnabled( false )
  2638.  
  2639.  
  2640.  
  2641. weaponlist:AddItem(pan)
  2642.  
  2643. end
  2644.  
  2645. end
  2646.  
  2647. end
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653. function infoframe:Update()
  2654.  
  2655. namelabel:SetText( LocalPlayer():Nick() )
  2656.  
  2657. namelabel:SizeToContents()
  2658.  
  2659.  
  2660.  
  2661. UpdateInfo( RPExtraTeams[ LocalPlayer():Team() ] )
  2662.  
  2663. UpdateWeaponInfo(true)
  2664.  
  2665. end
  2666.  
  2667.  
  2668.  
  2669. timer.Create( "UpdateWeapons", 0.25, -1, function() if zm.IsOpen() then UpdateWeaponInfo() end end )
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675. function mainframe:Update() actionframe:Update() infoframe:Update() end
  2676.  
  2677. mainframe:Update()
  2678.  
  2679. return mainframe
  2680.  
  2681. end
  2682.  
  2683.  
  2684.  
  2685. //Gangs Tab
  2686.  
  2687. function zm.GangsTab()
  2688.  
  2689. //Top bar
  2690.  
  2691. local PlayerHasGang = LocalPlayer().DarkRPVars.gang_name and not (LocalPlayer().DarkRPVars.gang_name == "") and true or false
  2692.  
  2693. local catcolor = ZARP.GangInfo and ZARP.GangInfo.Color or team.GetColor(TEAM_GANG)
  2694.  
  2695. local BackGround = vgui.Create("DPanel")
  2696.  
  2697. local msg
  2698.  
  2699. //BackGround:SetSize(890,45)
  2700.  
  2701. BackGround.Paint = function(s,w,h)
  2702.  
  2703. if msg then draw.SimpleTextOutlined(msg,"Trebuchet24",w*.5,74,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) ) end
  2704.  
  2705. end
  2706.  
  2707.  
  2708.  
  2709. local TopBarLayout = vgui.Create( "DIconLayout", BackGround )
  2710.  
  2711. TopBarLayout:SetSize(890,45)
  2712.  
  2713. TopBarLayout.Paint = function(s,w,h)
  2714.  
  2715. draw.RoundedBox( 4, 0, 0, w, h, Color( 55, 100, 5,200 ))
  2716.  
  2717. end
  2718.  
  2719. //TopBarLayout:SetSpaceY(2)
  2720.  
  2721. TopBarLayout:SetSpaceX(-2)
  2722.  
  2723.  
  2724.  
  2725. local function AddGangInfoIcon(pnl, text, icon, steamid, textcolor)
  2726.  
  2727. local infopanel = pnl:Add("DPanel")
  2728.  
  2729. infopanel:SetDrawBackground(false)
  2730.  
  2731. if icon then
  2732.  
  2733. local img = vgui.Create("DImage", infopanel)
  2734.  
  2735. img:SetImage(icon)
  2736.  
  2737. img:SetSize(20,20)
  2738.  
  2739. img:SetPos(2,2)
  2740.  
  2741. elseif steamid then
  2742.  
  2743. local ownerid = util.SteamIDTo64( steamid )
  2744.  
  2745. local avatar = vgui.Create("AvatarImage",infopanel)
  2746.  
  2747. local btn = vgui.Create("DButton",avatar)
  2748.  
  2749. btn.DoClick = function()
  2750.  
  2751. gui.OpenURL(string.format("http://steamcommunity.com/profiles/%s",ownerid))
  2752.  
  2753. end
  2754.  
  2755. btn:SetSize(20,20)
  2756.  
  2757. btn:SetDrawBorder( false )
  2758.  
  2759. btn:SetDrawBackground( false )
  2760.  
  2761. btn:SetKeyboardInputEnabled( false )
  2762.  
  2763. btn:SetText( "" )
  2764.  
  2765. avatar:SetPos(2,2)
  2766.  
  2767. avatar:SetSize(20,20)
  2768.  
  2769. avatar:SetSteamID(ownerid, 32)
  2770.  
  2771. end
  2772.  
  2773. local lbl = vgui.Create("DLabel",infopanel)
  2774.  
  2775. lbl:SetFont("Tre22")
  2776.  
  2777. if textcolor then lbl:SetColor(textcolor) end
  2778.  
  2779. lbl:SetPos((icon or steamid) and 25 or 2,0)
  2780.  
  2781. lbl:SetText(text)
  2782.  
  2783. lbl:SizeToContents()
  2784.  
  2785.  
  2786.  
  2787. infopanel:SetSize(25 + lbl:GetWide(), 24)
  2788.  
  2789. end
  2790.  
  2791.  
  2792.  
  2793. local GangTabs = {}
  2794.  
  2795. local function ChangeGangTab(tab)
  2796.  
  2797. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  2798.  
  2799. msg = nil
  2800.  
  2801. BackGround.CurrentTab = GangTabs[tab].func()
  2802.  
  2803.  
  2804.  
  2805. for k,v in pairs(GangTabs) do
  2806.  
  2807. v.button.IsSelected = false
  2808.  
  2809. end
  2810.  
  2811. GangTabs[tab].button.IsSelected = true
  2812.  
  2813. end
  2814.  
  2815.  
  2816.  
  2817. local function OpenGangDialog()
  2818.  
  2819. //Gang dialog
  2820.  
  2821. local fcol = Color( 30, 30, 30 )
  2822.  
  2823. if PlayerHasGang then fcol = catcolor end
  2824.  
  2825. local NewGangModal = vgui.Create("DFrame")
  2826.  
  2827. NewGangModal:SetSize(450, 360)
  2828.  
  2829. NewGangModal:Center()
  2830.  
  2831. NewGangModal:SetVisible( true )
  2832.  
  2833. NewGangModal:MakePopup( )
  2834.  
  2835. NewGangModal:DoModal( )
  2836.  
  2837. NewGangModal:SetSkin("DarkRP")
  2838.  
  2839. if PlayerHasGang then
  2840.  
  2841. NewGangModal:SetTitle("Edit gang settings for " .. LocalPlayer().DarkRPVars.gang_name)
  2842.  
  2843. else
  2844.  
  2845. NewGangModal:SetTitle("Create New Gang")
  2846.  
  2847. end
  2848.  
  2849. NewGangModal.Paint = function()
  2850.  
  2851. draw.RoundedBox( 8, 0, 0, NewGangModal:GetWide(), NewGangModal:GetTall(), fcol )
  2852.  
  2853. end
  2854.  
  2855. local GPanel = vgui.Create( "DListLayout", NewGangModal)
  2856.  
  2857. GPanel:SetSize(440, 350)
  2858.  
  2859. GPanel:SetPos(5, 25)
  2860.  
  2861.  
  2862.  
  2863. local namelbl = GPanel:Add("DLabel")
  2864.  
  2865. namelbl:SetText("Name your new DarkRP Gang:")
  2866.  
  2867.  
  2868.  
  2869. local nametxt = GPanel:Add("DTextEntry")
  2870.  
  2871. if PlayerHasGang then nametxt:SetText(LocalPlayer().DarkRPVars.gang_name)
  2872.  
  2873. else nametxt:SetText(LocalPlayer():Nick() .. "s Gang")
  2874.  
  2875. end
  2876.  
  2877.  
  2878.  
  2879. local feelbl = GPanel:Add("DLabel")
  2880.  
  2881. feelbl:SetText("Choose Join Fee $(New members will pay this fee to you).")
  2882.  
  2883.  
  2884.  
  2885. local fee = GPanel:Add("DNumberWang")
  2886.  
  2887. fee:SetDecimals(0)
  2888.  
  2889. fee:SetMinMax(0,100000)
  2890.  
  2891. fee:SetWidth(50)
  2892.  
  2893. if PlayerHasGang then fee:SetValue(ZARP.GangInfo.Fee or 0) end
  2894.  
  2895.  
  2896.  
  2897. local collbl = GPanel:Add("DLabel")
  2898.  
  2899. collbl:SetText("Choose your gang color.")
  2900.  
  2901.  
  2902.  
  2903. local colorsel = GPanel:Add("DColorPalette")
  2904.  
  2905. colorsel:SetButtonSize( 20 )
  2906.  
  2907. colorsel.DoClick = function( panel, color, x, y )
  2908.  
  2909. fcol = color
  2910.  
  2911. end
  2912.  
  2913. if PlayerHasGang then colorsel:SetColor(catcolor) end
  2914.  
  2915.  
  2916.  
  2917. local finish = GPanel:Add("DButton")
  2918.  
  2919. if PlayerHasGang then
  2920.  
  2921. finish:SetText("Edit gang settings.")
  2922.  
  2923. else
  2924.  
  2925. finish:SetText(string.format("Create this gang ($%s)",string.Comma(GAMEMODE.Config.gangcost or 0)))
  2926.  
  2927. end
  2928.  
  2929. finish.DoClick = function()
  2930.  
  2931. local namestr = string.Replace( nametxt:GetValue(), "*", "")
  2932.  
  2933. local cmdstr = namestr.."*"..tostring(fee:GetValue()).."*".. fcol.r.."*"..fcol.g.."*"..fcol.b
  2934.  
  2935. if PlayerHasGang then
  2936.  
  2937. LocalPlayer():ConCommand("say /editgang "..tostring(cmdstr))
  2938.  
  2939. else
  2940.  
  2941. LocalPlayer():ConCommand("say /newgang "..tostring(cmdstr))
  2942.  
  2943. end
  2944.  
  2945. NewGangModal:Close()
  2946.  
  2947. ChangeGangTab(1)
  2948.  
  2949. end
  2950.  
  2951. end
  2952.  
  2953.  
  2954.  
  2955. //Tab buttons
  2956.  
  2957. local MyGangBtn = vgui.Create("DButton", TopBarLayout)
  2958.  
  2959. MyGangBtn:SetText("")
  2960.  
  2961. MyGangBtn:SetSize(200,45)
  2962.  
  2963. MyGangBtn.Paint = function(s,w,h)
  2964.  
  2965. draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
  2966.  
  2967. if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
  2968.  
  2969. surface.SetFont("Trebuchet24")
  2970.  
  2971. local tw,th = surface.GetTextSize("My Gang")
  2972.  
  2973. draw.SimpleTextOutlined("My Gang","Trebuchet24",(w / 2) - (tw / 2),(h / 2),Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  2974.  
  2975. end
  2976.  
  2977. MyGangBtn.DoClick = function() ChangeGangTab(1) end
  2978.  
  2979.  
  2980.  
  2981. local CreateGangBtn = vgui.Create("DButton", TopBarLayout)
  2982.  
  2983. CreateGangBtn:SetText("")
  2984.  
  2985. CreateGangBtn:SetSize(200,45)
  2986.  
  2987. CreateGangBtn.Paint = function(s,w,h)
  2988.  
  2989. draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
  2990.  
  2991. if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
  2992.  
  2993. surface.SetFont("Trebuchet24")
  2994.  
  2995. local tw,th = surface.GetTextSize("Create Gang")
  2996.  
  2997. draw.SimpleTextOutlined("Create Gang","Trebuchet24",(w / 2) - (tw / 2),(h / 2),Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  2998.  
  2999. if PlayerHasGang then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(100,100,100,240)) end
  3000.  
  3001. end
  3002.  
  3003. CreateGangBtn.DoClick = function() if not PlayerHasGang then OpenGangDialog() end end
  3004.  
  3005.  
  3006.  
  3007. local LeaderboardsBtn = vgui.Create("DButton", TopBarLayout)
  3008.  
  3009. LeaderboardsBtn:SetText("")
  3010.  
  3011. LeaderboardsBtn:SetSize(200,45)
  3012.  
  3013. LeaderboardsBtn.Paint = function(s,w,h)
  3014.  
  3015. draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
  3016.  
  3017. if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
  3018.  
  3019. surface.SetFont("Trebuchet24")
  3020.  
  3021. local tw,th = surface.GetTextSize("Leaderboards")
  3022.  
  3023. draw.SimpleTextOutlined("Leaderboards","Trebuchet24",(w / 2) - (tw / 2),(h / 2),Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3024.  
  3025. end
  3026.  
  3027. LeaderboardsBtn.DoClick = function() ChangeGangTab(3) end
  3028.  
  3029.  
  3030.  
  3031. local function LeaderboardsTab()
  3032.  
  3033. local function PopulateLeaderboards(len)
  3034.  
  3035. local gangcount = net.ReadUInt(16)
  3036.  
  3037. local gangs = {}
  3038.  
  3039. for i=1, gangcount do
  3040.  
  3041. table.insert(gangs, {Cash = net.ReadUInt(32), Fee = net.ReadUInt(32), GangColor = net.ReadColor(), MemberCount = net.ReadUInt(16), Name = net.ReadString(), OwnerName = net.ReadString(), SteamID = net.ReadString(), Upgrades = net.ReadUInt(16)})
  3042.  
  3043. end
  3044.  
  3045. local totalgangs = net.ReadUInt(16)
  3046.  
  3047. local page = net.ReadUInt(16)
  3048.  
  3049. local totalpages = math.max(math.ceil(totalgangs / 20),1)
  3050.  
  3051.  
  3052.  
  3053. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  3054.  
  3055. local ListPanel = vgui.Create("DPanel", BackGround)
  3056.  
  3057. ListPanel:SetDrawBackground(false)
  3058.  
  3059. ListPanel:SetPos(5,50)
  3060.  
  3061. ListPanel:SetSize(880,540)
  3062.  
  3063. BackGround.CurrentTab = ListPanel
  3064.  
  3065. local GangsList = vgui.Create("DScrollPanel", ListPanel)
  3066.  
  3067. GangsList:SetSize(880,445)
  3068.  
  3069. GangsList:SetPadding(15)
  3070.  
  3071.  
  3072.  
  3073. local GangIconMaterial = Material("zarp/zarp-gangicon.png")
  3074.  
  3075. for k,v in pairs(gangs) do
  3076.  
  3077. local Gang = vgui.Create("DPanel")
  3078.  
  3079. Gang:SetSize(880,70)
  3080.  
  3081. Gang.Paint = function(s,w,h)
  3082.  
  3083. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  3084.  
  3085. draw.RoundedBox(4,72,35,w - 77,30,Color(255,255,255,50)) -- Description background
  3086.  
  3087. draw.SimpleTextOutlined(v.Name,"Trebuchet24",72,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3088.  
  3089.  
  3090.  
  3091. surface.SetMaterial(GangIconMaterial)
  3092.  
  3093. surface.SetDrawColor(v.GangColor)
  3094.  
  3095. surface.DrawTexturedRect( 3, 3, 64, 64 )
  3096.  
  3097.  
  3098.  
  3099. if (page == 1) then
  3100.  
  3101. draw.RoundedBox( 4, 0, 0, w, h, Color(51,51,51,50) )
  3102.  
  3103. draw.SimpleTextOutlined(k,"Trebuchet24",32,24,color_white,TEXT_ALIGN_CENTER,TEXT_ALIGN_LEFT, 2, Color(0,0,0,200) )
  3104.  
  3105. end
  3106.  
  3107. end
  3108.  
  3109.  
  3110.  
  3111. local InfoLayout = vgui.Create("DIconLayout",Gang)
  3112.  
  3113. InfoLayout:SetPos(77,38)
  3114.  
  3115. InfoLayout:SetSize(700, 24)
  3116.  
  3117.  
  3118.  
  3119. AddGangInfoIcon(InfoLayout,string.format("Owner: %s", v.OwnerName),nil,v.SteamID,color_white)
  3120.  
  3121. AddGangInfoIcon(InfoLayout,string.format("Upgrades: %s", v.Upgrades),"icon16/arrow_join.png",nil,color_white)
  3122.  
  3123. AddGangInfoIcon(InfoLayout,string.format("Cash $%s", string.Comma(v.Cash)),"icon16/money.png",nil,color_white)
  3124.  
  3125. AddGangInfoIcon(InfoLayout,string.format("Members: %s", v.MemberCount),"icon16/user_gray.png",nil,color_white)
  3126.  
  3127.  
  3128.  
  3129. local JoinBtn = vgui.Create("DButton",Gang)
  3130.  
  3131. JoinBtn:SetPos(750,4)
  3132.  
  3133. JoinBtn:SetSize(100,25)
  3134.  
  3135. JoinBtn:SetText("")
  3136.  
  3137. JoinBtn.Paint = function(s,w,h)
  3138.  
  3139. draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
  3140.  
  3141. if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
  3142.  
  3143. draw.SimpleTextOutlined("Apply to Join","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3144.  
  3145. if s:GetDisabled() then
  3146.  
  3147. surface.SetDrawColor(Color(100,100,100,240))
  3148.  
  3149. surface.DrawRect( 0,0,w,h )
  3150.  
  3151. end
  3152.  
  3153. end
  3154.  
  3155. JoinBtn.DoClick = function()
  3156.  
  3157. LocalPlayer():ConCommand("say /applytogang "..v.SteamID)
  3158.  
  3159. end
  3160.  
  3161. if (v.Fee > 0) then JoinBtn:SetDisabled(true) end
  3162.  
  3163.  
  3164.  
  3165. GangsList:AddItem(Gang)
  3166.  
  3167. Gang:Dock( TOP )
  3168.  
  3169. Gang:DockMargin( 4, 0, 0, 4 )
  3170.  
  3171. end
  3172.  
  3173.  
  3174.  
  3175. //Paging panel
  3176.  
  3177. local function ChangePage(page)
  3178.  
  3179. BackGround.CurrentTab:Remove()
  3180.  
  3181. msg = "Loading leaderboards..."
  3182.  
  3183. RunConsoleCommand("_requestGangLeaderboard", tostring(page))
  3184.  
  3185. end
  3186.  
  3187.  
  3188.  
  3189. local PagingLbl = vgui.Create("DLabel",ListPanel)
  3190.  
  3191. PagingLbl:SetFont("Trebuchet22")
  3192.  
  3193. PagingLbl:SetText(string.format("Page %s of %s (%s total gangs(s))",page,totalpages,totalgangs))
  3194.  
  3195. PagingLbl:SizeToContents()
  3196.  
  3197. PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
  3198.  
  3199.  
  3200.  
  3201. //Back
  3202.  
  3203. local BackBtn = vgui.Create("DButton",ListPanel)
  3204.  
  3205. BackBtn:SetPos(PagingLbl:GetPos() - 35,450)
  3206.  
  3207. BackBtn:SetSize(30,20)
  3208.  
  3209. BackBtn:SetText("")
  3210.  
  3211. BackBtn.Paint = function(s,w,h)
  3212.  
  3213. surface.SetDrawColor(Color(150,150,150,255))
  3214.  
  3215. surface.DrawRect( 0,0,w,h )
  3216.  
  3217. draw.SimpleTextOutlined("<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3218.  
  3219. if s:GetDisabled() then
  3220.  
  3221. surface.SetDrawColor(Color(100,100,100,240))
  3222.  
  3223. surface.DrawRect( 0,0,w,h )
  3224.  
  3225. end
  3226.  
  3227. end
  3228.  
  3229. BackBtn.DoClick = function()
  3230.  
  3231. ChangePage(page - 1)
  3232.  
  3233. end
  3234.  
  3235. if (page == 1) then BackBtn:SetDisabled(true) end
  3236.  
  3237.  
  3238.  
  3239. local BackAllBtn = vgui.Create("DButton",ListPanel)
  3240.  
  3241. BackAllBtn:SetPos(PagingLbl:GetPos() - 70,450)
  3242.  
  3243. BackAllBtn:SetSize(30,20)
  3244.  
  3245. BackAllBtn:SetText("")
  3246.  
  3247. BackAllBtn.Paint = function(s,w,h)
  3248.  
  3249. surface.SetDrawColor(Color(150,150,150,255))
  3250.  
  3251. surface.DrawRect( 0,0,w,h )
  3252.  
  3253. draw.SimpleTextOutlined("<<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3254.  
  3255. if s:GetDisabled() then
  3256.  
  3257. surface.SetDrawColor(Color(100,100,100,240))
  3258.  
  3259. surface.DrawRect( 0,0,w,h )
  3260.  
  3261. end
  3262.  
  3263. end
  3264.  
  3265. BackAllBtn.DoClick = function()
  3266.  
  3267. ChangePage(1)
  3268.  
  3269. end
  3270.  
  3271. if (page == 1) then BackAllBtn:SetDisabled(true) end
  3272.  
  3273. //Forward
  3274.  
  3275. local ForwardBtn = vgui.Create("DButton",ListPanel)
  3276.  
  3277. ForwardBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 5,450)
  3278.  
  3279. ForwardBtn:SetSize(30,20)
  3280.  
  3281. ForwardBtn:SetText("")
  3282.  
  3283. ForwardBtn.Paint = function(s,w,h)
  3284.  
  3285. surface.SetDrawColor(Color(150,150,150,255))
  3286.  
  3287. surface.DrawRect( 0,0,w,h )
  3288.  
  3289. draw.SimpleTextOutlined(">","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3290.  
  3291. if s:GetDisabled() then
  3292.  
  3293. surface.SetDrawColor(Color(100,100,100,240))
  3294.  
  3295. surface.DrawRect( 0,0,w,h )
  3296.  
  3297. end
  3298.  
  3299. end
  3300.  
  3301. ForwardBtn.DoClick = function()
  3302.  
  3303. ChangePage(page + 1)
  3304.  
  3305. end
  3306.  
  3307. if (page == totalpages) then ForwardBtn:SetDisabled(true) end
  3308.  
  3309.  
  3310.  
  3311. local ForwardAllBtn = vgui.Create("DButton",ListPanel)
  3312.  
  3313. ForwardAllBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 40,450)
  3314.  
  3315. ForwardAllBtn:SetSize(30,20)
  3316.  
  3317. ForwardAllBtn:SetText("")
  3318.  
  3319. ForwardAllBtn.Paint = function(s,w,h)
  3320.  
  3321. surface.SetDrawColor(Color(150,150,150,255))
  3322.  
  3323. surface.DrawRect( 0,0,w,h )
  3324.  
  3325. draw.SimpleTextOutlined(">>","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3326.  
  3327. if s:GetDisabled() then
  3328.  
  3329. surface.SetDrawColor(Color(100,100,100,240))
  3330.  
  3331. surface.DrawRect( 0,0,w,h )
  3332.  
  3333. end
  3334.  
  3335. end
  3336.  
  3337. ForwardAllBtn.DoClick = function()
  3338.  
  3339. ChangePage(totalpages)
  3340.  
  3341. end
  3342.  
  3343. if (page == totalpages) then ForwardAllBtn:SetDisabled(true) end
  3344.  
  3345. end
  3346.  
  3347.  
  3348.  
  3349. msg = "Loading leaderboards..."
  3350.  
  3351. RunConsoleCommand("_requestGangLeaderboard", 1)
  3352.  
  3353. net.Receive("Gang_Leaderboard", function(len)
  3354.  
  3355. if IsValid(BackGround) then PopulateLeaderboards(len) end
  3356.  
  3357. end)
  3358.  
  3359. end
  3360.  
  3361.  
  3362.  
  3363. local function MyGangTab()
  3364.  
  3365. local hordiv = vgui.Create("DHorizontalDivider",BackGround)
  3366.  
  3367. hordiv:SetLeftWidth(225)
  3368.  
  3369. hordiv:SetPos(5,50)
  3370.  
  3371. hordiv:SetSize(880,540)
  3372.  
  3373. local GangOptions
  3374.  
  3375. local Information
  3376.  
  3377.  
  3378.  
  3379. function hordiv:Update()
  3380.  
  3381. if GangOptions and GangOptions:IsValid() then
  3382.  
  3383. Panel:Remove()
  3384.  
  3385. end
  3386.  
  3387. GangOptions = vgui.Create( "DListLayout")
  3388.  
  3389. GangOptions:SetSize(225, 540)
  3390.  
  3391. GangOptions:DockPadding(0,5,0,5)
  3392.  
  3393. GangOptions.Paint = function(s,w,h)
  3394.  
  3395. if PlayerHasGang then draw.RoundedBox( 4, 0, 0, w, h, ZARP.GangInfo and ZARP.GangInfo.Color or team.GetColor(TEAM_GANG) ) end
  3396.  
  3397. end
  3398.  
  3399.  
  3400.  
  3401. local IsOwner = LocalPlayer().DarkRPVars.gang_owner and true or false
  3402.  
  3403. local IsOfficer = LocalPlayer().DarkRPVars.gang_officer and true or false
  3404.  
  3405. PlayerHasGang = LocalPlayer().DarkRPVars.gang_name and not (LocalPlayer().DarkRPVars.gang_name == "") and true or false
  3406.  
  3407. if (LocalPlayer().DarkRPVars.gang_name == "") then
  3408.  
  3409. ZARP.GangInfo = nil
  3410.  
  3411. end
  3412.  
  3413.  
  3414.  
  3415. if IsOwner or IsOfficer then
  3416.  
  3417. local Create = GangOptions:Add(MakeNiceButton(true))
  3418.  
  3419. Create:SetImage( "icon16/add.png" )
  3420.  
  3421. Create:SetText("Edit your gang settings.")
  3422.  
  3423. Create.DoClick = function()
  3424.  
  3425. if not ZARP.GangInfo then return end
  3426.  
  3427. OpenGangDialog() end
  3428.  
  3429. end
  3430.  
  3431.  
  3432.  
  3433. if IsOwner or IsOfficer then
  3434.  
  3435. local SendInvite = GangOptions:Add(MakeNiceButton(true))
  3436.  
  3437. SendInvite:SetImage( "icon16/user_go.png" )
  3438.  
  3439. SendInvite:SetText("Send an invite to join your gang.")
  3440.  
  3441. SendInvite.DoClick = function()
  3442.  
  3443. local menu = DermaMenu()
  3444.  
  3445. local notfound = true
  3446.  
  3447. for _,ply in pairs(player.GetAll()) do
  3448.  
  3449. if ply ~= LocalPlayer() and ply.DarkRPVars and ply.DarkRPVars.gang_name != LocalPlayer().DarkRPVars.gang_name then
  3450.  
  3451. local text = ply.DarkRPVars.gang_name and ply:Nick().."IN GANG ("..ply.DarkRPVars.gang_name..")" or ply:Nick()
  3452.  
  3453. menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("say /invitegang ".. tostring(ply:SteamID())) end)
  3454.  
  3455. notfound = false
  3456.  
  3457. end
  3458.  
  3459. end
  3460.  
  3461. if notfound then
  3462.  
  3463. menu:AddOption("Nobody Found", function() end)
  3464.  
  3465. end
  3466.  
  3467. menu:Open()
  3468.  
  3469. end
  3470.  
  3471. end
  3472.  
  3473.  
  3474.  
  3475. local function ShowManageGangList(len, onlineonly)
  3476.  
  3477. local members = {}
  3478.  
  3479. local page
  3480.  
  3481. local totalpages = math.ceil(ZARP.GangInfo.MemberCount / 20)
  3482.  
  3483. local totalmembers = ZARP.GangInfo.MemberCount
  3484.  
  3485. if not onlineonly then
  3486.  
  3487. local membercount = net.ReadUInt(16)
  3488.  
  3489.  
  3490.  
  3491. for i=1, membercount do
  3492.  
  3493. table.insert(members, {Name = net.ReadString(), RankType = net.ReadUInt(4), SteamID = net.ReadString()})
  3494.  
  3495. end
  3496.  
  3497. page = net.ReadUInt(16)
  3498.  
  3499. else members = ZARP.RetrieveOnlineGangMembers(LocalPlayer():getDarkRPVar("gang_name")) end
  3500.  
  3501. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  3502.  
  3503. local ListPanel = vgui.Create("DPanel", BackGround)
  3504.  
  3505. ListPanel:SetDrawBackground(false)
  3506.  
  3507. ListPanel:SetPos(5,50)
  3508.  
  3509. ListPanel:SetSize(880,540)
  3510.  
  3511. BackGround.CurrentTab = ListPanel
  3512.  
  3513. local MembersList = vgui.Create("DScrollPanel", ListPanel)
  3514.  
  3515. MembersList:SetSize(880,445)
  3516.  
  3517. MembersList:SetPadding(15)
  3518.  
  3519.  
  3520.  
  3521. for k,v in pairs(members) do
  3522.  
  3523. local IsLocalPlayer = onlineonly and (v == LocalPlayer()) or (v.SteamID == LocalPlayer():SteamID())
  3524.  
  3525. local OnlinePlayer = len and player.GetBySteamID(v.SteamID) or onlineonly and v
  3526.  
  3527. local IsGangOwner = onlineonly and v:getDarkRPVar("gang_owner") or (v.RankType == 1)
  3528.  
  3529. local IsGangOfficer = onlineonly and v:getDarkRPVar("gang_officer") or (v.RankType == 2)
  3530.  
  3531. local Member = vgui.Create("DPanel")
  3532.  
  3533. Member:SetSize(880,36)
  3534.  
  3535. Member.Paint = function(s,w,h)
  3536.  
  3537. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  3538.  
  3539. draw.SimpleTextOutlined(onlineonly and v:Nick() or v.Name,"Trebuchet24",47,20,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3540.  
  3541. draw.SimpleTextOutlined(string.format("Rank: %s",IsGangOwner and "Owner" or IsGangOfficer and "Officer" or "Member"),"Trebuchet22",640,18,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3542.  
  3543. end
  3544.  
  3545.  
  3546.  
  3547. local avatar = vgui.Create("AvatarImage",Member)
  3548.  
  3549. local btn = vgui.Create("DButton",avatar)
  3550.  
  3551. btn.DoClick = function()
  3552.  
  3553. gui.OpenURL(string.format("http://steamcommunity.com/profiles/%s",
  3554.  
  3555. onlineonly and v:SteamID64() or util.SteamIDTo64(v.SteamID) ))
  3556.  
  3557. end
  3558.  
  3559. btn:SetSize(32,32)
  3560.  
  3561. btn:SetDrawBorder( false )
  3562.  
  3563. btn:SetDrawBackground( false )
  3564.  
  3565. btn:SetKeyboardInputEnabled( false )
  3566.  
  3567. btn:SetText( "" )
  3568.  
  3569. avatar:SetPos(8,2)
  3570.  
  3571. avatar:SetSize(32,32)
  3572.  
  3573. if onlineonly then avatar:SetPlayer(v)
  3574.  
  3575. else avatar:SetSteamID(util.SteamIDTo64(v.SteamID)) end
  3576.  
  3577.  
  3578.  
  3579. local RankIcon = vgui.Create("DImage", Member)
  3580.  
  3581. RankIcon:SetImage(IsGangOwner and "icon16/user_suit.png" or IsGangOfficer and "icon16/user_orange.png" or "icon16/user.png")
  3582.  
  3583. RankIcon:SetSize(20,20)
  3584.  
  3585. RankIcon:SetPos(615,8)
  3586.  
  3587.  
  3588.  
  3589. local ManageBtn = vgui.Create("DButton",Member)
  3590.  
  3591. ManageBtn:SetPos(770,2)
  3592.  
  3593. ManageBtn:SetSize(100,30)
  3594.  
  3595. ManageBtn:SetText("")
  3596.  
  3597. ManageBtn.Paint = function(s,w,h)
  3598.  
  3599. draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
  3600.  
  3601. draw.SimpleTextOutlined("Manage","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3602.  
  3603. if s:GetDisabled() then
  3604.  
  3605. surface.SetDrawColor(Color(100,100,100,240))
  3606.  
  3607. surface.DrawRect( 0,0,w,h )
  3608.  
  3609. end
  3610.  
  3611. end
  3612.  
  3613. ManageBtn.DoClick = function()
  3614.  
  3615. local menu = DermaMenu()
  3616.  
  3617. if IsGangOfficer then menu:AddOption("Demote to Member", function()
  3618.  
  3619. if OnlinePlayer then LocalPlayer():ConCommand("say /gangdemote ".. tostring(OnlinePlayer:SteamID())) else LocalPlayer():ConCommand("say /managegang demote ".. v.SteamID) end ChangeGangTab(1)
  3620.  
  3621. end)
  3622.  
  3623. else menu:AddOption("Promote to Officer", function() if OnlinePlayer then LocalPlayer():ConCommand("say /gangpromote ".. tostring(OnlinePlayer:SteamID())) else LocalPlayer():ConCommand("say /managegang promote ".. v.SteamID) end ChangeGangTab(1)end)
  3624.  
  3625. end
  3626.  
  3627. menu:AddOption("Kick", function() if OnlinePlayer then LocalPlayer():ConCommand("say /kickgang ".. tostring(OnlinePlayer:SteamID())) else LocalPlayer():ConCommand("say /managegang kick ".. v.SteamID) end ChangeGangTab(1) end)
  3628.  
  3629. menu:Open()
  3630.  
  3631. end
  3632.  
  3633. if IsLocalPlayer or IsGangOwner or (not IsOwner and not IsOfficer) then ManageBtn:SetDisabled(true) end
  3634.  
  3635.  
  3636.  
  3637. MembersList:AddItem(Member)
  3638.  
  3639. Member:Dock( TOP )
  3640.  
  3641. Member:DockMargin( 4, 0, 0, 4 )
  3642.  
  3643. end
  3644.  
  3645.  
  3646.  
  3647. //Paging panel
  3648.  
  3649. local function ChangePage(page)
  3650.  
  3651. BackGround.CurrentTab:Remove()
  3652.  
  3653. msg = "Loading members..."
  3654.  
  3655. RunConsoleCommand("_requestGangMembers", tostring(page))
  3656.  
  3657. end
  3658.  
  3659.  
  3660.  
  3661. local PagingLbl = vgui.Create("DLabel",ListPanel)
  3662.  
  3663. PagingLbl:SetFont("Trebuchet22")
  3664.  
  3665. if onlineonly then PagingLbl:SetText(string.format("%s online member(s).",#members))
  3666.  
  3667. else PagingLbl:SetText(string.format("Page %s of %s (%s total member(s))",page,totalpages,ZARP.GangInfo.MemberCount)) end
  3668.  
  3669. PagingLbl:SizeToContents()
  3670.  
  3671. PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
  3672.  
  3673.  
  3674.  
  3675. //Back
  3676.  
  3677. local BackBtn = vgui.Create("DButton",ListPanel)
  3678.  
  3679. BackBtn:SetPos(PagingLbl:GetPos() - 35,450)
  3680.  
  3681. BackBtn:SetSize(30,20)
  3682.  
  3683. BackBtn:SetText("")
  3684.  
  3685. BackBtn.Paint = function(s,w,h)
  3686.  
  3687. surface.SetDrawColor(Color(150,150,150,255))
  3688.  
  3689. surface.DrawRect( 0,0,w,h )
  3690.  
  3691. draw.SimpleTextOutlined("<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3692.  
  3693. if s:GetDisabled() then
  3694.  
  3695. surface.SetDrawColor(Color(100,100,100,240))
  3696.  
  3697. surface.DrawRect( 0,0,w,h )
  3698.  
  3699. end
  3700.  
  3701. end
  3702.  
  3703. BackBtn.DoClick = function()
  3704.  
  3705. RunConsoleCommand("_requestGangMembers", tostring(page - 1))
  3706.  
  3707. end
  3708.  
  3709. if onlineonly or (page == 1) then BackBtn:SetDisabled(true) end
  3710.  
  3711.  
  3712.  
  3713. local BackAllBtn = vgui.Create("DButton",ListPanel)
  3714.  
  3715. BackAllBtn:SetPos(PagingLbl:GetPos() - 70,450)
  3716.  
  3717. BackAllBtn:SetSize(30,20)
  3718.  
  3719. BackAllBtn:SetText("")
  3720.  
  3721. BackAllBtn.Paint = function(s,w,h)
  3722.  
  3723. surface.SetDrawColor(Color(150,150,150,255))
  3724.  
  3725. surface.DrawRect( 0,0,w,h )
  3726.  
  3727. draw.SimpleTextOutlined("<<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3728.  
  3729. if s:GetDisabled() then
  3730.  
  3731. surface.SetDrawColor(Color(100,100,100,240))
  3732.  
  3733. surface.DrawRect( 0,0,w,h )
  3734.  
  3735. end
  3736.  
  3737. end
  3738.  
  3739. BackAllBtn.DoClick = function()
  3740.  
  3741. RunConsoleCommand("_requestGangMembers", 1)
  3742.  
  3743. end
  3744.  
  3745. if onlineonly or (page == 1) then BackAllBtn:SetDisabled(true) end
  3746.  
  3747. //Forward
  3748.  
  3749. local ForwardBtn = vgui.Create("DButton",ListPanel)
  3750.  
  3751. ForwardBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 5,450)
  3752.  
  3753. ForwardBtn:SetSize(30,20)
  3754.  
  3755. ForwardBtn:SetText("")
  3756.  
  3757. ForwardBtn.Paint = function(s,w,h)
  3758.  
  3759. surface.SetDrawColor(Color(150,150,150,255))
  3760.  
  3761. surface.DrawRect( 0,0,w,h )
  3762.  
  3763. draw.SimpleTextOutlined(">","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3764.  
  3765. if s:GetDisabled() then
  3766.  
  3767. surface.SetDrawColor(Color(100,100,100,240))
  3768.  
  3769. surface.DrawRect( 0,0,w,h )
  3770.  
  3771. end
  3772.  
  3773. end
  3774.  
  3775. ForwardBtn.DoClick = function()
  3776.  
  3777. RunConsoleCommand("_requestGangMembers", tostring(page + 1))
  3778.  
  3779. end
  3780.  
  3781. if onlineonly or (page == totalpages) then ForwardBtn:SetDisabled(true) end
  3782.  
  3783.  
  3784.  
  3785. local ForwardAllBtn = vgui.Create("DButton",ListPanel)
  3786.  
  3787. ForwardAllBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 40,450)
  3788.  
  3789. ForwardAllBtn:SetSize(30,20)
  3790.  
  3791. ForwardAllBtn:SetText("")
  3792.  
  3793. ForwardAllBtn.Paint = function(s,w,h)
  3794.  
  3795. surface.SetDrawColor(Color(150,150,150,255))
  3796.  
  3797. surface.DrawRect( 0,0,w,h )
  3798.  
  3799. draw.SimpleTextOutlined(">>","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3800.  
  3801. if s:GetDisabled() then
  3802.  
  3803. surface.SetDrawColor(Color(100,100,100,240))
  3804.  
  3805. surface.DrawRect( 0,0,w,h )
  3806.  
  3807. end
  3808.  
  3809. end
  3810.  
  3811. ForwardAllBtn.DoClick = function()
  3812.  
  3813. RunConsoleCommand("_requestGangMembers", totalpages)
  3814.  
  3815. end
  3816.  
  3817. if onlineonly or (page == totalpages) then ForwardAllBtn:SetDisabled(true) end
  3818.  
  3819. end
  3820.  
  3821.  
  3822.  
  3823. local function ShowGangApplicationsList(len)
  3824.  
  3825. local applications = {}
  3826.  
  3827. local count = net.ReadUInt(16)
  3828.  
  3829.  
  3830.  
  3831. for i=1, count do
  3832.  
  3833. table.insert(applications, {Name = net.ReadString(), SteamID = net.ReadString()})
  3834.  
  3835. end
  3836.  
  3837. local page = net.ReadUInt(16)
  3838.  
  3839. local totalpages = math.max(math.ceil(ZARP.GangInfo.Applications / 20),1)
  3840.  
  3841. local totalapplications = ZARP.GangInfo.Applications
  3842.  
  3843. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  3844.  
  3845. local ListPanel = vgui.Create("DPanel", BackGround)
  3846.  
  3847. ListPanel:SetDrawBackground(false)
  3848.  
  3849. ListPanel:SetPos(5,50)
  3850.  
  3851. ListPanel:SetSize(880,540)
  3852.  
  3853. BackGround.CurrentTab = ListPanel
  3854.  
  3855. local ApplicationsList = vgui.Create("DScrollPanel", ListPanel)
  3856.  
  3857. ApplicationsList:SetSize(880,445)
  3858.  
  3859. ApplicationsList:SetPadding(15)
  3860.  
  3861.  
  3862.  
  3863. for k,v in pairs(applications) do
  3864.  
  3865. local IsLocalPlayer = onlineonly and (v == LocalPlayer()) or (v.SteamID == LocalPlayer():SteamID())
  3866.  
  3867. local OnlinePlayer = len and player.GetBySteamID(v.SteamID) or onlineonly and v
  3868.  
  3869. local IsGangOwner = onlineonly and v:getDarkRPVar("gang_owner") or (v.RankType == 1)
  3870.  
  3871. local IsGangOfficer = onlineonly and v:getDarkRPVar("gang_officer") or (v.RankType == 2)
  3872.  
  3873. local Application = vgui.Create("DPanel")
  3874.  
  3875. Application:SetSize(880,36)
  3876.  
  3877. Application.Paint = function(s,w,h)
  3878.  
  3879. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  3880.  
  3881. draw.SimpleTextOutlined(onlineonly and v:Nick() or v.Name,"Trebuchet24",47,20,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3882.  
  3883. end
  3884.  
  3885.  
  3886.  
  3887. local avatar = vgui.Create("AvatarImage",Application)
  3888.  
  3889. local btn = vgui.Create("DButton",avatar)
  3890.  
  3891. btn.DoClick = function()
  3892.  
  3893. gui.OpenURL(string.format("http://steamcommunity.com/profiles/%s",
  3894.  
  3895. onlineonly and v:SteamID64() or util.SteamIDTo64(v.SteamID) ))
  3896.  
  3897. end
  3898.  
  3899. btn:SetSize(32,32)
  3900.  
  3901. btn:SetDrawBorder( false )
  3902.  
  3903. btn:SetDrawBackground( false )
  3904.  
  3905. btn:SetKeyboardInputEnabled( false )
  3906.  
  3907. btn:SetText( "" )
  3908.  
  3909. avatar:SetPos(8,2)
  3910.  
  3911. avatar:SetSize(32,32)
  3912.  
  3913. if onlineonly then
  3914.  
  3915. avatar:SetPlayer(v)
  3916.  
  3917. else avatar:SetSteamID(v.SteamID) end
  3918.  
  3919.  
  3920.  
  3921. local AcceptBtn = vgui.Create("DButton",Application)
  3922.  
  3923. AcceptBtn:SetPos(665,2)
  3924.  
  3925. AcceptBtn:SetSize(100,30)
  3926.  
  3927. AcceptBtn:SetText("")
  3928.  
  3929. AcceptBtn.Paint = function(s,w,h)
  3930.  
  3931. draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
  3932.  
  3933. draw.SimpleTextOutlined("Accept","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3934.  
  3935. if s:GetDisabled() then
  3936.  
  3937. surface.SetDrawColor(Color(100,100,100,240))
  3938.  
  3939. surface.DrawRect( 0,0,w,h )
  3940.  
  3941. end
  3942.  
  3943. end
  3944.  
  3945. AcceptBtn.DoClick = function() LocalPlayer():ConCommand("say /managegang add "..v.SteamID) ChangeGangTab(1) end
  3946.  
  3947. if not IsOwner and not IsOfficer then AcceptBtn:SetDisabled(true) end
  3948.  
  3949.  
  3950.  
  3951. local IgnoreBtn = vgui.Create("DButton",Application)
  3952.  
  3953. IgnoreBtn:SetPos(770,2)
  3954.  
  3955. IgnoreBtn:SetSize(100,30)
  3956.  
  3957. IgnoreBtn:SetText("")
  3958.  
  3959. IgnoreBtn.Paint = function(s,w,h)
  3960.  
  3961. draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
  3962.  
  3963. draw.SimpleTextOutlined("Ignore","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  3964.  
  3965. if s:GetDisabled() then
  3966.  
  3967. surface.SetDrawColor(Color(100,100,100,240))
  3968.  
  3969. surface.DrawRect( 0,0,w,h )
  3970.  
  3971. end
  3972.  
  3973. end
  3974.  
  3975. IgnoreBtn.DoClick = function() LocalPlayer():ConCommand("say /managegang ignore "..v.SteamID) ChangeGangTab(1) end
  3976.  
  3977. if not IsOwner and not IsOfficer then IgnoreBtn:SetDisabled(true) end
  3978.  
  3979.  
  3980.  
  3981. ApplicationsList:AddItem(Application)
  3982.  
  3983. Application:Dock( TOP )
  3984.  
  3985. Application:DockMargin( 4, 0, 0, 4 )
  3986.  
  3987. end
  3988.  
  3989.  
  3990.  
  3991. //Paging panel
  3992.  
  3993. local function ChangePage(page)
  3994.  
  3995. BackGround.CurrentTab:Remove()
  3996.  
  3997. msg = "Loading applications..."
  3998.  
  3999. RunConsoleCommand("_requestGangApplications", tostring(page))
  4000.  
  4001. end
  4002.  
  4003.  
  4004.  
  4005. local PagingLbl = vgui.Create("DLabel",ListPanel)
  4006.  
  4007. PagingLbl:SetFont("Trebuchet22")
  4008.  
  4009. PagingLbl:SetText(string.format("Page %s of %s (%s total applications(s))",page,totalpages,totalapplications))
  4010.  
  4011. PagingLbl:SizeToContents()
  4012.  
  4013. PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
  4014.  
  4015.  
  4016.  
  4017. //Back
  4018.  
  4019. local BackBtn = vgui.Create("DButton",ListPanel)
  4020.  
  4021. BackBtn:SetPos(PagingLbl:GetPos() - 35,450)
  4022.  
  4023. BackBtn:SetSize(30,20)
  4024.  
  4025. BackBtn:SetText("")
  4026.  
  4027. BackBtn.Paint = function(s,w,h)
  4028.  
  4029. surface.SetDrawColor(Color(150,150,150,255))
  4030.  
  4031. surface.DrawRect( 0,0,w,h )
  4032.  
  4033. draw.SimpleTextOutlined("<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  4034.  
  4035. if s:GetDisabled() then
  4036.  
  4037. surface.SetDrawColor(Color(100,100,100,240))
  4038.  
  4039. surface.DrawRect( 0,0,w,h )
  4040.  
  4041. end
  4042.  
  4043. end
  4044.  
  4045. BackBtn.DoClick = function()
  4046.  
  4047. ChangePage(page - 1)
  4048.  
  4049. end
  4050.  
  4051. if onlineonly or (page == 1) then BackBtn:SetDisabled(true) end
  4052.  
  4053.  
  4054.  
  4055. local BackAllBtn = vgui.Create("DButton",ListPanel)
  4056.  
  4057. BackAllBtn:SetPos(PagingLbl:GetPos() - 70,450)
  4058.  
  4059. BackAllBtn:SetSize(30,20)
  4060.  
  4061. BackAllBtn:SetText("")
  4062.  
  4063. BackAllBtn.Paint = function(s,w,h)
  4064.  
  4065. surface.SetDrawColor(Color(150,150,150,255))
  4066.  
  4067. surface.DrawRect( 0,0,w,h )
  4068.  
  4069. draw.SimpleTextOutlined("<<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  4070.  
  4071. if s:GetDisabled() then
  4072.  
  4073. surface.SetDrawColor(Color(100,100,100,240))
  4074.  
  4075. surface.DrawRect( 0,0,w,h )
  4076.  
  4077. end
  4078.  
  4079. end
  4080.  
  4081. BackAllBtn.DoClick = function()
  4082.  
  4083. ChangePage(1)
  4084.  
  4085. end
  4086.  
  4087. if onlineonly or (page == 1) then BackAllBtn:SetDisabled(true) end
  4088.  
  4089. //Forward
  4090.  
  4091. local ForwardBtn = vgui.Create("DButton",ListPanel)
  4092.  
  4093. ForwardBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 5,450)
  4094.  
  4095. ForwardBtn:SetSize(30,20)
  4096.  
  4097. ForwardBtn:SetText("")
  4098.  
  4099. ForwardBtn.Paint = function(s,w,h)
  4100.  
  4101. surface.SetDrawColor(Color(150,150,150,255))
  4102.  
  4103. surface.DrawRect( 0,0,w,h )
  4104.  
  4105. draw.SimpleTextOutlined(">","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  4106.  
  4107. if s:GetDisabled() then
  4108.  
  4109. surface.SetDrawColor(Color(100,100,100,240))
  4110.  
  4111. surface.DrawRect( 0,0,w,h )
  4112.  
  4113. end
  4114.  
  4115. end
  4116.  
  4117. ForwardBtn.DoClick = function()
  4118.  
  4119. ChangePage(page + 1)
  4120.  
  4121. end
  4122.  
  4123. if onlineonly or (page == totalpages) then ForwardBtn:SetDisabled(true) end
  4124.  
  4125.  
  4126.  
  4127. local ForwardAllBtn = vgui.Create("DButton",ListPanel)
  4128.  
  4129. ForwardAllBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 40,450)
  4130.  
  4131. ForwardAllBtn:SetSize(30,20)
  4132.  
  4133. ForwardAllBtn:SetText("")
  4134.  
  4135. ForwardAllBtn.Paint = function(s,w,h)
  4136.  
  4137. surface.SetDrawColor(Color(150,150,150,255))
  4138.  
  4139. surface.DrawRect( 0,0,w,h )
  4140.  
  4141. draw.SimpleTextOutlined(">>","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  4142.  
  4143. if s:GetDisabled() then
  4144.  
  4145. surface.SetDrawColor(Color(100,100,100,240))
  4146.  
  4147. surface.DrawRect( 0,0,w,h )
  4148.  
  4149. end
  4150.  
  4151. end
  4152.  
  4153. ForwardAllBtn.DoClick = function()
  4154.  
  4155. ChangePage(totalpages)
  4156.  
  4157. end
  4158.  
  4159. if onlineonly or (page == totalpages) then ForwardAllBtn:SetDisabled(true) end
  4160.  
  4161. end
  4162.  
  4163. if PlayerHasGang then
  4164.  
  4165. local PendingInvites = GangOptions:Add(MakeNiceButton(true))
  4166.  
  4167. PendingInvites:SetImage( "icon16/email.png" )
  4168.  
  4169. PendingInvites:SetText("Review Pending Applications")
  4170.  
  4171. PendingInvites.DoClick = function()
  4172.  
  4173. if not ZARP.GangInfo then return end
  4174.  
  4175. BackGround.CurrentTab:Remove()
  4176.  
  4177. msg = "Loading applications..."
  4178.  
  4179. RunConsoleCommand("_requestGangApplications", 1)
  4180.  
  4181. end
  4182.  
  4183. net.Receive("Gang_Applications", function(len)
  4184.  
  4185. if IsValid(BackGround) then msg = nil ShowGangApplicationsList(len) end
  4186.  
  4187. end)
  4188.  
  4189.  
  4190.  
  4191. local ManageGang = GangOptions:Add(MakeNiceButton(true))
  4192.  
  4193. ManageGang:SetImage( "icon16/user_gray.png" )
  4194.  
  4195. ManageGang:SetText("Manage and Promote Members")
  4196.  
  4197. ManageGang.DoClick = function()
  4198.  
  4199. if not ZARP.GangInfo then return end
  4200.  
  4201. local menu = DermaMenu()
  4202.  
  4203. menu:AddOption("Online members", function() ShowManageGangList(nil, true) end)
  4204.  
  4205. menu:AddOption("All members", function()
  4206.  
  4207. BackGround.CurrentTab:Remove()
  4208.  
  4209. msg = "Loading members..."
  4210.  
  4211. RunConsoleCommand("_requestGangMembers", 1) end)
  4212.  
  4213. menu:Open()
  4214.  
  4215. end
  4216.  
  4217. net.Receive("Gang_List", function(len)
  4218.  
  4219. if IsValid(BackGround) then msg = nil ShowManageGangList(len) end
  4220.  
  4221. end)
  4222.  
  4223. local Leave = GangOptions:Add(MakeNiceButton(true))
  4224.  
  4225. Leave:SetImage( "icon16/delete.png" )
  4226.  
  4227. Leave:SetText("Leave this gang.")
  4228.  
  4229. Leave.DoClick = function()
  4230.  
  4231. if not LocalPlayer().DarkRPVars.gang_name then return end
  4232.  
  4233. Derma_Query("Are you sure you want to leave this gang (If you own this gang it will be destroyed)?", "Leave "..LocalPlayer().DarkRPVars.gang_name,
  4234.  
  4235. "Yes I want to leave", function() LocalPlayer():ConCommand("say /removegang") timer.Simple(1, function() if IsValid(BackGround) then ChangeGangTab(1) end end) end,
  4236.  
  4237. "Cancel", function() return end
  4238.  
  4239. )
  4240.  
  4241. end
  4242.  
  4243. end
  4244.  
  4245.  
  4246.  
  4247. if IsOwner then
  4248.  
  4249. local ChangeOwner = GangOptions:Add(MakeNiceButton(true))
  4250.  
  4251. ChangeOwner:SetImage( "icon16/user_edit.png" )
  4252.  
  4253. ChangeOwner:SetText("Change the owner of this gang.")
  4254.  
  4255. ChangeOwner.DoClick = function()
  4256.  
  4257. if not LocalPlayer().DarkRPVars.gang_name then return end
  4258.  
  4259. local gangname = LocalPlayer().DarkRPVars.gang_name
  4260.  
  4261. local menu = DermaMenu()
  4262.  
  4263. for _,ply in pairs(player.GetAll()) do
  4264.  
  4265. if ply ~= LocalPlayer() then
  4266.  
  4267. menu:AddOption(ply:Nick(), function()
  4268.  
  4269. Derma_Query(string.format("Are you sure you want to transfer %s to %s (%s)?",gangname,ply:Nick(),ply:SteamName()), "Change Gang Ownership",
  4270.  
  4271. "Yes I want to change the owner", function() LocalPlayer():ConCommand("say /changegang ".. tostring(ply:SteamID())) zm.Close() end,
  4272.  
  4273. "Cancel", function() return end
  4274.  
  4275. )
  4276.  
  4277. end)
  4278.  
  4279. end
  4280.  
  4281. end
  4282.  
  4283. menu:Open()
  4284.  
  4285. end
  4286.  
  4287. end
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293. if PlayerHasGang then
  4294.  
  4295. local Funds = GangOptions:Add(MakeNiceButton(true))
  4296.  
  4297. Funds:SetImage( "icon16/money_add.png" )
  4298.  
  4299. Funds:SetText("Add funds to the gang.")
  4300.  
  4301. Funds.DoClick = function()
  4302.  
  4303. Derma_StringRequest("Amount of money", "How much money do you want to add to the gang?", "", function(a) LocalPlayer():ConCommand("say /addgangfunds " .. tostring(a)) end)
  4304.  
  4305. end
  4306.  
  4307. end
  4308.  
  4309.  
  4310.  
  4311. if Information and Information:IsValid() then
  4312.  
  4313. Information:Remove()
  4314.  
  4315. end
  4316.  
  4317.  
  4318.  
  4319. function doGangInfoPanel()
  4320.  
  4321.  
  4322.  
  4323. if Information and Information:IsValid() then
  4324.  
  4325. Information:Remove()
  4326.  
  4327. end
  4328.  
  4329.  
  4330.  
  4331. Information = vgui.Create( "DPanel" )
  4332.  
  4333. Information:SetPos(378,0)
  4334.  
  4335. Information:SetSize(370, 540)
  4336.  
  4337. Information:SetDrawBackground(false)
  4338.  
  4339.  
  4340.  
  4341. local lblLeft = vgui.Create("DLabel",Information)
  4342.  
  4343. lblLeft:SetPos(5,0)
  4344.  
  4345. lblLeft:SetText(PlayerHasGang and LocalPlayer().DarkRPVars.gang_name or "No Gang")
  4346.  
  4347. lblLeft:SetFont("ZMenuHeader")
  4348.  
  4349. lblLeft:SizeToContents()
  4350.  
  4351.  
  4352.  
  4353. local GangInfoLayout = vgui.Create("DListLayout",Information)
  4354.  
  4355. GangInfoLayout:SetPos(5,35)
  4356.  
  4357. GangInfoLayout:SetWide(215)
  4358.  
  4359.  
  4360.  
  4361. local GangInfoLayoutRight
  4362.  
  4363. if ZARP.GangInfo then
  4364.  
  4365. GangInfoLayoutRight = vgui.Create("DListLayout",Information)
  4366.  
  4367. GangInfoLayoutRight:SetPos(235,35)
  4368.  
  4369. GangInfoLayoutRight:SetWide(315)
  4370.  
  4371. end
  4372.  
  4373.  
  4374.  
  4375. if ZARP.GangInfo then
  4376.  
  4377. AddGangInfoIcon(GangInfoLayout,string.format("Owner: %s", ZARP.GangInfo.OwnerName), nil, ZARP.GangInfo.OwnerSteamID)
  4378.  
  4379. AddGangInfoIcon(GangInfoLayout,string.format("Members: %s",string.Comma(ZARP.GangInfo.MemberCount or 0)), "icon16/user_gray.png")
  4380.  
  4381. AddGangInfoIcon(GangInfoLayoutRight,string.format("Gang Cash $%s",string.Comma(ZARP.GangInfo.Cash or 0)), "icon16/money.png")
  4382.  
  4383. AddGangInfoIcon(GangInfoLayoutRight,string.format("Gang Loot: %s",string.Comma(ZARP.GangInfo.Loot or 0)), "zarp/loot32.png")
  4384.  
  4385. if ZARP.GangInfo.Fee > 0 then AddGangInfoIcon(GangInfoLayoutRight,string.format("Join Fee $%s",string.Comma(ZARP.GangInfo.Fee or 0)), "icon16/money_dollar.png") end
  4386.  
  4387. AddGangInfoIcon(GangInfoLayout,string.format("Your Rank: %s",LocalPlayer():getDarkRPVar("gang_owner")
  4388.  
  4389. and "Owner" or LocalPlayer():getDarkRPVar("gang_officer") and "Officer" or "Member"), LocalPlayer():getDarkRPVar("gang_owner")
  4390.  
  4391. and "icon16/user_suit.png" or LocalPlayer():getDarkRPVar("gang_officer") and "icon16/user_orange.png" or "icon16/user.png")
  4392.  
  4393. if ZARP.GangInfo.Applications > 0 then
  4394.  
  4395. AddGangInfoIcon(GangInfoLayout,string.format("Pending Applications: %s",ZARP.GangInfo.Applications), "icon16/email.png")
  4396.  
  4397. end
  4398.  
  4399. else
  4400.  
  4401. AddGangInfoIcon(GangInfoLayout,"Use the leaderboards to search for a gang to join or create your own.","icon16/zoom.png")
  4402.  
  4403. GangInfoLayout:SetWide(570)
  4404.  
  4405. end
  4406.  
  4407. //GangInfoLayout:SizeToContents()
  4408.  
  4409. //GangInfoLayoutRight:SizeToContents()
  4410.  
  4411. //Gang upgrades
  4412.  
  4413. local UpgradesScroller = vgui.Create( "DHorizontalScroller",Information )
  4414.  
  4415. UpgradesScroller:SetOverlap( 3 )
  4416.  
  4417. UpgradesScroller:SetSize(640,300)
  4418.  
  4419. UpgradesScroller:SetPos(5,50 + (#GangInfoLayout:GetChildren() * 24))
  4420.  
  4421. UpgradesScroller.Paint = function(s,w,h)
  4422.  
  4423. //draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  4424.  
  4425. end
  4426.  
  4427.  
  4428.  
  4429. for k,v in pairs(ZARP.GangUpgrades) do
  4430.  
  4431. local HasUpgrade = ZARP.GangHasItem(nil, v.id)
  4432.  
  4433. local Upgrade = vgui.Create("DPanel")
  4434.  
  4435. local DescMarkup = markup.Parse(string.format("<font=Trebuchet18><colour=255, 255, 255, 255>%s</colour></font>",v.desc),160)
  4436.  
  4437. Upgrade:SetSize(160,240)
  4438.  
  4439. Upgrade.Paint = function(s,w,h)
  4440.  
  4441. //draw.RoundedBox(4,0,0,w,h,Color(51,51,51))
  4442.  
  4443. surface.SetFont("Trebuchet22")
  4444.  
  4445. local tw,th = surface.GetTextSize(v.title)
  4446.  
  4447. draw.SimpleTextOutlined(v.title,"Trebuchet22",w / 2 - (tw / 2),160,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  4448.  
  4449. DescMarkup:Draw(w / 2 - (DescMarkup:GetWidth() / 2),170)
  4450.  
  4451. end
  4452.  
  4453.  
  4454.  
  4455. local Icon = vgui.Create("DImage",Upgrade)
  4456.  
  4457. Icon:SetSize(150,150)
  4458.  
  4459. Icon:SetPos(5, 0)
  4460.  
  4461. Icon:SetImage(string.format("zarp/%s",v.icon))
  4462.  
  4463. if not HasUpgrade then Icon:SetAlpha(30) end
  4464.  
  4465.  
  4466.  
  4467. if not HasUpgrade then
  4468.  
  4469. local CashLbl
  4470.  
  4471. local LootLbl
  4472.  
  4473. if v.cash > 0 then
  4474.  
  4475. CashLbl = vgui.Create("DLabel",Upgrade)
  4476.  
  4477. CashLbl:SetFont("Trebuchet20")
  4478.  
  4479. CashLbl:SetText(string.format("Cash $%s",string.Comma(v.cash)))
  4480.  
  4481. CashLbl:SizeToContents()
  4482.  
  4483. CashLbl:SetPos((Upgrade:GetWide() / 2) - (CashLbl:GetWide() / 2),175 + DescMarkup:GetHeight())
  4484.  
  4485. end
  4486.  
  4487. if v.loot > 0 then
  4488.  
  4489. LootLbl = vgui.Create("DLabel",Upgrade)
  4490.  
  4491. LootLbl:SetFont("Trebuchet20")
  4492.  
  4493. LootLbl:SetText(string.format("Loot: %s",string.Comma(v.loot)))
  4494.  
  4495. LootLbl:SizeToContents()
  4496.  
  4497. LootLbl:SetPos((Upgrade:GetWide() / 2) - (LootLbl:GetWide() / 2),(CashLbl and 195 or 175) + DescMarkup:GetHeight())
  4498.  
  4499. end
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505. local PurchaseBtn = vgui.Create("DButton",Upgrade)
  4506.  
  4507. PurchaseBtn:SetPos(30,220 + DescMarkup:GetHeight())
  4508.  
  4509. PurchaseBtn:SetSize(100,25)
  4510.  
  4511. PurchaseBtn:SetText("")
  4512.  
  4513. PurchaseBtn.Paint = function(s,w,h)
  4514.  
  4515. draw.RoundedBox(4,0,0,w,h,Color(89,89,89,255))
  4516.  
  4517. draw.SimpleTextOutlined("Purchase","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  4518.  
  4519. if s:GetDisabled() then draw.RoundedBox(4,0,0,w,h,Color(100,100,100,240)) end
  4520.  
  4521. end
  4522.  
  4523.  
  4524.  
  4525. PurchaseBtn.DoClick = function() LocalPlayer():ConCommand("say /buygangitem "..v.id) end
  4526.  
  4527. if (not IsOwner and not IsOfficer) or not ZARP.GangInfo then PurchaseBtn:SetDisabled(true) PurchaseBtn:SetToolTip("You must be a gang owner or officer")
  4528.  
  4529. elseif (v.cash > ZARP.GangInfo.Cash) or (v.loot > ZARP.GangInfo.Loot) then PurchaseBtn:SetDisabled(true) PurchaseBtn:SetToolTip("Not enough cash or loot")
  4530.  
  4531. elseif v.requires and not ZARP.GangHasItem(nil,v.requires) then PurchaseBtn:SetDisabled(true) PurchaseBtn:SetToolTip("Requires the previous upgrade") end
  4532.  
  4533. end
  4534.  
  4535. UpgradesScroller:AddPanel(Upgrade)
  4536.  
  4537. end
  4538.  
  4539.  
  4540.  
  4541. hordiv:SetRight(Information)
  4542.  
  4543. end
  4544.  
  4545. doGangInfoPanel()
  4546.  
  4547. hordiv:SetLeft(GangOptions)
  4548.  
  4549. end
  4550.  
  4551. hordiv:Update()
  4552.  
  4553. return hordiv
  4554.  
  4555. end
  4556.  
  4557.  
  4558.  
  4559. table.insert(GangTabs, {func = MyGangTab, button = MyGangBtn })
  4560.  
  4561. table.insert(GangTabs, {func = CreateGangTab, button = CreateGangBtn })
  4562.  
  4563. table.insert(GangTabs, {func = LeaderboardsTab, button = LeaderboardsBtn })
  4564.  
  4565.  
  4566.  
  4567. if PlayerHasGang and not ZARP.GangInfo then
  4568.  
  4569. msg = "Loading Gang Data..."
  4570.  
  4571. RunConsoleCommand("_requestGangData")
  4572.  
  4573. net.Receive( "Gang_Data", function(len)
  4574.  
  4575. ZARP.GangInfo = {}
  4576.  
  4577. ZARP.GangInfo.Cash = net.ReadUInt(32)
  4578.  
  4579. ZARP.GangInfo.Fee = net.ReadUInt(32)
  4580.  
  4581. ZARP.GangInfo.Color = net.ReadColor()
  4582.  
  4583. ZARP.GangInfo.Upgrades = net.ReadString()
  4584.  
  4585. ZARP.GangInfo.OwnerName = net.ReadString()
  4586.  
  4587. ZARP.GangInfo.OwnerSteamID = net.ReadString()
  4588.  
  4589. ZARP.GangInfo.MemberCount = net.ReadUInt(16)
  4590.  
  4591. ZARP.GangInfo.Applications = net.ReadUInt(16)
  4592.  
  4593. ZARP.GangInfo.Loot = net.ReadUInt(32)
  4594.  
  4595. if IsValid(BackGround) then msg = nil ChangeGangTab(1) end
  4596.  
  4597. end)
  4598.  
  4599. net.Receive( "Gang_SummaryData", function(len)
  4600.  
  4601. if not ZARP.GangInfo then return end
  4602.  
  4603. ZARP.GangInfo.Cash = net.ReadUInt(32)
  4604.  
  4605. ZARP.GangInfo.MemberCount = net.ReadUInt(16)
  4606.  
  4607. ZARP.GangInfo.Applications = net.ReadUInt(16)
  4608.  
  4609. ZARP.GangInfo.Loot = net.ReadUInt(32)
  4610.  
  4611. if IsValid(BackGround) then msg = nil ChangeGangTab(1) end
  4612.  
  4613. end)
  4614.  
  4615. else
  4616.  
  4617. ChangeGangTab(1) //My gang tab
  4618.  
  4619. end
  4620.  
  4621.  
  4622.  
  4623. return BackGround
  4624.  
  4625. end
  4626.  
  4627. --[[
  4628.  
  4629.  
  4630.  
  4631. SHOP TAB
  4632.  
  4633.  
  4634.  
  4635. --]]
  4636.  
  4637. local HoverMat = Material( "vgui/spawnmenu/hover" )
  4638.  
  4639. function zm.MakeShopItem( model, desc, cmd, name, price, entpanel, vip, img,salepct )
  4640.  
  4641. local icon
  4642.  
  4643. if img then
  4644.  
  4645. icon = vgui.Create("DImageButton")
  4646.  
  4647. icon:SetImage( img )
  4648.  
  4649. icon:SetSize(64, 64)
  4650.  
  4651. icon:SetToolTip( false )
  4652.  
  4653. icon.DoClick = function() LocalPlayer():ConCommand("say "..cmd) end
  4654.  
  4655. icon.OnCursorEntered = function() entpanel:SetInfo( model, name, price, desc, img, salepct ) end
  4656.  
  4657. icon.OnCursorExited = function() entpanel:SetInfo( false ) end
  4658.  
  4659. icon.PaintOver = function(s,w,h)
  4660.  
  4661. if salepct then
  4662.  
  4663. draw.WordBox( 4, 0, 5, "SALE", "Tre20", Color(255,51,51), color_white )
  4664.  
  4665. end
  4666.  
  4667. if !icon.Hovered then return end
  4668.  
  4669. surface.SetDrawColor( 255, 255, 255, 255 )
  4670.  
  4671. surface.SetMaterial( HoverMat )
  4672.  
  4673. icon:DrawTexturedRect()
  4674.  
  4675. end
  4676.  
  4677. icon:SetPos( 2, 2 )
  4678.  
  4679. else
  4680.  
  4681. icon = vgui.Create("SpawnIcon")
  4682.  
  4683. icon:InvalidateLayout( true )
  4684.  
  4685. icon:SetModel( model )
  4686.  
  4687. icon:SetSize(64, 64)
  4688.  
  4689. icon:SetToolTip( false )
  4690.  
  4691. icon.DoClick = function() LocalPlayer():ConCommand("say "..cmd) end
  4692.  
  4693. icon.OnCursorEntered = function() entpanel:SetInfo( model, name, price, desc, img, salepct ) end
  4694.  
  4695. icon.OnCursorExited = function() entpanel:SetInfo( false ) end
  4696.  
  4697. icon:SetPos( 2, 2 )
  4698.  
  4699. icon.PaintOver = function(s,w,h)
  4700.  
  4701. if salepct then
  4702.  
  4703. draw.WordBox( 4, 0, 5, "SALE", "Tre20", Color(255,51,51), color_white )
  4704.  
  4705. end
  4706.  
  4707. if !icon.Hovered then return end
  4708.  
  4709. surface.SetDrawColor( 255, 255, 255, 255 )
  4710.  
  4711. surface.SetMaterial( HoverMat )
  4712.  
  4713. icon:DrawTexturedRect()
  4714.  
  4715. end
  4716.  
  4717. end
  4718.  
  4719.  
  4720.  
  4721. if vip then
  4722.  
  4723. local sign = MakeSign( "vip", icon )
  4724.  
  4725. sign:SetPos( 64-16-6, 64-16-12 )
  4726.  
  4727. end
  4728.  
  4729.  
  4730.  
  4731. return icon
  4732.  
  4733. end
  4734.  
  4735.  
  4736.  
  4737. function zm.Shop()
  4738.  
  4739. local EntitiesMain = vgui.Create("DPanel")
  4740.  
  4741. function EntitiesMain.Paint() end
  4742.  
  4743. EntitiesMain:SetDrawBackground(false)
  4744.  
  4745. EntitiesMain:SetSize( zm.content_w, zm.content_h )
  4746.  
  4747.  
  4748.  
  4749. local InfoPanel = vgui.Create( "DPanel", EntitiesMain )
  4750.  
  4751. InfoPanel:SetSize( zm.content_w, 60 )
  4752.  
  4753. InfoPanel:SetBackgroundColor( Color( 255, 255, 255, 15 ) )
  4754.  
  4755.  
  4756.  
  4757. InfoPanel.name = vgui.Create( "DLabel", InfoPanel )
  4758.  
  4759. InfoPanel.name:SetFont( "Tre22" )
  4760.  
  4761. InfoPanel.name:SetPos( 80, 5 )
  4762.  
  4763. InfoPanel.name:SetColor( Color( 255, 255, 255, 255 ) )
  4764.  
  4765.  
  4766.  
  4767. InfoPanel.price = vgui.Create( "DLabel", InfoPanel )
  4768.  
  4769. InfoPanel.price:SetFont( "Tre22" )
  4770.  
  4771. InfoPanel.price:SetPos( 80, 33 - 5 )
  4772.  
  4773. InfoPanel.price:SetColor( Color( 175, 255, 175, 255 ) )
  4774.  
  4775.  
  4776.  
  4777. function InfoPanel:SetItem( model, name, price, desc, img, salepct )
  4778.  
  4779. if not model then
  4780.  
  4781.  
  4782.  
  4783. if IsValid(self.icon) then self.icon:SetVisible( false ) end
  4784.  
  4785. self.name:SetText( "Please select an item from below." )
  4786.  
  4787. self.price:SetText( "Your money: " .. CUR .. (ZARP.formatNumber(LocalPlayer().DarkRPVars.money) ) )
  4788.  
  4789. self.name:SizeToContents()
  4790.  
  4791. self.price:SizeToContents()
  4792.  
  4793. return
  4794.  
  4795. end
  4796.  
  4797. if img then
  4798.  
  4799. self.icon = vgui.Create("DImage",self)
  4800.  
  4801. self.icon:SetImage( img )
  4802.  
  4803. else
  4804.  
  4805. self.icon = vgui.Create("SpawnIcon", self)
  4806.  
  4807. self.icon:SetModel( model )
  4808.  
  4809. end
  4810.  
  4811. self.icon:SetSize(64, 64)
  4812.  
  4813. self.icon:SetPos(2,-2)
  4814.  
  4815. self.icon:SetToolTip( desc or "" )
  4816.  
  4817. self.name:SetText( "Press to buy: " .. name )
  4818.  
  4819.  
  4820.  
  4821. if salepct then
  4822.  
  4823. local pctoff = ((price / 100) * salepct)
  4824.  
  4825. price = math.Round(price - pctoff)
  4826.  
  4827. end
  4828.  
  4829.  
  4830.  
  4831. self.price:SetText( "Price: $" .. string.Comma(price) )
  4832.  
  4833. self.name:SizeToContents()
  4834.  
  4835. self.price:SizeToContents()
  4836.  
  4837.  
  4838.  
  4839. if salepct then
  4840.  
  4841. InfoPanel.PaintOver = function(s,w,h)
  4842.  
  4843. draw.WordBox( 8, s:GetWide() - 105, 10, string.format("SALE %i%% OFF",salepct), "Bebas24Font", Color(255,51,51), color_white )
  4844.  
  4845. end
  4846.  
  4847. else
  4848.  
  4849. InfoPanel.PaintOver = nil
  4850.  
  4851. end
  4852.  
  4853. end
  4854.  
  4855.  
  4856.  
  4857. InfoPanel:SetItem( false )
  4858.  
  4859.  
  4860.  
  4861.  
  4862.  
  4863. local EntitiesPanel = vgui.Create("DPanelList", EntitiesMain)
  4864.  
  4865. EntitiesPanel:SetSize(zm.content_w,zm.content_h-65)
  4866.  
  4867. EntitiesPanel:SetPos( 0, 62 )
  4868.  
  4869. EntitiesPanel:EnableVerticalScrollbar( true )
  4870.  
  4871. EntitiesPanel:EnableHorizontal( false )
  4872.  
  4873.  
  4874.  
  4875. function EntitiesMain:Update()
  4876.  
  4877. EntitiesPanel:Update()
  4878.  
  4879. end
  4880.  
  4881.  
  4882.  
  4883. function EntitiesPanel:SetInfo( model, name, price, desc, img, salepct )
  4884.  
  4885. InfoPanel:SetItem( model, name, price, desc, img, salepct )
  4886.  
  4887. end
  4888.  
  4889.  
  4890.  
  4891. function EntitiesPanel:Update()
  4892.  
  4893. self:SetPadding( 5 )
  4894.  
  4895. self:SetSpacing( 5 )
  4896.  
  4897. self:Clear(true)
  4898.  
  4899.  
  4900.  
  4901. local haswep = false
  4902.  
  4903. local WepCat = vgui.Create("DCollapsibleCategory")
  4904.  
  4905. WepCat:SetDrawBackground(true)
  4906.  
  4907. WepCat:SetLabel("Weapons and Ammunition")
  4908.  
  4909.  
  4910.  
  4911. local WepPanel = vgui.Create("DPanelList")
  4912.  
  4913. WepPanel:SetSize(470, 100)
  4914.  
  4915. WepPanel:SetAutoSize(true)
  4916.  
  4917. WepPanel:SetSpacing(5)
  4918.  
  4919. WepPanel:SetPadding(5)
  4920.  
  4921. WepPanel:EnableHorizontal(true)
  4922.  
  4923. WepPanel:EnableVerticalScrollbar(true)
  4924.  
  4925. WepPanel:SetMouseInputEnabled( false )
  4926.  
  4927. for k,v in pairs(CustomShipments) do
  4928.  
  4929. if (v.seperate and (not GAMEMODE.Config.restrictbuypistol or
  4930.  
  4931. (GAMEMODE.Config.restrictbuypistol and (not v.allowed[1] or table.HasValue(v.allowed, LocalPlayer():Team())))))
  4932.  
  4933. and (not v.customCheck or v.customCheck and v.customCheck(LocalPlayer())) then
  4934.  
  4935. haswep = true
  4936.  
  4937. WepPanel:AddItem( zm.MakeShopItem(v.model,LANGUAGE.GetPhrase("buy_a",v.name,CUR..(v.pricesep or "")), "/buy "..v.name, v.name, v.pricesep, self, (v.customCheck or v.CustomCheck), v.Icon, v.Salepct ) )
  4938.  
  4939. end
  4940.  
  4941. end
  4942.  
  4943.  
  4944.  
  4945. for k,v in pairs(GAMEMODE.AmmoTypes) do
  4946.  
  4947. if not v.customCheck or v.customCheck(LocalPlayer()) then
  4948.  
  4949. haswep = true
  4950.  
  4951. WepPanel:AddItem( zm.MakeShopItem(v.model,LANGUAGE.GetPhrase("buy_a",v.name,CUR..v.price), "/buyammo " .. v.ammoType, v.name, v.price, self, (v.customCheck or v.CustomCheck), false, v.Salepct ))
  4952.  
  4953. end
  4954.  
  4955. end
  4956.  
  4957. WepCat:SetContents(WepPanel)
  4958.  
  4959.  
  4960.  
  4961. WepCat.OnMousePressed = function( self, code ) EntitiesPanel:OnMousePressed( code ) end
  4962.  
  4963. WepCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
  4964.  
  4965.  
  4966.  
  4967. WepPanel.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
  4968.  
  4969. WepPanel.OnMouseWheeled = function( self, d ) self:GetParent():OnMouseWheeled( d ) end
  4970.  
  4971.  
  4972.  
  4973. if haswep then
  4974.  
  4975. self:AddItem(WepCat)
  4976.  
  4977. else
  4978.  
  4979. WepCat:Remove()
  4980.  
  4981. end
  4982.  
  4983.  
  4984.  
  4985. function WepCat:Paint()
  4986.  
  4987. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 150, 150, 150, 255 ) )
  4988.  
  4989. end
  4990.  
  4991. WepCat.Header:SetFont( "Tre20" )
  4992.  
  4993. WepCat.Header:SetColor( Color( 255,255,255,255 ) )
  4994.  
  4995.  
  4996.  
  4997. local EntCat = vgui.Create("DCollapsibleCategory")
  4998.  
  4999.  
  5000.  
  5001. EntCat:SetLabel("General Items")
  5002.  
  5003. local EntPanel = vgui.Create("DPanelList")
  5004.  
  5005. EntPanel:SetSize(470, 200)
  5006.  
  5007. EntPanel:SetAutoSize(true)
  5008.  
  5009. EntPanel:SetSpacing(5)
  5010.  
  5011. EntPanel:SetPadding(5)
  5012.  
  5013. EntPanel:EnableHorizontal(true)
  5014.  
  5015. EntPanel:EnableVerticalScrollbar(true)
  5016.  
  5017. for k,v in pairs(DarkRPEntities) do
  5018.  
  5019. if not v.allowed and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
  5020.  
  5021. local cmdname = string.gsub(v.ent, " ", "_")
  5022.  
  5023.  
  5024.  
  5025. EntPanel:AddItem( zm.MakeShopItem(v.model, "Buy a " .. v.name .." " .. CUR .. v.price, v.cmd, v.name, v.price, self, (v.customCheck or v.CustomCheck) ) )
  5026.  
  5027. end
  5028.  
  5029. end
  5030.  
  5031. EntCat:SetContents(EntPanel)
  5032.  
  5033.  
  5034.  
  5035. EntCat.OnMousePressed = function( self, code ) EntitiesPanel:OnMousePressed( code ) end
  5036.  
  5037. EntCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
  5038.  
  5039.  
  5040.  
  5041. EntPanel.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
  5042.  
  5043. EntPanel.OnMouseWheeled = function( self, d ) self:GetParent():OnMouseWheeled( d ) end
  5044.  
  5045.  
  5046.  
  5047. self:AddItem(EntCat)
  5048.  
  5049.  
  5050.  
  5051. function EntCat:Paint()
  5052.  
  5053. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 150, 150, 150, 255 ) )
  5054.  
  5055. end
  5056.  
  5057. EntCat.Header:SetFont( "Tre20" )
  5058.  
  5059. EntCat.Header:SetColor( Color( 255,255,255,255 ) )
  5060.  
  5061.  
  5062.  
  5063. EntCat.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
  5064.  
  5065. EntCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
  5066.  
  5067.  
  5068.  
  5069. local hasspecial = false
  5070.  
  5071. local SpecialCat = vgui.Create("DCollapsibleCategory")
  5072.  
  5073.  
  5074.  
  5075. SpecialCat:SetLabel(team.GetName( LocalPlayer():Team() ) .. " Items")
  5076.  
  5077. local SpecialPanel = vgui.Create("DPanelList")
  5078.  
  5079. SpecialPanel:SetSize(470, 200)
  5080.  
  5081. SpecialPanel:SetAutoSize(true)
  5082.  
  5083. SpecialPanel:SetSpacing(5)
  5084.  
  5085. SpecialPanel:SetPadding(5)
  5086.  
  5087. SpecialPanel:EnableHorizontal(true)
  5088.  
  5089. SpecialPanel:EnableVerticalScrollbar(true)
  5090.  
  5091. for k,v in pairs(DarkRPEntities) do
  5092.  
  5093. if v.allowed and (type(v.allowed) == "table" and table.HasValue(v.allowed, LocalPlayer():Team()))
  5094.  
  5095. and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
  5096.  
  5097. local cmdname = string.gsub(v.ent, " ", "_")
  5098.  
  5099. hasspecial = true
  5100.  
  5101. SpecialPanel:AddItem( zm.MakeShopItem(v.model, "Buy a " .. v.name .." " .. CUR .. v.price, v.cmd, v.name, v.price, self, (v.customCheck or v.CustomCheck) ) )
  5102.  
  5103. end
  5104.  
  5105. end
  5106.  
  5107.  
  5108.  
  5109. if FoodItems and (GAMEMODE.Config.foodspawn or LocalPlayer():Team() == TEAM_COOK) and (GAMEMODE.Config.hungermod or LocalPlayer():Team() == TEAM_COOK) then
  5110.  
  5111. for k,v in pairs(FoodItems) do
  5112.  
  5113. hasspecial = true
  5114.  
  5115. SpecialPanel:AddItem( zm.MakeShopItem(v.model, LANGUAGE.GetPhrase("buy_a",k,"a few bucks"), "/buyfood "..k, k, "???", self, (v.customCheck or v.CustomCheck) ))
  5116.  
  5117. end
  5118.  
  5119. end
  5120.  
  5121. for k,v in pairs(CustomShipments) do
  5122.  
  5123. if not v.noship and table.HasValue(v.allowed, LocalPlayer():Team())
  5124.  
  5125. and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
  5126.  
  5127. hasspecial = true
  5128.  
  5129. SpecialPanel:AddItem( zm.MakeShopItem(v.model,LANGUAGE.GetPhrase("buy_a",v.name,CUR .. tostring(v.price)), "/buyshipment "..v.name, v.name .. " Shipment", v.price, self, (v.customCheck or v.CustomCheck),v.Icon,v.Salepct ))
  5130.  
  5131. end
  5132.  
  5133. end
  5134.  
  5135. SpecialCat:SetContents(SpecialPanel)
  5136.  
  5137.  
  5138.  
  5139. SpecialCat.OnMousePressed = function( self, code ) EntitiesPanel:OnMousePressed( code ) end
  5140.  
  5141. SpecialCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
  5142.  
  5143.  
  5144.  
  5145. SpecialPanel.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
  5146.  
  5147. SpecialPanel.OnMouseWheeled = function( self, d ) self:GetParent():OnMouseWheeled( d ) end
  5148.  
  5149.  
  5150.  
  5151. if hasspecial then
  5152.  
  5153. self:AddItem(SpecialCat)
  5154.  
  5155. else
  5156.  
  5157. SpecialCat:Remove()
  5158.  
  5159. end
  5160.  
  5161.  
  5162.  
  5163. function SpecialCat:Paint()
  5164.  
  5165. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), team.GetColor( LocalPlayer():Team() ) )
  5166.  
  5167. end
  5168.  
  5169. SpecialCat.Header:SetFont( "Tre20" )
  5170.  
  5171. SpecialCat.Header:SetColor( Color( 255,255,255,255 ) )
  5172.  
  5173.  
  5174.  
  5175. if #CustomVehicles <= 0 then return end
  5176.  
  5177. local VehicleCat = vgui.Create("DCollapsibleCategory")
  5178.  
  5179. VehicleCat:SetLabel("Chairs")
  5180.  
  5181. local VehiclePanel = vgui.Create("DPanelList")
  5182.  
  5183. VehiclePanel:SetSize(470, 200)
  5184.  
  5185. VehiclePanel:SetAutoSize(true)
  5186.  
  5187. VehiclePanel:SetSpacing(5)
  5188.  
  5189. VehiclePanel:SetPadding(5)
  5190.  
  5191. VehiclePanel:EnableHorizontal(true)
  5192.  
  5193. VehiclePanel:EnableVerticalScrollbar(true)
  5194.  
  5195.  
  5196.  
  5197. local founds = 0
  5198.  
  5199. for k,v in pairs(CustomVehicles) do
  5200.  
  5201. if not v.allowed or table.HasValue(v.allowed, LocalPlayer():Team()) then
  5202.  
  5203. local Skin = (list.Get("Vehicles")[v.name] and list.Get("Vehicles")[v.name].KeyValues and list.Get("Vehicles")[v.name].KeyValues.Skin) or "0"
  5204.  
  5205. VehiclePanel:AddItem( zm.MakeShopItem(v.model or "models/buggy.mdl", Skin, "/buyvehicle "..v.name, "/buyvehicle "..v.name, v.price, self, (v.customCheck or v.CustomCheck) ) )
  5206.  
  5207. founds = founds + 1
  5208.  
  5209. end
  5210.  
  5211. end
  5212.  
  5213.  
  5214.  
  5215. function VehicleCat:Paint()
  5216.  
  5217. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 200, 200, 200, 255 ) )
  5218.  
  5219. end
  5220.  
  5221. VehicleCat.Header:SetFont( "Trebuchet22" )
  5222.  
  5223. VehicleCat.Header:SetColor( Color( 0,0,0,255 ) )
  5224.  
  5225.  
  5226.  
  5227. VehicleCat.OnMousePressed = function( self, code ) EntitiesPanel:OnMousePressed( code ) end
  5228.  
  5229. VehicleCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
  5230.  
  5231.  
  5232.  
  5233. VehiclePanel.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
  5234.  
  5235. VehiclePanel.OnMouseWheeled = function( self, d ) self:GetParent():OnMouseWheeled( d ) end
  5236.  
  5237.  
  5238.  
  5239.  
  5240.  
  5241. if founds ~= 0 then
  5242.  
  5243. VehicleCat:SetContents(VehiclePanel)
  5244.  
  5245. //VehicleCat:SetContents(rentbutton)
  5246.  
  5247. //RentCat:SetContents(rentbutton)
  5248.  
  5249. self:AddItem(VehicleCat)
  5250.  
  5251. else
  5252.  
  5253. VehiclePanel:Remove()
  5254.  
  5255. VehicleCat:Remove()
  5256.  
  5257. end
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263. end
  5264.  
  5265. EntitiesPanel:Update()
  5266.  
  5267. return EntitiesMain
  5268.  
  5269. end
  5270.  
  5271.  
  5272.  
  5273. //Jobs Tab
  5274.  
  5275. local _jobslist
  5276.  
  5277.  
  5278.  
  5279. local function AddJobIcon(vip,infoupdate, job, color,Model, name, description, Weapons, command, special, specialcommand)
  5280.  
  5281. local btn = vgui.Create( "DButton" )
  5282.  
  5283. btn:SetSize( 213, 68 )
  5284.  
  5285. btn.bgcol = Color( color.r * 0.75, color.g * 0.75, color.b * 0.75, 255 )
  5286.  
  5287. btn:SetText( "" )
  5288.  
  5289. function btn:Paint()
  5290.  
  5291. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.bgcol )
  5292.  
  5293. end
  5294.  
  5295.  
  5296.  
  5297. local label = vgui.Create( "DLabel", btn )
  5298.  
  5299. if string.len( name ) > 18 then
  5300.  
  5301. label:SetFont( "Default" )
  5302.  
  5303. label:SetPos( 80, 27 )
  5304.  
  5305. else
  5306.  
  5307. label:SetFont( "Tre22" )
  5308.  
  5309. label:SetPos( 80, 23 )
  5310.  
  5311. end
  5312.  
  5313. label:SetTextColor( Color( 255,255,255,255 ) )
  5314.  
  5315. label:SetText( name)
  5316.  
  5317. label:SizeToContents()
  5318.  
  5319. label:SetMouseInputEnabled( false )
  5320.  
  5321.  
  5322.  
  5323. local icon = vgui.Create("SpawnIcon", btn )
  5324.  
  5325. local IconModel = Model
  5326.  
  5327. if type(Model) == "table" then
  5328.  
  5329. IconModel = Model[#Model]
  5330.  
  5331. end
  5332.  
  5333. icon:SetModel(IconModel)
  5334.  
  5335.  
  5336.  
  5337. icon:SetSize(64, 64)
  5338.  
  5339. icon:SetToolTip()
  5340.  
  5341. icon:SetPos( 2, 2 )
  5342.  
  5343. icon:SetMouseInputEnabled( false )
  5344.  
  5345.  
  5346.  
  5347. local mod = (name == "Mod On Duty")
  5348.  
  5349. local admin = (name == "Admin On Duty")
  5350.  
  5351.  
  5352.  
  5353. if vip or mod or admin then
  5354.  
  5355. local rank = "vip"
  5356.  
  5357.  
  5358.  
  5359. if mod then rank = "moderator" elseif admin then rank = "admin" end
  5360.  
  5361.  
  5362.  
  5363. local sign = MakeSign( rank, icon )
  5364.  
  5365. sign:SetPos( -2, 64-16 )
  5366.  
  5367. end
  5368.  
  5369.  
  5370.  
  5371. btn.OnCursorEntered = function()
  5372.  
  5373. model = IconModel
  5374.  
  5375. infoupdate( job )
  5376.  
  5377. btn.bgcol = Color( job.color.r + 30, job.color.g + 30, job.color.b + 30, 255 )
  5378.  
  5379. end
  5380.  
  5381. btn.OnCursorExited = function()
  5382.  
  5383. infoupdate(false)
  5384.  
  5385. btn.bgcol = Color( job.color.r, job.color.g, job.color.b, 255 )
  5386.  
  5387. end
  5388.  
  5389.  
  5390.  
  5391. btn.DoClick = function()
  5392.  
  5393. local function DoChatCommand(frame)
  5394.  
  5395. if special then
  5396.  
  5397. local menu = DermaMenu()
  5398.  
  5399. menu:AddOption("Vote", function() LocalPlayer():ConCommand("say "..command) if frame then frame:Close() end zm.Close() end)
  5400.  
  5401. menu:AddOption("Do not vote", function() LocalPlayer():ConCommand("say " .. specialcommand) if frame then frame:Close() end zm.Close() end)
  5402.  
  5403. menu:Open()
  5404.  
  5405. else
  5406.  
  5407. LocalPlayer():ConCommand("say " .. command)
  5408.  
  5409. zm.Close()
  5410.  
  5411. end
  5412.  
  5413. end
  5414.  
  5415.  
  5416.  
  5417. if type(Model) == "table" and #Model > 0 then
  5418.  
  5419. --hordiv:GetParent():GetParent():Close()
  5420.  
  5421. local frame = vgui.Create("DFrame")
  5422.  
  5423. frame:SetTitle("Choose model")
  5424.  
  5425. frame:SetVisible(true)
  5426.  
  5427. frame:MakePopup()
  5428.  
  5429.  
  5430.  
  5431. local levels = 1
  5432.  
  5433. local IconsPerLevel = math.floor(ScrW()/64)
  5434.  
  5435.  
  5436.  
  5437. while #Model * (64/levels) > ScrW() do
  5438.  
  5439. levels = levels + 1
  5440.  
  5441. end
  5442.  
  5443. frame:SetSize(math.Min(#Model * 64, IconsPerLevel*64), math.Min(90+(64*(levels-1)), ScrH()))
  5444.  
  5445. frame:Center()
  5446.  
  5447.  
  5448.  
  5449. local CurLevel = 1
  5450.  
  5451. for k,v in pairs(Model) do
  5452.  
  5453. local icon = vgui.Create("SpawnIcon", frame)
  5454.  
  5455. if (k-IconsPerLevel*(CurLevel-1)) > IconsPerLevel then
  5456.  
  5457. CurLevel = CurLevel + 1
  5458.  
  5459. end
  5460.  
  5461. icon:SetPos((k-1-(CurLevel-1)*IconsPerLevel) * 64, 25+(64*(CurLevel-1)))
  5462.  
  5463. icon:SetModel(v)
  5464.  
  5465. icon:SetSize(64, 64)
  5466.  
  5467. icon:SetToolTip()
  5468.  
  5469. icon.DoClick = function()
  5470.  
  5471. RunConsoleCommand("rp_playermodel", v)
  5472.  
  5473. RunConsoleCommand("_rp_ChosenModel", v)
  5474.  
  5475. DoChatCommand( frame )
  5476.  
  5477. frame:Close()
  5478.  
  5479. end
  5480.  
  5481. end
  5482.  
  5483. else
  5484.  
  5485. DoChatCommand()
  5486.  
  5487. end
  5488.  
  5489. end
  5490.  
  5491.  
  5492.  
  5493. function btn:OnMouseWheeled(d)
  5494.  
  5495. _jobslist:OnMouseWheeled(d)
  5496.  
  5497. end
  5498.  
  5499.  
  5500.  
  5501. return btn
  5502.  
  5503. end
  5504.  
  5505.  
  5506.  
  5507. function zm.Jobs()
  5508.  
  5509. local jobsmain = vgui.Create("DPanel")
  5510.  
  5511. jobsmain:SetSize( zm.content_w, zm.content_h )
  5512.  
  5513. function jobsmain:Paint() end
  5514.  
  5515.  
  5516.  
  5517. local leftw = 425 - 15
  5518.  
  5519.  
  5520.  
  5521. local jobslist
  5522.  
  5523. local jobsinfoh
  5524.  
  5525. local jobmodel
  5526.  
  5527. function jobsmain:Update()
  5528.  
  5529. if jobslist and jobslist:IsValid() then
  5530.  
  5531. jobslist:Remove()
  5532.  
  5533. end
  5534.  
  5535. jobslist = vgui.Create("DPanelList", jobsmain)
  5536.  
  5537. jobslist:SetSize( 465, zm.content_h)
  5538.  
  5539. jobslist:EnableHorizontal( false )
  5540.  
  5541. jobslist:EnableVerticalScrollbar( true )
  5542.  
  5543. jobslist:SetPadding( 5 )
  5544.  
  5545. jobslist:SetSpacing( 8 )
  5546.  
  5547. jobslist:SetPos( 0, 0 )
  5548.  
  5549. _jobslist = jobslist
  5550.  
  5551.  
  5552.  
  5553. if jobsinfoh and jobsinfoh:IsValid() then
  5554.  
  5555. jobsinfoh:Remove()
  5556.  
  5557. end
  5558.  
  5559. jobsinfoh = vgui.Create("DPanel", jobsmain)
  5560.  
  5561. jobsinfoh:SetSize( leftw, 60 )
  5562.  
  5563. jobsinfoh:SetPos( 475, 5 )
  5564.  
  5565. jobsinfoh:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
  5566.  
  5567.  
  5568.  
  5569. local jobsinfot = vgui.Create("DLabel", jobsinfoh)
  5570.  
  5571. jobsinfot:SetFont( "Tre24" )
  5572.  
  5573. jobsinfot:SetTextColor( Color( 255, 255, 255, 255 ) )
  5574.  
  5575. jobsinfot:SetText( "" )
  5576.  
  5577. jobsinfot:SetPos( 10, 15 )
  5578.  
  5579.  
  5580.  
  5581. if jobsinfod and jobsinfod:IsValid() then
  5582.  
  5583. jobsinfod:Remove()
  5584.  
  5585. end
  5586.  
  5587. jobsinfod = vgui.Create("DPanel", jobsmain)
  5588.  
  5589. jobsinfod:SetSize( leftw, 450 )
  5590.  
  5591. jobsinfod:SetPos( 475, 75 )
  5592.  
  5593. jobsinfod:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
  5594.  
  5595.  
  5596.  
  5597. local jobsinfodesc = vgui.Create("DTextEntry", jobsinfod)
  5598.  
  5599. --jobsinfot:SetFont( "Tre24" )
  5600.  
  5601. --jobsinfot:SetTextColor( Color( 255, 255, 255, 255 ) )
  5602.  
  5603. jobsinfodesc:SetText( "" )
  5604.  
  5605. jobsinfodesc:SetPos( 0, 0 )
  5606.  
  5607. jobsinfodesc:SetSize( 340, 440 )
  5608.  
  5609. jobsinfodesc:SetFont( "JobDesc" )
  5610.  
  5611. --function jobsinfodesc:Paint() end
  5612.  
  5613. jobsinfodesc:AllowInput( false )
  5614.  
  5615. jobsinfodesc:SetMultiline( true )
  5616.  
  5617. jobsinfodesc:SetDrawBackground( false )
  5618.  
  5619. jobsinfodesc:SetDrawBorder( false )
  5620.  
  5621.  
  5622.  
  5623. if jobmodel and jobmodel:IsValid() then
  5624.  
  5625. jobmodel:Remove()
  5626.  
  5627. end
  5628.  
  5629. jobmodel = vgui.Create("DModelPanel", jobsmain )
  5630.  
  5631. jobmodel:SetModel("")
  5632.  
  5633. jobmodel:SetSize(75,250)
  5634.  
  5635. jobmodel:SetAnimated(true)
  5636.  
  5637. jobmodel:SetFOV(20)
  5638.  
  5639. jobmodel:SetAnimSpeed(1)
  5640.  
  5641. jobmodel:SetPos( 810, 60 )
  5642.  
  5643.  
  5644.  
  5645. local function UpdateInfo( job )
  5646.  
  5647. if not job then
  5648.  
  5649. jobsinfoh:SetBackgroundColor( Color( 0,0,0,0 ) )
  5650.  
  5651. jobsinfot:SetText( "<- Select a job from the left" )
  5652.  
  5653. jobsinfot:SizeToContents()
  5654.  
  5655. jobsinfod:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
  5656.  
  5657. jobsinfodesc:SetText("")
  5658.  
  5659. jobsinfodesc:SetVisible( false )
  5660.  
  5661. jobmodel:SetModel("")
  5662.  
  5663. return
  5664.  
  5665. end
  5666.  
  5667.  
  5668.  
  5669. local desc = job.description
  5670.  
  5671.  
  5672.  
  5673. if job.weapons and type( job.weapons ) == "table" and #job.weapons > 0 then
  5674.  
  5675. desc = desc .. "\n\nSpecial Weapons:\n"
  5676.  
  5677. for k, v in pairs( job.weapons ) do
  5678.  
  5679. desc = desc .. v .. "\n"
  5680.  
  5681. end
  5682.  
  5683. end
  5684.  
  5685.  
  5686.  
  5687. jobsinfoh:SetBackgroundColor( job.color )
  5688.  
  5689. jobsinfot:SetText( "The " .. job.name )
  5690.  
  5691. jobsinfot:SizeToContents()
  5692.  
  5693. jobsinfod:SetBackgroundColor( Color( 200, 200, 200, 255 ) )
  5694.  
  5695. jobsinfodesc:SetText( desc )
  5696.  
  5697. jobsinfodesc:SetVisible( true )
  5698.  
  5699.  
  5700.  
  5701. jobmodel:SetModel( model )
  5702.  
  5703. end
  5704.  
  5705. UpdateInfo( nil )
  5706.  
  5707.  
  5708.  
  5709. for i, j in pairs( hTeamCats ) do
  5710.  
  5711. local jobcat = vgui.Create("DCollapsibleCategory")
  5712.  
  5713.  
  5714.  
  5715. jobcat:SetLabel( j )
  5716.  
  5717. jobcat.bgcol = Color( 150, 150, 150, 255 )
  5718.  
  5719. function jobcat:Paint()
  5720.  
  5721. draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.bgcol )
  5722.  
  5723. end
  5724.  
  5725. jobcat.Header:SetFont( "Tre20" )
  5726.  
  5727. jobcat.Header:SetColor( Color( 255, 255, 255, 255 ) )
  5728.  
  5729.  
  5730.  
  5731. jobcat:SetMouseInputEnabled(true)
  5732.  
  5733.  
  5734.  
  5735. function jobcat:OnMouseWheeled(d)
  5736.  
  5737. jobslist:OnMouseWheeled(d)
  5738.  
  5739. end
  5740.  
  5741.  
  5742.  
  5743. function jobcat.Header:OnMouseWheeled(d)
  5744.  
  5745. jobslist:OnMouseWheeled(d)
  5746.  
  5747. end
  5748.  
  5749.  
  5750.  
  5751. local jobcatlist = vgui.Create("DPanelList")
  5752.  
  5753. jobcatlist:SetSize(470, 200)
  5754.  
  5755. jobcatlist:SetAutoSize(true)
  5756.  
  5757. jobcatlist:SetSpacing(5)
  5758.  
  5759. jobcatlist:SetPadding(5)
  5760.  
  5761. jobcatlist:EnableHorizontal(true)
  5762.  
  5763. jobcatlist:EnableVerticalScrollbar(false)
  5764.  
  5765.  
  5766.  
  5767. function jobcatlist:OnMouseWheeled(d)
  5768.  
  5769. jobslist:OnMouseWheeled(d)
  5770.  
  5771. end
  5772.  
  5773.  
  5774.  
  5775. for k,v in ipairs(RPExtraTeams) do
  5776.  
  5777. if LocalPlayer():Team() ~= k and v.cat == i then
  5778.  
  5779. local nodude = true
  5780.  
  5781. if v.admin == 1 and not LocalPlayer():IsAdmin() then
  5782.  
  5783. nodude = false
  5784.  
  5785. end
  5786.  
  5787. if v.admin > 1 and not LocalPlayer():IsHeadAdmin() then
  5788.  
  5789. nodude = false
  5790.  
  5791. end
  5792.  
  5793. //if v.customCheck and not v.customCheck(LocalPlayer()) then
  5794.  
  5795. //nodude = false
  5796.  
  5797. //end
  5798.  
  5799.  
  5800.  
  5801. if (type(v.NeedToChangeFrom) == "number" and LocalPlayer():Team() ~= v.NeedToChangeFrom) or (type(v.NeedToChangeFrom) == "table" and not table.HasValue(v.NeedToChangeFrom, LocalPlayer():Team())) then
  5802.  
  5803. nodude = false
  5804.  
  5805. end
  5806.  
  5807.  
  5808.  
  5809. if nodude then
  5810.  
  5811. local weps = "no extra weapons"
  5812.  
  5813. if #v.weapons > 0 then
  5814.  
  5815. weps = table.concat(v.weapons, "\n")
  5816.  
  5817. end
  5818.  
  5819. if v.vote then
  5820.  
  5821. local condition = ((v.admin == 0 and LocalPlayer():IsAdmin()) or (v.admin == 1 and LocalPlayer():IsHeadAdmin()) or LocalPlayer().DarkRPVars["Priv"..v.command])
  5822.  
  5823. if not v.model or not v.name or not v.description or not v.command then chat.AddText(Color(255,0,0,255), "Incorrect team! Fix your shared.lua!") return end
  5824.  
  5825. jobcatlist:AddItem(AddJobIcon((v.customCheck or v.CustomCheck),UpdateInfo, v, v.color,v.model, v.name, v.description, weps, "/vote"..v.command, condition, "/"..v.command))
  5826.  
  5827. else
  5828.  
  5829. if not v.model or not v.name or not v.description or not v.command then chat.AddText(Color(255,0,0,255), "Incorrect team! Fix your shared.lua!") return end
  5830.  
  5831. jobcatlist:AddItem(AddJobIcon((v.customCheck or v.CustomCheck),UpdateInfo, v, v.color,v.model, v.name, v.description, weps, "/"..v.command))
  5832.  
  5833. end
  5834.  
  5835. end
  5836.  
  5837. end
  5838.  
  5839. end
  5840.  
  5841.  
  5842.  
  5843. jobcat:SetContents(jobcatlist)
  5844.  
  5845. jobslist:AddItem( jobcat )
  5846.  
  5847. end
  5848.  
  5849.  
  5850.  
  5851. end
  5852.  
  5853. jobsmain:Update()
  5854.  
  5855. return jobsmain
  5856.  
  5857. end
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865. function zm.SkillsTab()
  5866.  
  5867.  
  5868.  
  5869. local w = 890
  5870.  
  5871. local l = 520
  5872.  
  5873.  
  5874.  
  5875. local BackGround = vgui.Create("DPanel",F4Menu)
  5876.  
  5877. BackGround:SetSize(l,w)
  5878.  
  5879. BackGround.Paint = function()
  5880.  
  5881. draw.RoundedBox(4,0,0,w,l,Color(55, 100, 5, 150))
  5882.  
  5883. draw.SimpleTextOutlined("Skills","ZMenuHeader",w*.5,l*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  5884.  
  5885. end
  5886.  
  5887.  
  5888.  
  5889. local SkillList = vgui.Create("DScrollPanel", BackGround)
  5890.  
  5891. SkillList:SetPos(0,54)
  5892.  
  5893. SkillList:SetSize( w, 456 )
  5894.  
  5895. SkillList:SetPadding(15)
  5896.  
  5897. SkillList.Paint = function( self, w, h )
  5898.  
  5899. draw.RoundedBox(4,0,0, w, h, Color(150,150,150,220))
  5900.  
  5901. end
  5902.  
  5903.  
  5904.  
  5905. function SkillList:LoadSkills()
  5906.  
  5907. for k,v in SortedPairs( LocalPlayer().Skills ) do
  5908.  
  5909. local sk = LDRP_SH.AllSkills[k]
  5910.  
  5911. local nextlvl = sk.pricetbl[v.lvl+1]
  5912.  
  5913. local SkillItem = vgui.Create("DPanel")
  5914.  
  5915. SkillItem:SetSize(880,80)
  5916.  
  5917. SkillItem.Paint = function()
  5918.  
  5919. local cure = LocalPlayer().Skills[k]
  5920.  
  5921. local nextlvl = LDRP_SH.AllSkills[k].pricetbl[cure.lvl + 1]
  5922.  
  5923. draw.RoundedBox(4,0,0,880,80,Color(200,200,200,255))
  5924.  
  5925. draw.RoundedBox(4,90,6,100,30,Color(150,150,150,255)) -- Title background
  5926.  
  5927. draw.RoundedBox(4,90,43,658,30,Color(150,150,150,255)) -- Description background
  5928.  
  5929. local need = LDRP_SH.AllSkills[k].exptbl[cure.lvl]
  5930.  
  5931. draw.RoundedBox(4,198,6,658,30,Color(0,0,0,255)) -- EXP Background
  5932.  
  5933. draw.RoundedBox(4,200,8,nextlvl and 654*math.Clamp(cure.exp/need,.02,1) or 654,26,nextlvl and Color(55,150,5,255) or Color(0,42,168))
  5934.  
  5935. draw.SimpleTextOutlined(nextlvl and (cure.exp .. " / " .. need .. " until level " .. cure.lvl+1) or string.format("You have maxed out this skill. (Level %s)",cure.lvl),"Trebuchet24",464,21,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  5936.  
  5937. local Txt = "Trebuchet24"
  5938.  
  5939. if string.len(k) > 8 then Txt = "Trebuchet22" end
  5940.  
  5941. draw.SimpleTextOutlined(k,Txt,100,20,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  5942.  
  5943. draw.SimpleTextOutlined(sk.descrpt,"Trebuchet24",100,57,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  5944.  
  5945. end
  5946.  
  5947.  
  5948.  
  5949. local SkillIcon = vgui.Create("SpawnIcon", SkillItem)
  5950.  
  5951. SkillIcon:SetPos(8,4)
  5952.  
  5953. SkillIcon:SetSize(70, 70)
  5954.  
  5955. SkillIcon:SetModel(sk.mdl)
  5956.  
  5957. SkillIcon:SetToolTip()
  5958.  
  5959.  
  5960.  
  5961. function SkillIcon:PaintOver() return end
  5962.  
  5963.  
  5964.  
  5965. if nextlvl then
  5966.  
  5967. local SkillBuy = vgui.Create("DButton",SkillItem)
  5968.  
  5969. SkillBuy:SetPos(754,43)
  5970.  
  5971. SkillBuy:SetSize(100,30)
  5972.  
  5973. SkillBuy:SetText("")
  5974.  
  5975. SkillBuy.Paint = function()
  5976.  
  5977. local cure = LocalPlayer().Skills[k]
  5978.  
  5979. draw.RoundedBox(4,0,0,100,30,Color(150,150,150,255))
  5980.  
  5981. draw.SimpleTextOutlined("Buy Next Level","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  5982.  
  5983. local need = LDRP_SH.AllSkills[k].exptbl[cure.lvl]
  5984.  
  5985. if cure.exp < need then
  5986.  
  5987. draw.RoundedBox(4,0,0,100,30,Color(100,100,100,240))
  5988.  
  5989. end
  5990.  
  5991. end
  5992.  
  5993. if sk.pricetbl[v.lvl+1] then
  5994.  
  5995. SkillBuy:SetToolTip("Buy level " .. v.lvl+1 .. " for $" .. sk.pricetbl[v.lvl+1])
  5996.  
  5997. else
  5998.  
  5999. SkillBuy:SetToolTip("Your level is maxed out!")
  6000.  
  6001. end
  6002.  
  6003. local OldEnter = SkillBuy.OnCursorEntered
  6004.  
  6005. SkillBuy.OnCursorEntered = function(s)
  6006.  
  6007. SkillBuy.Paint = function()
  6008.  
  6009. local cure = LocalPlayer().Skills[k]
  6010.  
  6011. draw.RoundedBox(4,0,0,100,30,Color(225,225,225,255))
  6012.  
  6013. draw.SimpleTextOutlined("Buy Next Level","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6014.  
  6015. local need = LDRP_SH.AllSkills[k].exptbl[cure.lvl]
  6016.  
  6017. if cure.exp < need then
  6018.  
  6019. draw.RoundedBox(4,0,0,100,30,Color(100,100,100,240))
  6020.  
  6021. end
  6022.  
  6023. end
  6024.  
  6025. local mylvl = LocalPlayer().Skills[k].lvl
  6026.  
  6027. if sk.pricetbl[mylvl+1] then
  6028.  
  6029. SkillBuy:SetToolTip("Buy level " .. mylvl+1 .. " for $" .. sk.pricetbl[mylvl+1])
  6030.  
  6031. else
  6032.  
  6033. SkillBuy:SetToolTip("Your level is maxxed out!")
  6034.  
  6035. end
  6036.  
  6037. return OldEnter(s)
  6038.  
  6039. end
  6040.  
  6041. SkillBuy.OnCursorExited = function()
  6042.  
  6043. SkillBuy.Paint = function()
  6044.  
  6045. local cure = LocalPlayer().Skills[k]
  6046.  
  6047. draw.RoundedBox(4,0,0,100,30,Color(150,150,150,255))
  6048.  
  6049. draw.SimpleTextOutlined("Buy Next Level","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6050.  
  6051. local need = LDRP_SH.AllSkills[k].exptbl[cure.lvl]
  6052.  
  6053. if cure.exp < need then
  6054.  
  6055. draw.RoundedBox(4,0,0,100,30,Color(100,100,100,240))
  6056.  
  6057. end
  6058.  
  6059. end
  6060.  
  6061. end
  6062.  
  6063. SkillBuy.DoClick = function()
  6064.  
  6065. local currentExp = LocalPlayer().Skills[k].exp
  6066.  
  6067.  
  6068.  
  6069. if currentExp < sk.exptbl[v.lvl] then --v.exp contains old information, have to get it fresh from the skills table.
  6070.  
  6071. LocalPlayer():ChatPrint("You need more experience!")
  6072.  
  6073. chat.PlaySound()
  6074.  
  6075. else
  6076.  
  6077. RunConsoleCommand("_buysk",k)
  6078.  
  6079. end
  6080.  
  6081. end
  6082.  
  6083. SkillBuy.Think = function(s)
  6084.  
  6085. local cure = LocalPlayer().Skills[k]
  6086.  
  6087. local nextlvl = LDRP_SH.AllSkills[k].pricetbl[cure.lvl + 1]
  6088.  
  6089. if !nextlvl then s:Remove() end
  6090.  
  6091. end
  6092.  
  6093. end
  6094.  
  6095. SkillList:AddItem(SkillItem)
  6096.  
  6097. SkillItem:Dock( TOP )
  6098.  
  6099. SkillItem:DockMargin( 4, 0, 0, 4 )
  6100.  
  6101.  
  6102.  
  6103. end
  6104.  
  6105. end
  6106.  
  6107. function SkillList:Think()
  6108.  
  6109. if LocalPlayer().Skills and table.Count(LocalPlayer().Skills) > 0 then
  6110.  
  6111. SkillList:LoadSkills()
  6112.  
  6113. SkillList.Think = nil
  6114.  
  6115. end
  6116.  
  6117. end
  6118.  
  6119.  
  6120.  
  6121. return BackGround
  6122.  
  6123.  
  6124.  
  6125. end
  6126.  
  6127.  
  6128.  
  6129. function zm.BlueprintsTab()
  6130.  
  6131.  
  6132.  
  6133. local w = 890
  6134.  
  6135. local l = 520
  6136.  
  6137.  
  6138.  
  6139. local BluePrintMat = Material("zarp/blueprint256.png")
  6140.  
  6141. local GoldBluePrintMat = Material("zarp/blueprintgold256.png")
  6142.  
  6143.  
  6144.  
  6145. local BackGround = vgui.Create("DPanel",F4Menu)
  6146.  
  6147. BackGround:SetSize(l,w)
  6148.  
  6149. BackGround.Paint = function()
  6150.  
  6151. draw.RoundedBox(4,0,0,w,l,Color(102,140,255, 150))
  6152.  
  6153. draw.SimpleTextOutlined("My Blueprints","ZMenuHeader",w*.5,l*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6154.  
  6155. end
  6156.  
  6157.  
  6158.  
  6159. local BlueprintsList = vgui.Create("DScrollPanel", BackGround)
  6160.  
  6161. BlueprintsList:SetPos(0,54)
  6162.  
  6163. BlueprintsList:SetSize( w, 456 )
  6164.  
  6165. BlueprintsList:SetPadding(15)
  6166.  
  6167.  
  6168.  
  6169. function BlueprintsList:LoadBlueprints()
  6170.  
  6171. for k,v in pairs(LDRP_SH.TableToNumericalKeys(LDRP_SH.Blueprints)) do
  6172.  
  6173. local hasblueprint = LocalPlayer():HasItem(string.lower(v.name .. " blueprint"))
  6174.  
  6175. local Blueprint = vgui.Create("DPanel")
  6176.  
  6177. Blueprint:SetSize(880,80)
  6178.  
  6179. Blueprint.Paint = function(s,w,h)
  6180.  
  6181. draw.RoundedBox(4,0,0,880,80,Color(89,89,89))
  6182.  
  6183. draw.RoundedBox(4,90,43,658,30,Color(255,255,255,50)) -- Description background
  6184.  
  6185. draw.SimpleTextOutlined(v.name,"Trebuchet24",100,20,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6186.  
  6187. draw.SimpleTextOutlined(v.desc,"Trebuchet22",100,57,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6188.  
  6189.  
  6190.  
  6191. surface.SetMaterial(v.golden and GoldBluePrintMat or BluePrintMat)
  6192.  
  6193. surface.SetDrawColor(255,255,255,hasblueprint and 255 or 100)
  6194.  
  6195. surface.DrawTexturedRect( 8, 4, 70, 70 )
  6196.  
  6197.  
  6198.  
  6199. if v.newblueprint then draw.WordBox( 4, w - 121, 5, "NEW BLUEPRINT", "Bebas24Font", Color(255,51,51), color_white ) end
  6200.  
  6201. end
  6202.  
  6203.  
  6204.  
  6205. if hasblueprint then
  6206.  
  6207. local Icon = vgui.Create("ModelImage", Blueprint)
  6208.  
  6209. Icon:SetPos(8,4)
  6210.  
  6211. Icon:SetSize(70, 70)
  6212.  
  6213. Icon:SetModel(v.model)
  6214.  
  6215. end
  6216.  
  6217.  
  6218.  
  6219. local SkillBuy = vgui.Create("DButton",Blueprint)
  6220.  
  6221. SkillBuy:SetPos(754,43)
  6222.  
  6223. SkillBuy:SetSize(100,30)
  6224.  
  6225. SkillBuy:SetText("")
  6226.  
  6227. SkillBuy.Paint = function()
  6228.  
  6229. local cure = LocalPlayer().Skills[k]
  6230.  
  6231. draw.RoundedBox(4,0,0,100,30,Color(150,150,150,255))
  6232.  
  6233. draw.SimpleTextOutlined(hasblueprint and "Craft One" or "Locked","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6234.  
  6235. if !hasblueprint then
  6236.  
  6237. draw.RoundedBox(4,0,0,100,30,Color(100,100,100,240))
  6238.  
  6239. end
  6240.  
  6241. end
  6242.  
  6243. SkillBuy.DoClick = function()
  6244.  
  6245. if !hasblueprint then return end
  6246.  
  6247. local multiuse = v.multiuse
  6248.  
  6249. Derma_Query(string.format("Do you want to craft this item for ($%s) %s",ZARP.formatNumber(v.price),!multiuse and "(This blueprint is a one-time use!)" or "?" ), v.name, "Craft Item",
  6250.  
  6251. function() RunConsoleCommand("_CraftBlueprintItem",v.key) end, "Cancel" )
  6252.  
  6253. end
  6254.  
  6255.  
  6256.  
  6257. if table.Count(v.results) < 1 then SkillBuy:SetVisible(false) end
  6258.  
  6259. if hasblueprint then SkillBuy:SetTooltip("Cost: $" .. ZARP.formatNumber(v.price)) end
  6260.  
  6261. BlueprintsList:AddItem(Blueprint)
  6262.  
  6263. Blueprint:Dock( TOP )
  6264.  
  6265. Blueprint:DockMargin( 4, 0, 0, 4 )
  6266.  
  6267. end
  6268.  
  6269. end
  6270.  
  6271. BlueprintsList:LoadBlueprints()
  6272.  
  6273. return BackGround
  6274.  
  6275. end
  6276.  
  6277.  
  6278.  
  6279. function zm.ShopListTab()
  6280.  
  6281.  
  6282.  
  6283. local BackGround = vgui.Create("DPanel",F4Menu)
  6284.  
  6285. BackGround:SetSize(890,520)
  6286.  
  6287. BackGround.Paint = function(s,w,h)
  6288.  
  6289. draw.RoundedBox(4,0,0,w,h,Color(255, 75, 15, 200))
  6290.  
  6291. draw.SimpleTextOutlined("ZARP Market Shops","ZMenuHeader",w*.5,h*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6292.  
  6293. if msg then draw.SimpleTextOutlined(msg,"Trebuchet22",w*.5,54,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) ) end
  6294.  
  6295. end
  6296.  
  6297.  
  6298.  
  6299. local ScrollPanel = vgui.Create("DScrollPanel", BackGround)
  6300.  
  6301. ScrollPanel:SetPos(0,54)
  6302.  
  6303. ScrollPanel:SetSize(890,456)
  6304.  
  6305.  
  6306.  
  6307. local ShopList = vgui.Create("DIconLayout", ScrollPanel)
  6308.  
  6309. ShopList:SetSize(880,456)
  6310.  
  6311. ShopList:SetPos(15,0)
  6312.  
  6313. ShopList:SetSpaceX(5)
  6314.  
  6315. ShopList:SetSpaceY(5)
  6316.  
  6317. ShopList.NextUpdate = CurTime() + 5
  6318.  
  6319.  
  6320.  
  6321. local function ShopInList(ply)
  6322.  
  6323. for k,v in pairs(ShopList:GetChildren()) do
  6324.  
  6325. if (v.ply == ply) then return v end
  6326.  
  6327. end
  6328.  
  6329. return false
  6330.  
  6331. end
  6332.  
  6333.  
  6334.  
  6335. function ShopList:Update()
  6336.  
  6337. local shops = {}
  6338.  
  6339. for k,v in pairs(player.GetAll()) do
  6340.  
  6341. if v.DarkRPVars and v.DarkRPVars.IsShopOpen then
  6342.  
  6343. table.insert(shops, {name = v.DarkRPVars.ShopName or v:Nick().."'s Shop", ply = v })
  6344.  
  6345. end
  6346.  
  6347. end
  6348.  
  6349.  
  6350.  
  6351. if #shops < 1 then ShopList:Clear() msg = "There are currently no shops open on this server."
  6352.  
  6353. else msg = nil end
  6354.  
  6355.  
  6356.  
  6357. for k,v in SortedPairs(shops) do
  6358.  
  6359. local HasShopPanel = ShopInList(v.ply)
  6360.  
  6361. if HasShopPanel and not IsValid(v.ply) then
  6362.  
  6363. HasShopPanel:Remove() continue
  6364.  
  6365. elseif HasShopPanel then
  6366.  
  6367. HasShopPanel.name = v.name continue
  6368.  
  6369. else
  6370.  
  6371. if not IsValid(v.ply) then continue end
  6372.  
  6373. local ShopPanel = ShopList:Add("DButton")
  6374.  
  6375. ShopPanel:SetText("")
  6376.  
  6377. ShopPanel.ply = v.ply
  6378.  
  6379. ShopPanel.name = v.name
  6380.  
  6381. ShopPanel:SetSize((ShopList:GetWide() / 3) - 10,80)
  6382.  
  6383. ShopPanel.Paint = function(s,w,h)
  6384.  
  6385. draw.RoundedBox(4,s:IsDown() and 3 or 0,s:IsDown() and 3 or 0,s:IsDown() and w - 6 or w,s:IsDown() and h - 6 or h,Color(89,89,89))
  6386.  
  6387. if s:IsHovered() then
  6388.  
  6389. draw.RoundedBox(4,s:IsDown() and 3 or 0,s:IsDown() and 3 or 0,s:IsDown() and w - 6 or w,s:IsDown() and h - 6 or h,Color(255,255,255,100))
  6390.  
  6391. end
  6392.  
  6393. draw.SimpleTextOutlined(s.name,"Trebuchet22",36,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6394.  
  6395. draw.SimpleTextOutlined(string.format("Shop Owner: %s",s.ply:Nick()),"Trebuchet20",5,48,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6396.  
  6397. end
  6398.  
  6399.  
  6400.  
  6401. local Icon = vgui.Create("ModelImage", ShopPanel)
  6402.  
  6403. Icon:SetPos(2,2)
  6404.  
  6405. Icon:SetSize(32, 32)
  6406.  
  6407. Icon:SetModel("models/props_c17/cashregister01a.mdl")
  6408.  
  6409.  
  6410.  
  6411. //ShopList:AddItem(ShopPanel)
  6412.  
  6413. //ShopPanel:Dock( TOP )
  6414.  
  6415. //ShopPanel:DockMargin( 5, 5, 5, 5 )
  6416.  
  6417.  
  6418.  
  6419. ShopPanel.DoClick = function()
  6420.  
  6421. RunConsoleCommand("_sendshopdata",v.ply:UserID())
  6422.  
  6423. //zm.Close()
  6424.  
  6425. end
  6426.  
  6427. end
  6428.  
  6429. end
  6430.  
  6431. end
  6432.  
  6433.  
  6434.  
  6435. ShopList.Think = function(s)
  6436.  
  6437. if CurTime() >= s.NextUpdate then
  6438.  
  6439. s.NextUpdate = CurTime() + 5
  6440.  
  6441. s:Update()
  6442.  
  6443. end
  6444.  
  6445. end
  6446.  
  6447.  
  6448.  
  6449. ShopList:Update()
  6450.  
  6451. return BackGround
  6452.  
  6453. end
  6454.  
  6455.  
  6456.  
  6457. function zm.AuctionHouseTab()
  6458.  
  6459. local msg = ""
  6460.  
  6461.  
  6462.  
  6463. local BackGround = vgui.Create("EditablePanel")
  6464.  
  6465. BackGround:MakePopup()
  6466.  
  6467. BackGround:SetSize(890,520)
  6468.  
  6469. BackGround.Paint = function(s,w,h)
  6470.  
  6471. //draw.RoundedBox(4,0,0,w,h,Color(255, 75, 15, 200))
  6472.  
  6473. if msg then draw.SimpleTextOutlined(msg,"Trebuchet24",w*.5,74,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) ) end
  6474.  
  6475. end
  6476.  
  6477. BackGround.Think = function()
  6478.  
  6479. if input.IsKeyDown(zm.key) then zm.Close() end
  6480.  
  6481. end
  6482.  
  6483.  
  6484.  
  6485. local TopBarLayout = vgui.Create( "DIconLayout", BackGround )
  6486.  
  6487. TopBarLayout:SetSize(890,45)
  6488.  
  6489. TopBarLayout.Paint = function(s,w,h)
  6490.  
  6491. draw.RoundedBox( 4, 0, 0, w, h, Color( 128,0,0,200 ))
  6492.  
  6493. end
  6494.  
  6495. //TopBarLayout:SetSpaceY(2)
  6496.  
  6497. TopBarLayout:SetSpaceX(-2)
  6498.  
  6499.  
  6500.  
  6501. local AuctionTabs = {}
  6502.  
  6503. local function ChangeAuctionTab(tab)
  6504.  
  6505. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  6506.  
  6507. msg = nil
  6508.  
  6509. BackGround.CurrentTab = AuctionTabs[tab].func()
  6510.  
  6511.  
  6512.  
  6513. for k,v in pairs(AuctionTabs) do
  6514.  
  6515. v.button.IsSelected = false
  6516.  
  6517. end
  6518.  
  6519. AuctionTabs[tab].button.IsSelected = true
  6520.  
  6521. end
  6522.  
  6523.  
  6524.  
  6525. //Tab buttons
  6526.  
  6527. local AuctionHouseBtn = vgui.Create("DButton", TopBarLayout)
  6528.  
  6529. AuctionHouseBtn:SetText("")
  6530.  
  6531. AuctionHouseBtn:SetSize(200,45)
  6532.  
  6533. AuctionHouseBtn.Paint = function(s,w,h)
  6534.  
  6535. draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
  6536.  
  6537. if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
  6538.  
  6539. surface.SetFont("Trebuchet24")
  6540.  
  6541. local tw,th = surface.GetTextSize("Auction House")
  6542.  
  6543. draw.SimpleTextOutlined("Auction House","Trebuchet24",(w / 2) - (tw / 2),(h / 2),Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6544.  
  6545. end
  6546.  
  6547. AuctionHouseBtn.DoClick = function() ChangeAuctionTab(1) end
  6548.  
  6549.  
  6550.  
  6551. local MyListingsBtn = vgui.Create("DButton", TopBarLayout)
  6552.  
  6553. MyListingsBtn:SetText("")
  6554.  
  6555. MyListingsBtn:SetSize(200,45)
  6556.  
  6557. MyListingsBtn.Paint = function(s,w,h)
  6558.  
  6559. draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
  6560.  
  6561. if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
  6562.  
  6563. surface.SetFont("Trebuchet24")
  6564.  
  6565. local tw,th = surface.GetTextSize("My Listings")
  6566.  
  6567. draw.SimpleTextOutlined("My Listings","Trebuchet24",(w / 2) - (tw / 2),(h / 2),Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6568.  
  6569. end
  6570.  
  6571. MyListingsBtn.DoClick = function() ChangeAuctionTab(2) end
  6572.  
  6573.  
  6574.  
  6575. local MyBidsBtn = vgui.Create("DButton", TopBarLayout)
  6576.  
  6577. MyBidsBtn:SetText("")
  6578.  
  6579. MyBidsBtn:SetSize(200,45)
  6580.  
  6581. MyBidsBtn.Paint = function(s,w,h)
  6582.  
  6583. draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
  6584.  
  6585. if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
  6586.  
  6587. surface.SetFont("Trebuchet24")
  6588.  
  6589. local tw,th = surface.GetTextSize("My Bids")
  6590.  
  6591. draw.SimpleTextOutlined("My Bids","Trebuchet24",(w / 2) - (tw / 2),(h / 2),Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6592.  
  6593. end
  6594.  
  6595. MyBidsBtn.DoClick = function() ChangeAuctionTab(3) end
  6596.  
  6597.  
  6598.  
  6599. local SearchBtn = vgui.Create("DButton", TopBarLayout)
  6600.  
  6601. SearchBtn:SetText("")
  6602.  
  6603. SearchBtn:SetSize(200,45)
  6604.  
  6605. SearchBtn.Paint = function(s,w,h)
  6606.  
  6607. draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
  6608.  
  6609. if s:IsHovered() then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
  6610.  
  6611. surface.SetFont("Trebuchet24")
  6612.  
  6613. local tw,th = surface.GetTextSize("Search")
  6614.  
  6615. draw.SimpleTextOutlined("Search","Trebuchet24",(w / 2) - (tw / 2),(h / 2),Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6616.  
  6617. end
  6618.  
  6619. SearchBtn.DoClick = function()
  6620.  
  6621. Derma_StringRequest("Search Auction House","Enter an item name to search for (e.g. Gluon Gun or weapon_gluongun)","",
  6622.  
  6623. function(val) if (#val < 3) then Derma_Message("You must enter at least 3 characters to search.","Auction Error") return end RunConsoleCommand("_auctionSearch",val) end, function() end, "Search","Cancel")
  6624.  
  6625. end
  6626.  
  6627.  
  6628.  
  6629. local function AddAuctionInfo(pnl, text, icon, textcolor, steamid, wide, parentaction)
  6630.  
  6631. if not pnl then return end
  6632.  
  6633. local infopanel = vgui.Create("DButton",pnl)
  6634.  
  6635. infopanel:SetDrawBackground(false)
  6636.  
  6637. infopanel:SetText("")
  6638.  
  6639. if icon then
  6640.  
  6641. local img = vgui.Create("DImage", infopanel)
  6642.  
  6643. img:SetImage(icon)
  6644.  
  6645. img:SetSize(20,20)
  6646.  
  6647. img:SetPos(2,2)
  6648.  
  6649. elseif steamid then
  6650.  
  6651. local avatar = vgui.Create("AvatarImage",infopanel)
  6652.  
  6653. local btn = vgui.Create("DButton",avatar)
  6654.  
  6655. btn.DoClick = function()
  6656.  
  6657. gui.OpenURL(string.format("http://steamcommunity.com/profiles/%s",steamid))
  6658.  
  6659. end
  6660.  
  6661. btn:SetSize(20,20)
  6662.  
  6663. btn:SetDrawBorder( false )
  6664.  
  6665. btn:SetDrawBackground( false )
  6666.  
  6667. btn:SetKeyboardInputEnabled( false )
  6668.  
  6669. btn:SetText( "" )
  6670.  
  6671. avatar:SetPos(2,2)
  6672.  
  6673. avatar:SetSize(20,20)
  6674.  
  6675. avatar:SetSteamID(steamid, 32)
  6676.  
  6677. end
  6678.  
  6679. local lbl = vgui.Create("DLabel",infopanel)
  6680.  
  6681. lbl:SetFont("Tre22")
  6682.  
  6683. if textcolor then lbl:SetColor(textcolor) end
  6684.  
  6685. lbl:SetPos((icon or steamid) and 25 or 2,0)
  6686.  
  6687. lbl:SetText(text or "")
  6688.  
  6689. lbl:SizeToContents()
  6690.  
  6691. if wide then lbl:SetWide(wide) end
  6692.  
  6693. if parentaction then
  6694.  
  6695. infopanel.DoClick = function() pnl:DoClick() end
  6696.  
  6697. else
  6698.  
  6699. infopanel:SetCursor("arrow")
  6700.  
  6701. end
  6702.  
  6703.  
  6704.  
  6705. infopanel:SetSize(25 + lbl:GetWide(), 24)
  6706.  
  6707. return infopanel
  6708.  
  6709. end
  6710.  
  6711.  
  6712.  
  6713. local function CreateTimeLeftString(timeleft)
  6714.  
  6715. local TimeLeftStr
  6716.  
  6717. if (timeleft < 60) then
  6718.  
  6719. TimeLeftStr = string.format("%i second(s)",math.max(timeleft,0))
  6720.  
  6721. elseif (timeleft < 3600) then
  6722.  
  6723. TimeLeftStr = string.format("%i minute(s)",math.Round(timeleft / 60))
  6724.  
  6725. elseif (timeleft < 86400) then
  6726.  
  6727. TimeLeftStr = string.format("%i hour(s)",math.Round(timeleft / 3600))
  6728.  
  6729. else
  6730.  
  6731. TimeLeftStr = string.format("%i day(s)",math.Round(timeleft / 86400))
  6732.  
  6733. end
  6734.  
  6735. return TimeLeftStr
  6736.  
  6737. end
  6738.  
  6739.  
  6740.  
  6741. local function CreateTimeAgoString(timeago)
  6742.  
  6743. local TimeAgoStr
  6744.  
  6745. if (timeago > 86400) then
  6746.  
  6747. TimeAgoStr = string.format("%i day(s)",math.Round(timeago / 86400))
  6748.  
  6749. elseif (timeago > 3600) then
  6750.  
  6751. TimeAgoStr = string.format("%i hours(s)",math.Round(timeago / 3600))
  6752.  
  6753. elseif (timeago > 60) then
  6754.  
  6755. TimeAgoStr = string.format("%i minutes(s)",math.Round(timeago / 60))
  6756.  
  6757. else
  6758.  
  6759. TimeAgoStr = string.format("%i seconds(s)",math.max(timeago,1))
  6760.  
  6761. end
  6762.  
  6763. return TimeAgoStr
  6764.  
  6765. end
  6766.  
  6767.  
  6768.  
  6769. local function AuctionListingTab(id)
  6770.  
  6771. local function PopulateListing(len)
  6772.  
  6773. msg = nil
  6774.  
  6775. local listing = net.ReadTable()
  6776.  
  6777. local bidhistory = net.ReadTable()
  6778.  
  6779. if not listing or (table.Count(listing) <= 1) then msg = "Invalid Auction ID" return end
  6780.  
  6781. if not listing.Owner or not listing.TimeLeft or not listing.LastBid then return end
  6782.  
  6783. local ItemTbl = LDRP_SH.AllItems[listing.Item]
  6784.  
  6785. if !ItemTbl then return end
  6786.  
  6787. local Name = ItemTbl.nicename or listing.Item
  6788.  
  6789. Name = LDRP_SH.NicerWepNames[Name] or Name
  6790.  
  6791. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  6792.  
  6793. local ListPanel = vgui.Create("DPanel", BackGround)
  6794.  
  6795. ListPanel:SetPos(0,50)
  6796.  
  6797. ListPanel:SetSize(890,540)
  6798.  
  6799. ListPanel.Paint = function()
  6800.  
  6801. draw.RoundedBox( 4, 0, 2, 890, 180, Color( 64,64,64 )) --Item details
  6802.  
  6803. draw.RoundedBox( 4, 0, 185, 890, 40, Color( 64,64,64 )) --Place bid strip
  6804.  
  6805. //draw.RoundedBox( 4, 0, 228, 890, 320, Color( 128,0,0,150 )) --Bid history
  6806.  
  6807. draw.SimpleTextOutlined(Name,"Trebuchet24",3,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6808.  
  6809. draw.SimpleTextOutlined("Bid History (Last 10)","Trebuchet24",3,240,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6810.  
  6811. end
  6812.  
  6813. BackGround.CurrentTab = ListPanel
  6814.  
  6815.  
  6816.  
  6817. local ItemIcon = CreateIcon(ListPanel,ItemTbl.mdl,150,150,function() end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,listing.Item)
  6818.  
  6819. ItemIcon:SetPos(3,28)
  6820.  
  6821.  
  6822.  
  6823. local ListingInfoLayout = vgui.Create("DListLayout",ListPanel)
  6824.  
  6825. ListingInfoLayout:SetPos(158,28)
  6826.  
  6827. ListingInfoLayout:SetSize(732, 152)
  6828.  
  6829.  
  6830.  
  6831. AddAuctionInfo(ListingInfoLayout,string.format("Owner: %s", listing.Owner), nil, color_white, listing.SteamID)
  6832.  
  6833. AddAuctionInfo(ListingInfoLayout,string.format("Description: %s",ItemTbl.descr or "N/A"), "icon16/tag_blue.png",color_white,nil,710)
  6834.  
  6835. AddAuctionInfo(ListingInfoLayout,string.format("Time Left: %s",CreateTimeLeftString(listing.TimeLeft)), "icon16/clock.png",color_white)
  6836.  
  6837. AddAuctionInfo(ListingInfoLayout,string.format("Last Bid $%s",string.Comma(listing.LastBid)), "icon16/money.png",color_white)
  6838.  
  6839. AddAuctionInfo(ListingInfoLayout,string.format("Current Price: $%s",string.Comma(listing.LastBid + listing.Increment)), "icon16/money_add.png",color_white)
  6840.  
  6841. AddAuctionInfo(ListingInfoLayout,string.format("Item Weight: %s",ItemTbl.weight or 0), "icon16/box.png",color_white)
  6842.  
  6843.  
  6844.  
  6845. //Place bid strip
  6846.  
  6847. local PlaceBidLbl = vgui.Create("DLabel",ListPanel)
  6848.  
  6849. PlaceBidLbl:SetPos(3, 193)
  6850.  
  6851. PlaceBidLbl:SetFont("Tre22")
  6852.  
  6853. PlaceBidLbl:SetColor(color_white)
  6854.  
  6855. PlaceBidLbl:SetText("Bid Amount ($):")
  6856.  
  6857. PlaceBidLbl:SizeToContents()
  6858.  
  6859.  
  6860.  
  6861. local BidAmount = vgui.Create("DNumberWang",ListPanel)
  6862.  
  6863. BidAmount:SetPos(6 + PlaceBidLbl:GetWide(), 188)
  6864.  
  6865. BidAmount:SetSize(192,32)
  6866.  
  6867. BidAmount:SetFont("Tre22")
  6868.  
  6869. BidAmount:SetText(listing.LastBid + listing.Increment)
  6870.  
  6871. BidAmount:SetMinMax((listing.LastBid + listing.Increment),2000000000)
  6872.  
  6873.  
  6874.  
  6875. local PlaceBidBtn = vgui.Create("DButton",ListPanel)
  6876.  
  6877. PlaceBidBtn:SetPos(3 + (BidAmount:GetPos() + BidAmount:GetWide()), 188)
  6878.  
  6879. PlaceBidBtn:SetSize(100,32)
  6880.  
  6881. PlaceBidBtn:SetText("")
  6882.  
  6883. PlaceBidBtn.Paint = function(s,w,h)
  6884.  
  6885. surface.SetDrawColor(Color( 128,0,0,200 ))
  6886.  
  6887. surface.DrawRect( 0,0,w,h )
  6888.  
  6889. if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
  6890.  
  6891. draw.SimpleTextOutlined("Place a Bid","Tre22",50,16,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  6892.  
  6893. if s:GetDisabled() then
  6894.  
  6895. surface.SetDrawColor(Color(100,100,100,240))
  6896.  
  6897. surface.DrawRect( 0,0,w,h )
  6898.  
  6899. end
  6900.  
  6901. end
  6902.  
  6903. PlaceBidBtn.DoClick = function(s)
  6904.  
  6905. if PlaceBidBtn.NextPress and (CurTime() < PlaceBidBtn.NextPress) then return end
  6906.  
  6907. PlaceBidBtn.NextPress = (CurTime() + 2)
  6908.  
  6909. if (BidAmount:GetValue() < BidAmount:GetMin()) then
  6910.  
  6911. Derma_Message(string.format("You must enter a bid of at least $%s or more.",string.Comma(BidAmount:GetMin())),"Auction Error")
  6912.  
  6913. elseif (BidAmount:GetValue() > BidAmount:GetMax()) then
  6914.  
  6915. Derma_Message(string.format("You cannot bid more than %s.",string.Comma(BidAmount:GetMax())),"Auction Error")
  6916.  
  6917. else
  6918.  
  6919. s.PermaDisabled = true
  6920.  
  6921. s:SetDisabled(true)
  6922.  
  6923. RunConsoleCommand("_auctionBid", id, BidAmount:GetValue())
  6924.  
  6925. end
  6926.  
  6927. end
  6928.  
  6929. PlaceBidBtn.Think = function(s)
  6930.  
  6931. if s.PermaDisabled then return end
  6932.  
  6933. if LocalPlayer().DarkRPVars.money < BidAmount:GetValue() then
  6934.  
  6935. PlaceBidBtn:SetTooltip("You cannot afford this bid amount.")
  6936.  
  6937. PlaceBidBtn:SetDisabled(true)
  6938.  
  6939. else PlaceBidBtn:SetTooltip(nil) PlaceBidBtn:SetDisabled(false) end
  6940.  
  6941. end
  6942.  
  6943. if (LocalPlayer():SteamID64() == listing.SteamID) then
  6944.  
  6945. PlaceBidBtn.PermaDisabled = true PlaceBidBtn:SetTooltip("You cannot bid on your own items.") PlaceBidBtn:SetDisabled(true)
  6946.  
  6947. elseif bidhistory and bidhistory[1] and (LocalPlayer():SteamID64() == bidhistory[1].SteamID) then
  6948.  
  6949. PlaceBidBtn.PermaDisabled = true PlaceBidBtn:SetTooltip("You cannot bid twice in a row.") PlaceBidBtn:SetDisabled(true)
  6950.  
  6951. elseif (listing.TimeLeft <= 0) then
  6952.  
  6953. PlaceBidBtn.PermaDisabled = true PlaceBidBtn:SetTooltip("This listing has now closed.") PlaceBidBtn:SetDisabled(true)
  6954.  
  6955. end
  6956.  
  6957.  
  6958.  
  6959. //Bid history
  6960.  
  6961. local BidderHeader = AddAuctionInfo(ListPanel, "Bidder", "icon16/user.png", color_white)
  6962.  
  6963. BidderHeader:SetPos(-3, 251)
  6964.  
  6965. local AmountHeader = AddAuctionInfo(ListPanel, "Amount", "icon16/money.png", color_white)
  6966.  
  6967. AmountHeader:SetPos(200, 251)
  6968.  
  6969. local TimeHeader = AddAuctionInfo(ListPanel, "Time", "icon16/clock.png", color_white)
  6970.  
  6971. TimeHeader:SetPos(335, 251)
  6972.  
  6973.  
  6974.  
  6975. local BidsPnl = vgui.Create("DScrollPanel", ListPanel)
  6976.  
  6977. BidsPnl:SetPos(-3,274)
  6978.  
  6979. BidsPnl:SetSize(520,198)
  6980.  
  6981. BidsPnl:SetPadding(15)
  6982.  
  6983.  
  6984.  
  6985. local oddrow = true
  6986.  
  6987. for k,v in pairs(bidhistory) do
  6988.  
  6989. if not v.Name or not v.Amount or not v.TimeAgo then continue end
  6990.  
  6991. local Bid = vgui.Create("DPanel")
  6992.  
  6993. Bid:SetSize(500, 24)
  6994.  
  6995. Bid.Paint = function(s,w,h)
  6996.  
  6997. draw.RoundedBox(4,0,0,w,h,s.OddRow and Color(89,89,89) or Color(255,255,255,0))
  6998.  
  6999. end
  7000.  
  7001. Bid.OddRow = oddrow
  7002.  
  7003.  
  7004.  
  7005. local Bidder = AddAuctionInfo(Bid, v.Name, nil, color_white, v.SteamID, 170)
  7006.  
  7007. Bidder:SetPos(2, 0)
  7008.  
  7009.  
  7010.  
  7011. local Amount = AddAuctionInfo(Bid, string.format("$%s",string.Comma(v.Amount)), nil, color_white, nil, 130)
  7012.  
  7013. Amount:SetPos(197, 2)
  7014.  
  7015.  
  7016.  
  7017. local Amount = AddAuctionInfo(Bid, string.format("%s ago",CreateTimeAgoString(v.TimeAgo)), nil, color_white, nil, 150)
  7018.  
  7019. Amount:SetPos(332, 2)
  7020.  
  7021.  
  7022.  
  7023. BidsPnl:AddItem(Bid)
  7024.  
  7025. Bid:Dock( TOP )
  7026.  
  7027. Bid:DockMargin( 4, 0, 0, 4 )
  7028.  
  7029. oddrow = !oddrow
  7030.  
  7031. end
  7032.  
  7033. if #bidhistory <= 0 then
  7034.  
  7035. local Bid = vgui.Create("DPanel")
  7036.  
  7037. Bid:SetSize(500, 24)
  7038.  
  7039. Bid.Paint = function(s,w,h)
  7040.  
  7041. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  7042.  
  7043. end
  7044.  
  7045.  
  7046.  
  7047. local Notice = AddAuctionInfo(Bid, "No bid yet on this item.", nil, color_white, nil, 300)
  7048.  
  7049. Notice:SetPos(2, 0)
  7050.  
  7051. BidsPnl:AddItem(Bid)
  7052.  
  7053. Bid:Dock( TOP )
  7054.  
  7055. Bid:DockMargin( 4, 0, 0, 4 )
  7056.  
  7057. end
  7058.  
  7059.  
  7060.  
  7061. end
  7062.  
  7063. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  7064.  
  7065. msg = "Retreiving listing..."
  7066.  
  7067. RunConsoleCommand("_requestAuctionListing", id)
  7068.  
  7069. net.Receive("Auction_Listing", function(len)
  7070.  
  7071. if IsValid(BackGround) then PopulateListing(len) end
  7072.  
  7073. end)
  7074.  
  7075. end
  7076.  
  7077.  
  7078.  
  7079. local function AuctionHouseTab(listings)
  7080.  
  7081. local function PopulateListings(len, searchlistings)
  7082.  
  7083. msg = nil
  7084.  
  7085. local listings = len and net.ReadTable()
  7086.  
  7087. local page = len and net.ReadUInt(16)
  7088.  
  7089. local totallistings = searchlistings and #searchlistings or net.ReadUInt(16)
  7090.  
  7091. local totalpages = math.ceil(totallistings / 20)
  7092.  
  7093. if not listings then return end
  7094.  
  7095.  
  7096.  
  7097. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  7098.  
  7099. local ListPanel = vgui.Create("DPanel", BackGround)
  7100.  
  7101. ListPanel:SetDrawBackground(false)
  7102.  
  7103. ListPanel:SetPos(0,50)
  7104.  
  7105. ListPanel:SetSize(890,540)
  7106.  
  7107.  
  7108.  
  7109. local ItemHeader = AddAuctionInfo(ListPanel, "Item", "zarp/zarp-auctionhouseicon.png", color_white)
  7110.  
  7111. ItemHeader:SetPos(3, 0)
  7112.  
  7113. local ItemOwner = AddAuctionInfo(ListPanel, "Owner", "icon16/user_gray.png", color_white)
  7114.  
  7115. ItemOwner:SetPos(208, 0)
  7116.  
  7117. local TimeLeft = AddAuctionInfo(ListPanel, "Time Left", "icon16/clock.png", color_white)
  7118.  
  7119. TimeLeft:SetPos(363, 0)
  7120.  
  7121. local LastBid = AddAuctionInfo(ListPanel, "Last Bid", "icon16/money.png", color_white)
  7122.  
  7123. LastBid:SetPos(468, 0)
  7124.  
  7125. local CurrentPrice = AddAuctionInfo(ListPanel, "Current Price", "icon16/money_add.png", color_white)
  7126.  
  7127. CurrentPrice:SetPos(603, 0)
  7128.  
  7129. local CurrentPrice = AddAuctionInfo(ListPanel, "Last Bidder", "icon16/user.png", color_white)
  7130.  
  7131. CurrentPrice:SetPos(738, 0)
  7132.  
  7133.  
  7134.  
  7135. BackGround.CurrentTab = ListPanel
  7136.  
  7137. local ListingsPnl = vgui.Create("DScrollPanel", ListPanel)
  7138.  
  7139. ListingsPnl:SetPos(0,25)
  7140.  
  7141. ListingsPnl:SetSize(890,420)
  7142.  
  7143. ListingsPnl:SetPadding(15)
  7144.  
  7145. for k,v in pairs(searchlistings or listings) do
  7146.  
  7147. if not v.Owner or not v.TimeLeft or not v.LastBid then continue end
  7148.  
  7149. local ItemTbl = LDRP_SH.AllItems[v.Item]
  7150.  
  7151. if !ItemTbl then continue end
  7152.  
  7153.  
  7154.  
  7155. local Name = ItemTbl.nicename or v.item
  7156.  
  7157. Name = LDRP_SH.NicerWepNames[Name] or Name
  7158.  
  7159.  
  7160.  
  7161. local Listing = vgui.Create("DButton")
  7162.  
  7163. Listing:SetSize(880,50)
  7164.  
  7165. Listing:SetText("")
  7166.  
  7167. Listing.Paint = function(s,w,h)
  7168.  
  7169. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  7170.  
  7171. if (s:IsHovered() or s:IsChildHovered(1)) then draw.RoundedBox( 4, 0, 0, w, h, Color(255,255,255,30)) end
  7172.  
  7173. //draw.RoundedBox(4,72,35,w - 77,30,Color(255,255,255,50)) -- Description background
  7174.  
  7175. //draw.SimpleTextOutlined(Name,"Trebuchet24",72,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7176.  
  7177. end
  7178.  
  7179.  
  7180.  
  7181. local ItemIcon = CreateIcon(Listing,ItemTbl.mdl,46,46,function() Listing:DoClick() end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,v.Item)
  7182.  
  7183. ItemIcon:SetPos(2,2)
  7184.  
  7185.  
  7186.  
  7187. -- local InfoLayout = vgui.Create("DIconLayout",Listing)
  7188.  
  7189. -- InfoLayout:SetPos(77,38)
  7190.  
  7191. -- InfoLayout:SetSize(700, 24)
  7192.  
  7193.  
  7194.  
  7195. local ItemName = AddAuctionInfo(Listing, Name, nil, color_white, nil, 150, true)
  7196.  
  7197. ItemName:SetPos(50, 12)
  7198.  
  7199.  
  7200.  
  7201. local Owner = AddAuctionInfo(Listing, v.Owner, nil, color_white, nil, 150, true)
  7202.  
  7203. Owner:SetPos(205, 12)
  7204.  
  7205.  
  7206.  
  7207. local TimeLeft = AddAuctionInfo(Listing, CreateTimeLeftString(v.TimeLeft), nil, color_white, nil, 100, true)
  7208.  
  7209. TimeLeft:SetPos(360, 12)
  7210.  
  7211.  
  7212.  
  7213. local LastBid = AddAuctionInfo(Listing, string.format("$%s",string.Comma(v.LastBid)), nil, color_white, nil, 130, true)
  7214.  
  7215. LastBid:SetPos(465, 12)
  7216.  
  7217.  
  7218.  
  7219. local CurrentPrice = AddAuctionInfo(Listing, string.format("$%s",string.Comma(v.LastBid + v.Increment)), nil, color_white, nil, 130, true)
  7220.  
  7221. CurrentPrice:SetPos(600, 12)
  7222.  
  7223.  
  7224.  
  7225. local LastBidder = AddAuctionInfo(Listing, v.LastBidder or "Nobody", nil, color_white, nil, 130, true)
  7226.  
  7227. LastBidder:SetPos(735, 12)
  7228.  
  7229. //AddAuctionInfo(InfoLayout,string.format("Owner: %s", v.OwnerName),"icon16/user_gray.png",color_white)
  7230.  
  7231. //AddAuctionInfo(InfoLayout,string.format("Time Left: %s", TimeLeftStr),"icon16/clock.png",color_white)
  7232.  
  7233. //AddAuctionInfo(InfoLayout,string.format("Last Bid $%s", string.Comma(v.LastBid)),"icon16/money.png",color_white)
  7234.  
  7235. //AddAuctionInfo(InfoLayout,string.format("Current Price: %s", string.Comma(v.LastBid + v.Increment)),"icon16/money_add.png",color_white)
  7236.  
  7237. //AddAuctionInfo(InfoLayout,string.format("Last Bidder: %s", v.LastBidder),"icon16/user.png",color_white)
  7238.  
  7239.  
  7240.  
  7241. Listing.DoClick = function()
  7242.  
  7243. AuctionListingTab(v.ID)
  7244.  
  7245. end
  7246.  
  7247.  
  7248.  
  7249. ListingsPnl:AddItem(Listing)
  7250.  
  7251. Listing:Dock( TOP )
  7252.  
  7253. Listing:DockMargin( 4, 0, 0, 4 )
  7254.  
  7255. end
  7256.  
  7257.  
  7258.  
  7259. //Paging panel
  7260.  
  7261. local function ChangePage(page)
  7262.  
  7263. BackGround.CurrentTab:Remove()
  7264.  
  7265. msg = "Retreiving listings..."
  7266.  
  7267. RunConsoleCommand("_requestAuctionListings", tostring(page))
  7268.  
  7269. end
  7270.  
  7271.  
  7272.  
  7273. local PagingLbl = vgui.Create("DLabel",ListPanel)
  7274.  
  7275. PagingLbl:SetFont("Trebuchet22")
  7276.  
  7277. if searchlistings or (page == 0) then
  7278.  
  7279. page = 1
  7280.  
  7281. PagingLbl:SetText(string.format("%i search results (Showing first 20 matches.)",searchlistings and #searchlistings or #listings))
  7282.  
  7283. else
  7284.  
  7285. PagingLbl:SetText(string.format("Page %s of %s (%s total listing(s))",page,totalpages,totallistings))
  7286.  
  7287. end
  7288.  
  7289. PagingLbl:SizeToContents()
  7290.  
  7291. PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
  7292.  
  7293.  
  7294.  
  7295. //Back
  7296.  
  7297. local BackBtn = vgui.Create("DButton",ListPanel)
  7298.  
  7299. BackBtn:SetPos(PagingLbl:GetPos() - 35,450)
  7300.  
  7301. BackBtn:SetSize(30,20)
  7302.  
  7303. BackBtn:SetText("")
  7304.  
  7305. BackBtn.Paint = function(s,w,h)
  7306.  
  7307. surface.SetDrawColor(Color(150,150,150,255))
  7308.  
  7309. surface.DrawRect( 0,0,w,h )
  7310.  
  7311. draw.SimpleTextOutlined("<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7312.  
  7313. if s:GetDisabled() then
  7314.  
  7315. surface.SetDrawColor(Color(100,100,100,240))
  7316.  
  7317. surface.DrawRect( 0,0,w,h )
  7318.  
  7319. end
  7320.  
  7321. end
  7322.  
  7323. BackBtn.DoClick = function()
  7324.  
  7325. ChangePage(page - 1)
  7326.  
  7327. end
  7328.  
  7329. if (page == 1) then BackBtn:SetDisabled(true) end
  7330.  
  7331.  
  7332.  
  7333. local BackAllBtn = vgui.Create("DButton",ListPanel)
  7334.  
  7335. BackAllBtn:SetPos(PagingLbl:GetPos() - 70,450)
  7336.  
  7337. BackAllBtn:SetSize(30,20)
  7338.  
  7339. BackAllBtn:SetText("")
  7340.  
  7341. BackAllBtn.Paint = function(s,w,h)
  7342.  
  7343. surface.SetDrawColor(Color(150,150,150,255))
  7344.  
  7345. surface.DrawRect( 0,0,w,h )
  7346.  
  7347. draw.SimpleTextOutlined("<<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7348.  
  7349. if s:GetDisabled() then
  7350.  
  7351. surface.SetDrawColor(Color(100,100,100,240))
  7352.  
  7353. surface.DrawRect( 0,0,w,h )
  7354.  
  7355. end
  7356.  
  7357. end
  7358.  
  7359. BackAllBtn.DoClick = function()
  7360.  
  7361. ChangePage(1)
  7362.  
  7363. end
  7364.  
  7365. if (page == 1) then BackAllBtn:SetDisabled(true) end
  7366.  
  7367. //Forward
  7368.  
  7369. local ForwardBtn = vgui.Create("DButton",ListPanel)
  7370.  
  7371. ForwardBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 5,450)
  7372.  
  7373. ForwardBtn:SetSize(30,20)
  7374.  
  7375. ForwardBtn:SetText("")
  7376.  
  7377. ForwardBtn.Paint = function(s,w,h)
  7378.  
  7379. surface.SetDrawColor(Color(150,150,150,255))
  7380.  
  7381. surface.DrawRect( 0,0,w,h )
  7382.  
  7383. draw.SimpleTextOutlined(">","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7384.  
  7385. if s:GetDisabled() then
  7386.  
  7387. surface.SetDrawColor(Color(100,100,100,240))
  7388.  
  7389. surface.DrawRect( 0,0,w,h )
  7390.  
  7391. end
  7392.  
  7393. end
  7394.  
  7395. ForwardBtn.DoClick = function()
  7396.  
  7397. ChangePage(page + 1)
  7398.  
  7399. end
  7400.  
  7401. if (page == totalpages) then ForwardBtn:SetDisabled(true) end
  7402.  
  7403.  
  7404.  
  7405. local ForwardAllBtn = vgui.Create("DButton",ListPanel)
  7406.  
  7407. ForwardAllBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 40,450)
  7408.  
  7409. ForwardAllBtn:SetSize(30,20)
  7410.  
  7411. ForwardAllBtn:SetText("")
  7412.  
  7413. ForwardAllBtn.Paint = function(s,w,h)
  7414.  
  7415. surface.SetDrawColor(Color(150,150,150,255))
  7416.  
  7417. surface.DrawRect( 0,0,w,h )
  7418.  
  7419. draw.SimpleTextOutlined(">>","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7420.  
  7421. if s:GetDisabled() then
  7422.  
  7423. surface.SetDrawColor(Color(100,100,100,240))
  7424.  
  7425. surface.DrawRect( 0,0,w,h )
  7426.  
  7427. end
  7428.  
  7429. end
  7430.  
  7431. ForwardAllBtn.DoClick = function()
  7432.  
  7433. ChangePage(totalpages)
  7434.  
  7435. end
  7436.  
  7437. if (page == totalpages) then ForwardAllBtn:SetDisabled(true) end
  7438.  
  7439. end
  7440.  
  7441. if listings then PopulateListings(nil, listings) return end
  7442.  
  7443. msg = "Retreiving listings..."
  7444.  
  7445. RunConsoleCommand("_requestAuctionListings", 1)
  7446.  
  7447. net.Receive("Auction_Listings", function(len)
  7448.  
  7449. if IsValid(BackGround) then PopulateListings(len) end
  7450.  
  7451. end)
  7452.  
  7453. end
  7454.  
  7455.  
  7456.  
  7457. local function BidsTab()
  7458.  
  7459. local function PopulateBids(len)
  7460.  
  7461. msg = nil
  7462.  
  7463. local bids = net.ReadTable()
  7464.  
  7465. local page = net.ReadUInt(16)
  7466.  
  7467. if (page == 0) then AuctionHouseTab(bids) return end
  7468.  
  7469. if not bids then return end
  7470.  
  7471.  
  7472.  
  7473. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  7474.  
  7475. local ListPanel = vgui.Create("DPanel", BackGround)
  7476.  
  7477. ListPanel:SetDrawBackground(false)
  7478.  
  7479. ListPanel:SetPos(0,50)
  7480.  
  7481. ListPanel:SetSize(890,540)
  7482.  
  7483.  
  7484.  
  7485. local ItemHeader = AddAuctionInfo(ListPanel, "Item", "zarp/zarp-auctionhouseicon.png", color_white)
  7486.  
  7487. ItemHeader:SetPos(3, 0)
  7488.  
  7489. local ItemOwner = AddAuctionInfo(ListPanel, "Owner", "icon16/user_gray.png", color_white)
  7490.  
  7491. ItemOwner:SetPos(208, 0)
  7492.  
  7493. local TimeLeft = AddAuctionInfo(ListPanel, "Time Left", "icon16/clock.png", color_white)
  7494.  
  7495. TimeLeft:SetPos(363, 0)
  7496.  
  7497. local LastBid = AddAuctionInfo(ListPanel, "My Last Bid", "icon16/money.png", color_white)
  7498.  
  7499. LastBid:SetPos(468 ,0)
  7500.  
  7501.  
  7502.  
  7503. BackGround.CurrentTab = ListPanel
  7504.  
  7505. local ListingsPnl = vgui.Create("DScrollPanel", ListPanel)
  7506.  
  7507. ListingsPnl:SetPos(0,25)
  7508.  
  7509. ListingsPnl:SetSize(890,420)
  7510.  
  7511. ListingsPnl:SetPadding(15)
  7512.  
  7513. local function AddBids()
  7514.  
  7515. ListingsPnl:Clear()
  7516.  
  7517. for k,v in pairs(bids) do
  7518.  
  7519. if not v.Item or not v.Owner or not v.TimeLeft or not v.Amount then continue end
  7520.  
  7521. local ItemTbl = LDRP_SH.AllItems[v.Item]
  7522.  
  7523. if !ItemTbl then continue end
  7524.  
  7525.  
  7526.  
  7527. local Name = ItemTbl.nicename or v.item
  7528.  
  7529. Name = LDRP_SH.NicerWepNames[Name] or Name
  7530.  
  7531.  
  7532.  
  7533. local Bid = vgui.Create("DButton")
  7534.  
  7535. Bid:SetSize(880,50)
  7536.  
  7537. Bid:SetText("")
  7538.  
  7539. Bid.Paint = function(s,w,h)
  7540.  
  7541. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  7542.  
  7543. if (s:IsHovered() or s:IsChildHovered(1)) then draw.RoundedBox( 4, 0, 0, w, h, Color(255,255,255,30)) end
  7544.  
  7545. //draw.RoundedBox(4,72,35,w - 77,30,Color(255,255,255,50)) -- Description background
  7546.  
  7547. //draw.SimpleTextOutlined(Name,"Trebuchet24",72,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7548.  
  7549. end
  7550.  
  7551.  
  7552.  
  7553. local ItemIcon = CreateIcon(Bid,ItemTbl.mdl,46,46,function() AuctionListingTab(v.ID) end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,v.Item)
  7554.  
  7555. ItemIcon:SetPos(2,2)
  7556.  
  7557.  
  7558.  
  7559. -- local InfoLayout = vgui.Create("DIconLayout",Listing)
  7560.  
  7561. -- InfoLayout:SetPos(77,38)
  7562.  
  7563. -- InfoLayout:SetSize(700, 24)
  7564.  
  7565.  
  7566.  
  7567. local ItemName = AddAuctionInfo(Bid, Name, nil, color_white, nil, 150, true)
  7568.  
  7569. ItemName:SetPos(50, 12)
  7570.  
  7571.  
  7572.  
  7573. local Owner = AddAuctionInfo(Bid, v.Owner, nil, color_white, nil, 150, true)
  7574.  
  7575. Owner:SetPos(205, 12)
  7576.  
  7577.  
  7578.  
  7579. if (v.Status == 1) then
  7580.  
  7581. local TimeLeft = AddAuctionInfo(Bid, (v.TimeLeft <= 0) and "Processing" or CreateTimeLeftString(v.TimeLeft), nil, color_white, nil, 100, true)
  7582.  
  7583. TimeLeft:SetPos(360, 12)
  7584.  
  7585. elseif (v.Status == 2) then
  7586.  
  7587. local ClaimBtn = vgui.Create("DButton",Bid)
  7588.  
  7589. ClaimBtn:SetPos(360,12)
  7590.  
  7591. ClaimBtn:SetSize(100,25)
  7592.  
  7593. ClaimBtn:SetText("")
  7594.  
  7595. ClaimBtn.Paint = function(s,w,h)
  7596.  
  7597. draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
  7598.  
  7599. if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
  7600.  
  7601. draw.SimpleTextOutlined("Claim Item","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7602.  
  7603. end
  7604.  
  7605. ClaimBtn.DoClick = function() RunConsoleCommand("_bidAction", "claim", v.ID) table.remove(bids, k) AddBids(bids) end
  7606.  
  7607. elseif (v.Status == 3) then
  7608.  
  7609. local ReclaimBtn = vgui.Create("DButton",Bid)
  7610.  
  7611. ReclaimBtn:SetPos(360,12)
  7612.  
  7613. ReclaimBtn:SetSize(100,25)
  7614.  
  7615. ReclaimBtn:SetText("")
  7616.  
  7617. ReclaimBtn.Paint = function(s,w,h)
  7618.  
  7619. draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
  7620.  
  7621. if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
  7622.  
  7623. draw.SimpleTextOutlined("Re-claim Funds","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7624.  
  7625. end
  7626.  
  7627. ReclaimBtn.DoClick = function() RunConsoleCommand("_bidAction", "reclaim", v.ID) table.remove(bids, k) AddBids(bids) end
  7628.  
  7629. end
  7630.  
  7631.  
  7632.  
  7633. local LastBid = AddAuctionInfo(Bid, string.format("$%s",string.Comma(v.Amount)), nil, color_white, nil, 130, true)
  7634.  
  7635. LastBid:SetPos(465, 12)
  7636.  
  7637.  
  7638.  
  7639. ListingsPnl:AddItem(Bid)
  7640.  
  7641. Bid:Dock( TOP )
  7642.  
  7643. Bid:DockMargin( 4, 0, 0, 4 )
  7644.  
  7645. end
  7646.  
  7647. end
  7648.  
  7649. AddBids(bids)
  7650.  
  7651. local PagingLbl = vgui.Create("DLabel",ListPanel)
  7652.  
  7653. PagingLbl:SetFont("Trebuchet22")
  7654.  
  7655. PagingLbl:SetText(string.format("%i Bids Listed (20 Oldest shown only)",#bids))
  7656.  
  7657. PagingLbl:SizeToContents()
  7658.  
  7659. PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
  7660.  
  7661. end
  7662.  
  7663.  
  7664.  
  7665. msg = "Retreiving bids..."
  7666.  
  7667. RunConsoleCommand("_requestMyBids", 1)
  7668.  
  7669. net.Receive("Auction_Listings", function(len)
  7670.  
  7671. if IsValid(BackGround) then PopulateBids(len) end
  7672.  
  7673. end)
  7674.  
  7675. end
  7676.  
  7677.  
  7678.  
  7679. local function ListingsTab()
  7680.  
  7681. local function PopulateListings(len)
  7682.  
  7683. msg = nil
  7684.  
  7685. local listings = net.ReadTable()
  7686.  
  7687. local page = net.ReadUInt(16)
  7688.  
  7689. if (page == 0) then AuctionHouseTab(listings) return end
  7690.  
  7691. if not listings then return end
  7692.  
  7693.  
  7694.  
  7695. if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
  7696.  
  7697. local ListPanel = vgui.Create("DPanel", BackGround)
  7698.  
  7699. ListPanel:SetDrawBackground(false)
  7700.  
  7701. ListPanel:SetPos(0,50)
  7702.  
  7703. ListPanel:SetSize(890,540)
  7704.  
  7705.  
  7706.  
  7707. local ItemHeader = AddAuctionInfo(ListPanel, "Item", "zarp/zarp-auctionhouseicon.png", color_white)
  7708.  
  7709. ItemHeader:SetPos(3, 0)
  7710.  
  7711. local ItemOwner = AddAuctionInfo(ListPanel, "Owner", "icon16/user_gray.png", color_white)
  7712.  
  7713. ItemOwner:SetPos(208, 0)
  7714.  
  7715. local TimeLeft = AddAuctionInfo(ListPanel, "Time Left", "icon16/clock.png", color_white)
  7716.  
  7717. TimeLeft:SetPos(363, 0)
  7718.  
  7719. local LastBid = AddAuctionInfo(ListPanel, "Last Bid", "icon16/money.png", color_white)
  7720.  
  7721. LastBid:SetPos(468, 0)
  7722.  
  7723. local CurrentPrice = AddAuctionInfo(ListPanel, "Current Price", "icon16/money_add.png", color_white)
  7724.  
  7725. CurrentPrice:SetPos(603, 0)
  7726.  
  7727. local CurrentPrice = AddAuctionInfo(ListPanel, "Last Bidder", "icon16/user.png", color_white)
  7728.  
  7729. CurrentPrice:SetPos(738, 0)
  7730.  
  7731.  
  7732.  
  7733. BackGround.CurrentTab = ListPanel
  7734.  
  7735. local ListingsPnl = vgui.Create("DScrollPanel", ListPanel)
  7736.  
  7737. ListingsPnl:SetPos(0,25)
  7738.  
  7739. ListingsPnl:SetSize(890,420)
  7740.  
  7741. ListingsPnl:SetPadding(15)
  7742.  
  7743.  
  7744.  
  7745. local function AddListings(listings)
  7746.  
  7747. ListingsPnl:Clear()
  7748.  
  7749. for k,v in pairs(listings) do
  7750.  
  7751. if not v.Item or not v.LastBid then continue end
  7752.  
  7753. local ItemTbl = LDRP_SH.AllItems[v.Item]
  7754.  
  7755. if !ItemTbl then continue end
  7756.  
  7757.  
  7758.  
  7759.  
  7760.  
  7761. local Name = ItemTbl.nicename or v.item
  7762.  
  7763. Name = LDRP_SH.NicerWepNames[Name] or Name
  7764.  
  7765.  
  7766.  
  7767. local Listing = vgui.Create("DPanel")
  7768.  
  7769. Listing:SetSize(880,50)
  7770.  
  7771. Listing:SetText("")
  7772.  
  7773. Listing.Paint = function(s,w,h)
  7774.  
  7775. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  7776.  
  7777. if (s:IsHovered() or s:IsChildHovered(1)) then draw.RoundedBox( 4, 0, 0, w, h, Color(255,255,255,30)) end
  7778.  
  7779. //draw.RoundedBox(4,72,35,w - 77,30,Color(255,255,255,50)) -- Description background
  7780.  
  7781. //draw.SimpleTextOutlined(Name,"Trebuchet24",72,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7782.  
  7783. end
  7784.  
  7785.  
  7786.  
  7787. local ItemIcon = CreateIcon(Listing,ItemTbl.mdl,46,46,function() AuctionListingTab(v.ID) end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,v.Item)
  7788.  
  7789. ItemIcon:SetPos(2,2)
  7790.  
  7791.  
  7792.  
  7793. local ItemName = AddAuctionInfo(Listing, Name, nil, color_white, nil, 150)
  7794.  
  7795. ItemName:SetPos(50, 12)
  7796.  
  7797.  
  7798.  
  7799. local Owner = AddAuctionInfo(Listing, LocalPlayer():Nick(), nil, color_white, nil, 150)
  7800.  
  7801. Owner:SetPos(205, 12)
  7802.  
  7803.  
  7804.  
  7805. if (tonumber(v.Processed) == 0) then
  7806.  
  7807. local TimeLeft = AddAuctionInfo(Listing,(v.TimeLeft <= 0) and tonumber(v.Processed) == 0 and "Processing" or CreateTimeLeftString(v.TimeLeft), nil, color_white, nil, 100)
  7808.  
  7809. TimeLeft:SetPos(360, 12)
  7810.  
  7811. elseif (tonumber(v.Processed) == 1) then
  7812.  
  7813. local ClaimBtn = vgui.Create("DButton",Listing)
  7814.  
  7815. ClaimBtn:SetPos(360,12)
  7816.  
  7817. ClaimBtn:SetSize(100,25)
  7818.  
  7819. ClaimBtn:SetText("")
  7820.  
  7821. ClaimBtn.Paint = function(s,w,h)
  7822.  
  7823. draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
  7824.  
  7825. if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
  7826.  
  7827. draw.SimpleTextOutlined("Claim Funds","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7828.  
  7829. end
  7830.  
  7831. ClaimBtn.DoClick = function() RunConsoleCommand("_listingAction", "claim", v.ID) table.remove(listings, k) AddListings(listings) end
  7832.  
  7833. elseif (tonumber(v.Processed) == 2) then
  7834.  
  7835. local ReclaimBtn = vgui.Create("DButton",Listing)
  7836.  
  7837. ReclaimBtn:SetPos(360,12)
  7838.  
  7839. ReclaimBtn:SetSize(100,25)
  7840.  
  7841. ReclaimBtn:SetText("")
  7842.  
  7843. ReclaimBtn.Paint = function(s,w,h)
  7844.  
  7845. draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
  7846.  
  7847. if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
  7848.  
  7849. draw.SimpleTextOutlined("Re-claim","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7850.  
  7851. end
  7852.  
  7853. ReclaimBtn.DoClick = function() RunConsoleCommand("_listingAction", "reclaim", v.ID) table.remove(listings, k) AddListings(listings) end
  7854.  
  7855. end
  7856.  
  7857.  
  7858.  
  7859. local LastBid = AddAuctionInfo(Listing, string.format("$%s",string.Comma(v.LastBid)), nil, color_white, nil, 130)
  7860.  
  7861. LastBid:SetPos(465, 12)
  7862.  
  7863.  
  7864.  
  7865. local CurrentPrice = AddAuctionInfo(Listing, string.format("$%s",string.Comma(v.LastBid + v.Increment)), nil, color_white, nil, 130)
  7866.  
  7867. CurrentPrice:SetPos(600, 12)
  7868.  
  7869.  
  7870.  
  7871. local LastBidder = AddAuctionInfo(Listing, v.LastBidder or "Nobody", nil, color_white, nil, 130)
  7872.  
  7873. LastBidder:SetPos(735, 12)
  7874.  
  7875.  
  7876.  
  7877. ListingsPnl:AddItem(Listing)
  7878.  
  7879. Listing:Dock( TOP )
  7880.  
  7881. Listing:DockMargin( 4, 0, 0, 4 )
  7882.  
  7883. end
  7884.  
  7885. local PagingLbl = vgui.Create("DLabel",ListPanel)
  7886.  
  7887. PagingLbl:SetFont("Trebuchet22")
  7888.  
  7889. PagingLbl:SetText(string.format("%s total listings.",#listings))
  7890.  
  7891. PagingLbl:SizeToContents()
  7892.  
  7893. PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
  7894.  
  7895. end
  7896.  
  7897. AddListings(listings)
  7898.  
  7899. end
  7900.  
  7901.  
  7902.  
  7903.  
  7904.  
  7905. msg = "Retreiving listings..."
  7906.  
  7907. RunConsoleCommand("_requestMyListings", 1)
  7908.  
  7909. net.Receive("Auction_Listings", function(len)
  7910.  
  7911. if IsValid(BackGround) then PopulateListings(len) end
  7912.  
  7913. end)
  7914.  
  7915. end
  7916.  
  7917.  
  7918.  
  7919. table.insert(AuctionTabs, {func = AuctionHouseTab, button = AuctionHouseBtn })
  7920.  
  7921. table.insert(AuctionTabs, {func = ListingsTab, button = MyListingsBtn })
  7922.  
  7923. table.insert(AuctionTabs, {func = BidsTab, button = MyBidsBtn })
  7924.  
  7925.  
  7926.  
  7927. ChangeAuctionTab(1)
  7928.  
  7929. return BackGround
  7930.  
  7931. end
  7932.  
  7933.  
  7934.  
  7935. function zm.HitListTab()
  7936.  
  7937.  
  7938.  
  7939. local w = 890
  7940.  
  7941. local l = 520
  7942.  
  7943.  
  7944.  
  7945. local hits = {}
  7946.  
  7947. for k,v in pairs(player.GetAll()) do
  7948.  
  7949. if v:GetNWInt("HBounty") > 0 then
  7950.  
  7951. table.insert(hits, {ply = v, bounty = v:GetNWInt("HBounty")})
  7952.  
  7953. end
  7954.  
  7955. end
  7956.  
  7957. table.SortByMember(hits, "bounty")
  7958.  
  7959.  
  7960.  
  7961. local BackGround = vgui.Create("DPanel",F4Menu)
  7962.  
  7963. BackGround:SetSize(l,w)
  7964.  
  7965. BackGround.Paint = function()
  7966.  
  7967. draw.RoundedBox(4,0,0,w,l,Color(186,85,211, 50))
  7968.  
  7969. draw.SimpleTextOutlined("Hit List","ZMenuHeader",w*.5,l*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  7970.  
  7971. if #hits < 1 then draw.SimpleTextOutlined("There are currently no hits.","Trebuchet24",w*.5,54,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) ) end
  7972.  
  7973. end
  7974.  
  7975.  
  7976.  
  7977. local HitList = vgui.Create("DScrollPanel", BackGround)
  7978.  
  7979. HitList:SetPos(0,54)
  7980.  
  7981. HitList:SetSize( w, 456 )
  7982.  
  7983. HitList:SetPadding(15)
  7984.  
  7985.  
  7986.  
  7987. function HitList:LoadHits()
  7988.  
  7989. for k,v in SortedPairs(hits) do
  7990.  
  7991.  
  7992.  
  7993. local HitPanel = vgui.Create("DPanel")
  7994.  
  7995. HitPanel:SetSize(880,80)
  7996.  
  7997. HitPanel.Paint = function()
  7998.  
  7999. draw.RoundedBox(4,0,0,880,80,Color(89,89,89))
  8000.  
  8001. draw.RoundedBox(4,90,43,785,30,Color(255,255,255,50)) -- Description background
  8002.  
  8003. draw.SimpleTextOutlined(v.ply:Nick(),"Trebuchet24",100,20,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8004.  
  8005. draw.SimpleTextOutlined(string.format("Bounty: $%s Job: %s (Find and kill them to receive the bounty on this player!)",ZARP.formatNumber(v.bounty),RPExtraTeams[ v.ply:Team() ].name),"Trebuchet22",100,57,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8006.  
  8007. end
  8008.  
  8009.  
  8010.  
  8011. local Icon = vgui.Create("ModelImage", HitPanel)
  8012.  
  8013. Icon:SetPos(8,4)
  8014.  
  8015. Icon:SetSize(70, 70)
  8016.  
  8017. Icon:SetModel(v.ply:GetModel())
  8018.  
  8019.  
  8020.  
  8021. HitList:AddItem(HitPanel)
  8022.  
  8023. HitPanel:Dock( TOP )
  8024.  
  8025. HitPanel:DockMargin( 4, 0, 0, 4 )
  8026.  
  8027. end
  8028.  
  8029. end
  8030.  
  8031. HitList:LoadHits()
  8032.  
  8033. return BackGround
  8034.  
  8035. end
  8036.  
  8037.  
  8038.  
  8039. function zm.UpgradesTab()
  8040.  
  8041.  
  8042.  
  8043. local w = 890
  8044.  
  8045. local l = 520
  8046.  
  8047.  
  8048.  
  8049. local hassuperuranium = LocalPlayer():HasItem("supercharged uranium")
  8050.  
  8051. local NukeMat = Material("vgui/entities/m9k_davy_crockett")
  8052.  
  8053. local BackGround = vgui.Create("DPanel",F4Menu)
  8054.  
  8055. BackGround:SetSize(l,w)
  8056.  
  8057. BackGround.Paint = function()
  8058.  
  8059. draw.RoundedBox(4,0,0,w,l,Color( 112, 158, 63, 255 ))
  8060.  
  8061. -- draw.RoundedBox(0,0,l*.01,w,l*.085,Color(250,250,250,220))
  8062.  
  8063. draw.SimpleTextOutlined("Character Upgrades","ZMenuHeader",w*.5,l*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8064.  
  8065. if hassuperuranium then
  8066.  
  8067. draw.RoundedBox(4,8,460,w-16,38,Color(0,204,0))
  8068.  
  8069. draw.SimpleTextOutlined("You have enough supercharged uranium to craft an upgrade.","Trebuchet22",15,468,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_LEFT, 2, Color(0,0,0,200) )
  8070.  
  8071. else
  8072.  
  8073. draw.RoundedBox(4,8,460,w-16,38,Color(89,89,89))
  8074.  
  8075. draw.SimpleTextOutlined("You require 1 supercharged uranium (obtain by nuclear launch) in order to craft an upgrade.","Trebuchet22",15,468,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_LEFT, 2, Color(0,0,0,200) )
  8076.  
  8077. end
  8078.  
  8079. end
  8080.  
  8081.  
  8082.  
  8083. local UpgradesList = vgui.Create("DHorizontalScroller", BackGround)
  8084.  
  8085. UpgradesList:SetOverlap( -5 )
  8086.  
  8087. UpgradesList:SetPos(5,54)
  8088.  
  8089. UpgradesList:SetSize( w, 400 )
  8090.  
  8091. UpgradesList.Paint = function() end
  8092.  
  8093.  
  8094.  
  8095. //Load all upgrades onto list panel
  8096.  
  8097. for k,v in pairs(LDRP_SH.TableToNumericalKeys(LDRP_SH.CharacterUpgrades)) do
  8098.  
  8099. //local hasupgrade = LocalPlayer():HasItem(string.lower(k.." Upgrade"))
  8100.  
  8101. local DescMarkup = markup.Parse(string.format("<font=Tre22><colour=255, 255, 255, 255>%s</colour></font>",v.desc),210)
  8102.  
  8103. local UpgradePanel = vgui.Create("DPanel")
  8104.  
  8105. UpgradePanel:SetSize(235,400)
  8106.  
  8107. UpgradePanel:SetPos(8 + ((k-1) * 220),5)
  8108.  
  8109. UpgradePanel.Paint = function(s,w,h)
  8110.  
  8111. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  8112.  
  8113.  
  8114.  
  8115. surface.SetFont("Trebuchet24")
  8116.  
  8117. local tw,th = surface.GetTextSize(v.name)
  8118.  
  8119. draw.SimpleTextOutlined(v.name,"Trebuchet24",UpgradePanel:GetWide() / 2 - (tw / 2),185,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8120.  
  8121. DescMarkup:Draw( 20, 195)
  8122.  
  8123.  
  8124.  
  8125. if v.salepct then
  8126.  
  8127. surface.SetFont("Bebas24Font")
  8128.  
  8129. local tw,th = surface.GetTextSize(string.format(v.salepct > 0 and "SALE %i%% OFF" or "NEW UPGRADE",v.salepct))
  8130.  
  8131. tw = (tw + 8)
  8132.  
  8133. draw.WordBox( 8, UpgradePanel:GetWide() / 2 - (tw / 2), 305, string.format(v.salepct > 0 and "SALE %i%% OFF" or "NEW UPGRADE",v.salepct), "Bebas24Font", Color(255,51,51), color_white )
  8134.  
  8135. end
  8136.  
  8137. end
  8138.  
  8139.  
  8140.  
  8141. local Icon = vgui.Create("DImage", UpgradePanel)
  8142.  
  8143. Icon:SetPos((UpgradePanel:GetWide() / 2) - 75,5)
  8144.  
  8145. Icon:SetSize(150,150)
  8146.  
  8147. Icon:SetImage(v.icon)
  8148.  
  8149.  
  8150.  
  8151. Icon.Shine = vgui.Create("DImage", Icon)
  8152.  
  8153. Icon.Shine:SetImage("fadmin/shine.png")
  8154.  
  8155. Icon.Shine:SetTall(Icon:GetTall())
  8156.  
  8157. Icon.Shine.NextShine = CurTime()
  8158.  
  8159. Icon.Shine.Think = function()
  8160.  
  8161. if CurTime() >= Icon.Shine.NextShine then
  8162.  
  8163. Icon.Shine.NextShine = CurTime() + 4
  8164.  
  8165. Icon.Shine:SetPos(-70,1)
  8166.  
  8167. Icon.Shine.ShineAcross = -70
  8168.  
  8169. end
  8170.  
  8171.  
  8172.  
  8173. if Icon.Shine.ShineAcross < Icon:GetWide() then
  8174.  
  8175. Icon.Shine.ShineAcross = math.Approach( Icon.Shine.ShineAcross, Icon:GetWide(), FrameTime() * 200 )
  8176.  
  8177. Icon.Shine:SetPos(Icon.Shine.ShineAcross, 1)
  8178.  
  8179. else
  8180.  
  8181. Icon.Shine:SetPos(-70,1)
  8182.  
  8183. end
  8184.  
  8185. end
  8186.  
  8187.  
  8188.  
  8189. local price
  8190.  
  8191. if v.salepct then
  8192.  
  8193. local pctoff = ((v.price / 100) * v.salepct)
  8194.  
  8195. price = math.Round(v.price - pctoff)
  8196.  
  8197. else
  8198.  
  8199. price = v.price
  8200.  
  8201. end
  8202.  
  8203.  
  8204.  
  8205. local PurchaseBtn = MakeNiceButton()
  8206.  
  8207. PurchaseBtn:SetParent(UpgradePanel)
  8208.  
  8209. PurchaseBtn:SetText(string.format("Craft $%s",ZARP.formatNumber(price)))
  8210.  
  8211. PurchaseBtn.DoClick = function()
  8212.  
  8213. zm.OpenHiddenTab(zm.UpgradesTab())
  8214.  
  8215. end
  8216.  
  8217. PurchaseBtn:SetPos( ((UpgradePanel:GetWide() / 2) - 100), 350 )
  8218.  
  8219. PurchaseBtn:SetSize( 200, 40 )
  8220.  
  8221. PurchaseBtn:SetImage( "icon16/cart.png" )
  8222.  
  8223. PurchaseBtn.DoClick = function()
  8224.  
  8225. if (LocalPlayer():getDarkRPVar("money") < price) or !hassuperuranium then return end
  8226.  
  8227. Derma_Query(string.format("Are you sure you want to craft %s (1 supercharged uranium and $%s)?",v.name,ZARP.formatNumber(price)), "Confirmation", "Craft Upgrade",
  8228.  
  8229. function() RunConsoleCommand("_CraftUpgrade",k) zm.OpenHiddenTab(zm.InventoryTab()) end, "Cancel", function() end)
  8230.  
  8231. end
  8232.  
  8233. if (LocalPlayer():getDarkRPVar("money") < price) or !hassuperuranium then PurchaseBtn:SetCursor("no") end
  8234.  
  8235.  
  8236.  
  8237. UpgradesList:AddPanel(UpgradePanel)
  8238.  
  8239. end
  8240.  
  8241.  
  8242.  
  8243. return BackGround
  8244.  
  8245. end
  8246.  
  8247.  
  8248.  
  8249. function zm.DailyObjectivesTab()
  8250.  
  8251. local BackGround = vgui.Create("DPanel",F4Menu)
  8252.  
  8253. BackGround:SetSize(890,520)
  8254.  
  8255. BackGround.Paint = function(s,w,h)
  8256.  
  8257. draw.RoundedBox(4,0,0,w,h,Color(66,161,255))
  8258.  
  8259. draw.SimpleTextOutlined("Daily Objectives","ZMenuHeader",8,25,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8260.  
  8261.  
  8262.  
  8263. //Objectives bar bg
  8264.  
  8265. draw.RoundedBox(4,5,43,w - 10,150,Color(0,0,0,200))
  8266.  
  8267. end
  8268.  
  8269. BackGround.PaintOver = function(s,w,h)
  8270.  
  8271. draw.SimpleText("Complete your daily objectives on consecutive days to unlock the next reward level.","Trebuchet18",(w / 2),h - 10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  8272.  
  8273. end
  8274.  
  8275. //Objective blocks
  8276.  
  8277.  
  8278.  
  8279. local ObjectivesLayout = vgui.Create("DListLayout",BackGround)
  8280.  
  8281. ObjectivesLayout:SetPos(5,43)
  8282.  
  8283. ObjectivesLayout:SetSize(BackGround:GetWide() - 10, 120)
  8284.  
  8285.  
  8286.  
  8287. local objectivescomplete = 0
  8288.  
  8289. for k,v in pairs(ZARP.Objectives or {}) do
  8290.  
  8291. local Objective = ObjectivesLayout:Add("DPanel")
  8292.  
  8293. Objective:SetTall(42)
  8294.  
  8295. Objective:DockMargin( 0, 5, 0, 0 )
  8296.  
  8297. Objective.Paint = function(s,w,h)
  8298.  
  8299. draw.RoundedBox( 4, 5, 3, (h - 3), (h - 3), color_white )
  8300.  
  8301. draw.SimpleTextOutlined(ZARP.DailyObjectives[k].name,"Trebuchet22",50,12,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200))
  8302.  
  8303. if v > 0 then
  8304.  
  8305. local pct = math.floor((100 / ZARP.DailyObjectives[k].amount)*v)
  8306.  
  8307. draw.SimpleText(string.format("You have completed %i%% of this objective.",pct),"Trebuchet18",50,32,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
  8308.  
  8309. else
  8310.  
  8311. draw.SimpleText(ZARP.DailyObjectives[k].desc or "Keep playing to complete this objective.","Trebuchet18",50,32,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
  8312.  
  8313. end
  8314.  
  8315.  
  8316.  
  8317. if v >= ZARP.DailyObjectives[k].amount then
  8318.  
  8319. draw.SimpleText("✔","ZMenuHeader",8,1,Color(0,194,97))
  8320.  
  8321. end
  8322.  
  8323.  
  8324.  
  8325. //Diamond reward
  8326.  
  8327. surface.SetFont("Trebuchet24")
  8328.  
  8329. local text = "+$"..string.Comma(ZARP.DailyObjectives[k].reward)
  8330.  
  8331. local tw,th = surface.GetTextSize(text)
  8332.  
  8333.  
  8334.  
  8335. draw.RoundedBox( 4, (w - 5) - (tw + 41), 3, 5 + (tw + 36), (h - 3), Color(0,0,0,150) )
  8336.  
  8337. surface.SetDrawColor(color_white)
  8338.  
  8339. surface.SetMaterial(ZARP.DiamondMaterial)
  8340.  
  8341. surface.DrawTexturedRect( ((w - 5) - (tw + 41)) + 3, 3, (h - 6), (h - 6) )
  8342.  
  8343. draw.SimpleTextOutlined(text,"Trebuchet24",((w - 5) - (tw + 40)) + 34 ,22,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200))
  8344.  
  8345. end
  8346.  
  8347. if v >= ZARP.DailyObjectives[k].amount then
  8348.  
  8349. objectivescomplete = (objectivescomplete+1)
  8350.  
  8351. end
  8352.  
  8353. end
  8354.  
  8355.  
  8356.  
  8357. //Daily objectives target bar
  8358.  
  8359. local TargetBar = vgui.Create("DPanel",BackGround)
  8360.  
  8361. TargetBar:SetPos(5,205)
  8362.  
  8363. TargetBar:SetSize(BackGround:GetWide() - 10,50)
  8364.  
  8365. TargetBar.Paint = function(s,w,h)
  8366.  
  8367. //Daily objectives target bar upper
  8368.  
  8369. draw.RoundedBoxEx( 4, 0, 0, w, 10, Color(0,84,168), true, true, false, false )
  8370.  
  8371. //lower
  8372.  
  8373. draw.RoundedBoxEx( 4, 0, 10, w, h - 10, Color(0,97,194), false, false, true, true )
  8374.  
  8375. end
  8376.  
  8377. TargetBar.PaintOver = function(s,w,h)
  8378.  
  8379. //Day markers
  8380.  
  8381. surface.SetDrawColor(color_white)
  8382.  
  8383. //1 day
  8384.  
  8385. surface.DrawRect( 125 - (5 / 2), 0, 5, h )
  8386.  
  8387.  
  8388.  
  8389. //3 days
  8390.  
  8391. surface.DrawRect( 375 - (5 / 2), 0, 5, h )
  8392.  
  8393. //7 days
  8394.  
  8395. surface.DrawRect( TargetBar:GetWide() - (125 / 3), 0, 5, h )
  8396.  
  8397. end
  8398.  
  8399. TargetBar.ProgressBar = vgui.Create("DPanel",TargetBar)
  8400.  
  8401. TargetBar.ProgressBar:SetPos(0,TargetBar:GetTall() / 4)
  8402.  
  8403. TargetBar.ProgressBar:SetSize(5,TargetBar:GetTall() / 2)
  8404.  
  8405. TargetBar.ProgressBar.Paint = function(s,w,h)
  8406.  
  8407. //upper
  8408.  
  8409. draw.RoundedBoxEx( 4, 0, 0, w, 10, Color(0,168,84), true, true, false, false )
  8410.  
  8411. //lower
  8412.  
  8413. draw.RoundedBoxEx( 4, 0, 10, w, h - 10, Color(0,194,97), false, false, true, true )
  8414.  
  8415. end
  8416.  
  8417. //Day
  8418.  
  8419. local day = ((ZARP.ObjectivesDay or 1) - 1)
  8420.  
  8421. local pixels = (TargetBar:GetWide() / 7)
  8422.  
  8423. local pixelsacross = (day * pixels)
  8424.  
  8425. pixelsacross = pixelsacross + ((pixels / ZARP.DOConfig.MaxObjectives) * objectivescomplete)
  8426.  
  8427.  
  8428.  
  8429. //Progress animate
  8430.  
  8431. TargetBar.ProgressBar:SizeTo( pixelsacross < 5 and 5 or pixelsacross, TargetBar:GetTall() / 2, 1, 0, 1, function() end)
  8432.  
  8433.  
  8434.  
  8435. TargetBar.Shine = vgui.Create("DImage", TargetBar)
  8436.  
  8437. TargetBar.Shine:SetImage("fadmin/shine.png")
  8438.  
  8439. TargetBar.Shine:SetTall(TargetBar:GetTall())
  8440.  
  8441. TargetBar.Shine.NextShine = CurTime()
  8442.  
  8443. TargetBar.Shine.Think = function()
  8444.  
  8445. if CurTime() >= TargetBar.Shine.NextShine then
  8446.  
  8447. TargetBar.Shine.NextShine = CurTime() + 20
  8448.  
  8449. TargetBar.Shine:SetPos(-70,1)
  8450.  
  8451. TargetBar.Shine.ShineAcross = -70
  8452.  
  8453. end
  8454.  
  8455.  
  8456.  
  8457. if TargetBar.Shine.ShineAcross < TargetBar:GetWide() then
  8458.  
  8459. TargetBar.Shine.ShineAcross = math.Approach( TargetBar.Shine.ShineAcross, TargetBar:GetWide(), FrameTime() * 300 )
  8460.  
  8461. TargetBar.Shine:SetPos(TargetBar.Shine.ShineAcross, 1)
  8462.  
  8463. else
  8464.  
  8465. TargetBar.Shine:SetPos(-70,1)
  8466.  
  8467. end
  8468.  
  8469. end
  8470.  
  8471.  
  8472.  
  8473. local wide = ((BackGround:GetWide() - 20) / 3)
  8474.  
  8475.  
  8476.  
  8477. local blocknum = 1
  8478.  
  8479. for k,v in pairs(ZARP.DOConfig.DayRewards) do
  8480.  
  8481. local Block = vgui.Create("DPanel",BackGround)
  8482.  
  8483. Block:SetPos(5 * blocknum + ((blocknum - 1)) * wide, 265)
  8484.  
  8485. Block:SetSize(wide,235)
  8486.  
  8487. Block.Paint = function(s,w,h)
  8488.  
  8489. draw.RoundedBox(4,0,0,w,h,Color(0,0,0,200))
  8490.  
  8491. //Title
  8492.  
  8493. draw.SimpleTextOutlined(v[1],"Trebuchet24",w / 2,14,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8494.  
  8495. end
  8496.  
  8497.  
  8498.  
  8499. local RewardLayout = vgui.Create("DListLayout",Block)
  8500.  
  8501. RewardLayout:SetPos(4,25)
  8502.  
  8503. RewardLayout:SetSize(wide - 8, 125)
  8504.  
  8505.  
  8506.  
  8507. for k,v in pairs(v[2]) do
  8508.  
  8509. local Reward = RewardLayout:Add("DPanel")
  8510.  
  8511. Reward:SetPos(25, 2)
  8512.  
  8513. Reward:SetTall((k == 1) and 80 or 40)
  8514.  
  8515. Reward:DockMargin( 0, 3, 0, 0 )
  8516.  
  8517. Reward.Paint = function(s,w,h)
  8518.  
  8519. draw.RoundedBox(4,0,0,w,h,Color(0,0,0,200))
  8520.  
  8521.  
  8522.  
  8523. surface.SetDrawColor(color_white)
  8524.  
  8525. surface.SetMaterial(v[2])
  8526.  
  8527. surface.DrawTexturedRect( 0,0, h, h )
  8528.  
  8529. draw.SimpleTextOutlined(v[1],"Trebuchet22",(w / 2) + 10,h / 2,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8530.  
  8531. end
  8532.  
  8533. end
  8534.  
  8535. blocknum = (blocknum + 1)
  8536.  
  8537. end
  8538.  
  8539. return BackGround
  8540.  
  8541. end
  8542.  
  8543.  
  8544.  
  8545. function CasePopUp(title, message, model, color, key, redeemplatform, gamelink, fireworks)
  8546.  
  8547. local WaitTime = 0
  8548.  
  8549. local WaitForFade = 0
  8550.  
  8551. local FadePanel = vgui.Create("DPanel")
  8552.  
  8553. FadePanel:SetPos(0,0)
  8554.  
  8555. FadePanel:SetSize(ScrW(), ScrH())
  8556.  
  8557. FadePanel.Paint = function()
  8558.  
  8559. if WaitForFade < 240 then
  8560.  
  8561. if (CurTime() >= WaitTime) then
  8562.  
  8563. WaitForFade = WaitForFade + 1
  8564.  
  8565. WaitTime = CurTime() + 0.005
  8566.  
  8567. end
  8568.  
  8569. end
  8570.  
  8571. draw.RoundedBox(0,0,0,ScrW(), ScrH(), Color(0,0,0,WaitForFade))
  8572.  
  8573. end
  8574.  
  8575.  
  8576.  
  8577. local main = vgui.Create("DFrame")
  8578.  
  8579. main:SetSize(450, key and 275 or 250)
  8580.  
  8581. main:Center()
  8582.  
  8583. main:ShowCloseButton(false)
  8584.  
  8585. main:MakePopup()
  8586.  
  8587. main:SetTitle(title)
  8588.  
  8589. main.Paint = function(s,w,h)
  8590.  
  8591. draw.RoundedBox(4, 0, 0, w, h, color)
  8592.  
  8593. draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(55, 100, 5, 100))
  8594.  
  8595. draw.RoundedBox(4, 1, 1, w - 2, 20, Color(10, 30, 10, 150))
  8596.  
  8597. if key then
  8598.  
  8599. draw.DrawText(message, "Tre22", (w/2), 25, Color(255,255,255,255),TEXT_ALIGN_CENTER)
  8600.  
  8601. draw.DrawText("You can activate this key on "..(redeemplatform or "Steam"), "Tre22", (w/2), 43, Color(255,255,255,255),TEXT_ALIGN_CENTER)
  8602.  
  8603. draw.DrawText(key, "Tre22", (w/2), 61, Color(255,255,255,255),TEXT_ALIGN_CENTER)
  8604.  
  8605. draw.DrawText("A screenshot of this message has been saved for your records.", "Tre20", (w/2), 200, Color(255,255,255,255),TEXT_ALIGN_CENTER)
  8606.  
  8607. else
  8608.  
  8609. draw.DrawText(message, "ScoreboardSubtitle", (w/2), 30, Color(255,255,255,255),TEXT_ALIGN_CENTER)
  8610.  
  8611. end
  8612.  
  8613. end
  8614.  
  8615. if model:EndsWith(".png") then
  8616.  
  8617. local icon = vgui.Create("DImage", main)
  8618.  
  8619. icon:SetPos(key and main:GetWide() / 2 -113 or main:GetWide() / 2 -64, key and 85 or 65)
  8620.  
  8621. if key then icon:SetSize(108,108) else icon:SetSize(128, 128) end
  8622.  
  8623. icon:SetImage(model)
  8624.  
  8625. else
  8626.  
  8627. local icon = vgui.Create("DModelPanel", main)
  8628.  
  8629. icon:SetPos(main:GetWide() / 2 -64, 65)
  8630.  
  8631. icon:SetSize(128, 128)
  8632.  
  8633. icon:SetModel(model)
  8634.  
  8635. local PrevMins, PrevMaxs = icon.Entity:GetRenderBounds()
  8636.  
  8637. icon:SetCamPos((PrevMins:Distance(PrevMaxs)*Vector(0.75, 0.75, 0.5)))
  8638.  
  8639. icon:SetLookAt((PrevMaxs + PrevMins)/2)
  8640.  
  8641. icon:SetFOV(50)
  8642.  
  8643. end
  8644.  
  8645.  
  8646.  
  8647. local ContinueBtn = vgui.Create("DButton",main)
  8648.  
  8649. ContinueBtn:SetPos(key and 20 or main:GetWide() / 2 - 100,main:GetTall() - 45)
  8650.  
  8651. ContinueBtn:SetSize(200,40)
  8652.  
  8653. ContinueBtn:SetText("")
  8654.  
  8655. ContinueBtn.Paint = function(s,w,h)
  8656.  
  8657. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  8658.  
  8659. if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,100)) end
  8660.  
  8661. draw.SimpleTextOutlined("Continue","Trebuchet22",100,20,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8662.  
  8663. end
  8664.  
  8665. ContinueBtn.DoClick = function()
  8666.  
  8667. main:Close()
  8668.  
  8669. if zm.IsOpen() then zm.OpenHiddenTab(zm.InventoryTab()) end
  8670.  
  8671. end
  8672.  
  8673.  
  8674.  
  8675. if key then
  8676.  
  8677. local KeyBtn = vgui.Create("DButton",main)
  8678.  
  8679. KeyBtn:SetPos(225,main:GetTall() - 45)
  8680.  
  8681. KeyBtn:SetSize(200,40)
  8682.  
  8683. KeyBtn:SetText("")
  8684.  
  8685. KeyBtn.Paint = function(s,w,h)
  8686.  
  8687. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  8688.  
  8689. if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,100)) end
  8690.  
  8691. draw.SimpleTextOutlined(KeyBtn.Copied and "Copied!" or "Copy to Clipboard","Trebuchet22",100,20,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8692.  
  8693. end
  8694.  
  8695. KeyBtn.DoClick = function()
  8696.  
  8697. KeyBtn.Copied = true
  8698.  
  8699. SetClipboardText( key )
  8700.  
  8701. end
  8702.  
  8703.  
  8704.  
  8705. local LinkBtn = vgui.Create("DButton",main)
  8706.  
  8707. LinkBtn:SetPos(225,main:GetTall() - 156)
  8708.  
  8709. LinkBtn:SetSize(200,40)
  8710.  
  8711. LinkBtn:SetText("")
  8712.  
  8713. LinkBtn.Paint = function(s,w,h)
  8714.  
  8715. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  8716.  
  8717. if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,100)) end
  8718.  
  8719. draw.SimpleTextOutlined("View Game","Trebuchet22",100,20,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8720.  
  8721. end
  8722.  
  8723. LinkBtn.DoClick = function()
  8724.  
  8725. if tonumber(gamelink) then gui.OpenURL(string.format("http://store.steampowered.com/app/%s/",gamelink))
  8726.  
  8727. else gui.OpenURL(gamelink) end
  8728.  
  8729. end
  8730.  
  8731. RunConsoleCommand("jpeg")
  8732.  
  8733. end
  8734.  
  8735.  
  8736.  
  8737. //Fireworks effect
  8738.  
  8739. if fireworks then
  8740.  
  8741. local FireworkMat = Material("effects/yellowflare")
  8742.  
  8743. for i=1,100,1 do
  8744.  
  8745. local Sprite = CreateSprite(FireworkMat)
  8746.  
  8747. Sprite:SetParent(FadePanel)
  8748.  
  8749. Sprite:SetColor(Color(math.random(0, 255), math.random(0, 255), math.random(0, 255)))
  8750.  
  8751.  
  8752.  
  8753. local size = math.random(10,50)
  8754.  
  8755. Sprite:SetSize(size,size)
  8756.  
  8757.  
  8758.  
  8759. local w = (ScrW() / 2)
  8760.  
  8761. local h = (ScrH() / 2)
  8762.  
  8763. Sprite:SetPos(w,h)
  8764.  
  8765.  
  8766.  
  8767. Sprite:ColorTo(Color(math.random(0, 255), math.random(0, 255), math.random(0, 255)),2,0)
  8768.  
  8769. Sprite:SetDrawOnTop(true)
  8770.  
  8771.  
  8772.  
  8773. Sprite:MoveTo( w - (math.random(-100,100)), h + (math.random(-100,100)), math.random(1,1.5), 0, 1, function()
  8774.  
  8775. if not IsValid(Sprite) then return end
  8776.  
  8777. Sprite:ColorTo(Color(255,255,255,0),1,0, function()
  8778.  
  8779. if IsValid(Sprite) then Sprite:Remove() Sprite = nil end
  8780.  
  8781. end)
  8782.  
  8783. end)
  8784.  
  8785. end
  8786.  
  8787. sound.PlayFile( "sound/zarp/eggprize.mp3", "", function() end )
  8788.  
  8789. end
  8790.  
  8791.  
  8792.  
  8793. function main:Close()
  8794.  
  8795. self:Remove()
  8796.  
  8797. FadePanel:Remove()
  8798.  
  8799. end
  8800.  
  8801. end
  8802.  
  8803.  
  8804.  
  8805. function zm.OpenCase(title,color,items,result,key,redeemplatform,gamelink,blueprintcase)
  8806.  
  8807.  
  8808.  
  8809. local w = 890
  8810.  
  8811. local l = 520
  8812.  
  8813. local GenCorpLogo
  8814.  
  8815. local MagikLogo
  8816.  
  8817. local AnimationFinished
  8818.  
  8819.  
  8820.  
  8821. if title == "GenCorp Case" then GenCorpLogo = Material("zarp/gencorp-logo-full.png","smooth noclamp")
  8822.  
  8823. elseif title == "Magik Box" then MagikLogo = Material("zarp/magik-logofull.png","smooth noclamp") end
  8824.  
  8825.  
  8826.  
  8827. local BackGround = vgui.Create("DPanel",F4Menu)
  8828.  
  8829. BackGround:SetSize(l,w)
  8830.  
  8831. BackGround.Paint = function()
  8832.  
  8833. draw.RoundedBox(4,0,0,w,l,color)
  8834.  
  8835. -- draw.RoundedBox(0,0,l*.01,w,l*.085,Color(250,250,250,220))
  8836.  
  8837. draw.SimpleTextOutlined(title,"ZMenuHeader",w*.5,l*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8838.  
  8839.  
  8840.  
  8841. //Opening case bg
  8842.  
  8843. draw.RoundedBox(4,20,274,w - 40,40,Color(89,89,89,AnimationFinished and 255 or 185 + math.sin(RealTime() * 2.5) * 100))
  8844.  
  8845. draw.SimpleTextOutlined("Opening case...","Trebuchet24",BackGround:GetWide() / 2,294,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  8846.  
  8847.  
  8848.  
  8849. if GenCorpLogo then
  8850.  
  8851. surface.SetDrawColor(color_white)
  8852.  
  8853. surface.SetMaterial( GenCorpLogo )
  8854.  
  8855. surface.DrawTexturedRect( (BackGround:GetWide() / 2) - (511 / 2), 330, 511, 121 )
  8856.  
  8857. elseif MagikLogo then
  8858.  
  8859. surface.SetDrawColor(color_white)
  8860.  
  8861. surface.SetMaterial( MagikLogo )
  8862.  
  8863. surface.DrawTexturedRect( (BackGround:GetWide() / 2) - (469 / 2), 330, 469, 149 )
  8864.  
  8865. end
  8866.  
  8867. end
  8868.  
  8869. BackGround.OnRemove = function()
  8870.  
  8871. ZARP.SetNewItemLogSuppressed(false)
  8872.  
  8873. end
  8874.  
  8875.  
  8876.  
  8877. local BlueprintsList = vgui.Create("DPanel", BackGround)
  8878.  
  8879. BlueprintsList:SetPos(0,54)
  8880.  
  8881. BlueprintsList:SetSize( w, 210 )
  8882.  
  8883. BlueprintsList.Paint = function(s,w,h)
  8884.  
  8885. draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
  8886.  
  8887. end
  8888.  
  8889. BlueprintsList.PaintOver = function(s,w,h)
  8890.  
  8891. surface.SetDrawColor(Color(255,214,51))
  8892.  
  8893. surface.DrawRect( (s:GetWide() / 2) - 2.5, 0, 5, s:GetTall() )
  8894.  
  8895. end
  8896.  
  8897.  
  8898.  
  8899. local BW,BH = 200,200
  8900.  
  8901. local function StartCaseOpen(result,endat, name, item, color,key,redeemplatform)
  8902.  
  8903. if not IsValid(BlueprintsList) then return end
  8904.  
  8905. local speed = 7.5 // 5
  8906.  
  8907. local moveamount = endat - (BlueprintsList:GetWide() / 2) + math.random(0,BW - 5)
  8908.  
  8909. local movedamount = 0
  8910.  
  8911. local pixelsmoved = 0
  8912.  
  8913. BlueprintsList.Think = function()
  8914.  
  8915. if (moveamount - movedamount) <= 2000 then //1000
  8916.  
  8917. speed = math.Approach(speed,0.1,FrameTime() * 1.417) //1.27
  8918.  
  8919. end
  8920.  
  8921. for k,v in pairs(BlueprintsList:GetChildren()) do
  8922.  
  8923. if not v.NewX then v.NewX = v:GetPos() end
  8924.  
  8925. v.NewX = math.Approach(v.NewX,-BW,FrameTime() * 100 * speed)
  8926.  
  8927. if v.NewX <= -BW then v:Remove() continue end
  8928.  
  8929. v:SetPos(v.NewX,5)
  8930.  
  8931. end
  8932.  
  8933. pixelsmoved = math.Approach(pixelsmoved,50,FrameTime() * 100 * speed)
  8934.  
  8935. if pixelsmoved >= 50 then
  8936.  
  8937. pixelsmoved = 0
  8938.  
  8939. surface.PlaySound("darkrp/tick.wav")
  8940.  
  8941. end
  8942.  
  8943. movedamount = math.Approach(movedamount,moveamount,FrameTime() * 100 * speed)
  8944.  
  8945. if movedamount >= moveamount then BlueprintsList.Think = nil
  8946.  
  8947. timer.Simple(0.1, function()
  8948.  
  8949. surface.PlaySound("darkrp/levelup3.wav")
  8950.  
  8951. AnimationFinished = true
  8952.  
  8953. ZARP.SetNewItemLogSuppressed(false)
  8954.  
  8955. //Steam Games
  8956.  
  8957. if key then CasePopUp("Congratulations!", "You are the winner of: " .. name, item.icon,color,key,redeemplatform,gamelink,true)
  8958.  
  8959. elseif name:StartWith("$") then CasePopUp("Your Cash Prize!", "You've won a total of " .. name, item.model,color)
  8960.  
  8961. elseif blueprintcase then CasePopUp("Blueprint Unlocked!", "You have unlocked a " .. name .. " Blueprint", item.model,color)
  8962.  
  8963. else CasePopUp("Item Unlocked!", "You have unlocked a " .. name, item.model,color) end
  8964.  
  8965. end)
  8966.  
  8967. end
  8968.  
  8969. end
  8970.  
  8971. end
  8972.  
  8973.  
  8974.  
  8975. //Golden blueprints
  8976.  
  8977. if blueprintcase then
  8978.  
  8979. local iswinner = false
  8980.  
  8981. for k,v in pairs(items) do
  8982.  
  8983. if (v.golden) and (k == result) then iswinner = true continue
  8984.  
  8985. elseif (v.golden) then items[k] = nil end
  8986.  
  8987. end
  8988.  
  8989. if not iswinner then
  8990.  
  8991. for k,v in RandomPairs(LDRP_SH.Blueprints) do if v.golden then items[v.key] = v break end end
  8992.  
  8993. end
  8994.  
  8995. end
  8996.  
  8997.  
  8998.  
  8999. //Load all blueprints onto list panel
  9000.  
  9001. local num = 0
  9002.  
  9003. local endat = 0
  9004.  
  9005. local hasgoldenplueprint
  9006.  
  9007. for i=1,4,1 do
  9008.  
  9009. for k,v in RandomPairs(items) do
  9010.  
  9011.  
  9012.  
  9013. local Blueprint = vgui.Create("DPanel", BlueprintsList)
  9014.  
  9015. Blueprint:SetSize(BW,BH)
  9016.  
  9017. Blueprint:SetPos(5 + (num * 205),5)
  9018.  
  9019. Blueprint.Font = "Trebuchet24"
  9020.  
  9021. if (#v.name > 30) then Blueprint.Font ="Trebuchet18"
  9022.  
  9023. elseif (#v.name > 25) then Blueprint.Font ="Trebuchet20"
  9024.  
  9025. elseif (#v.name > 20) then Blueprint.Font ="Trebuchet22" end
  9026.  
  9027. Blueprint.Paint = function(s,w,h)
  9028.  
  9029. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30))
  9030.  
  9031.  
  9032.  
  9033. surface.SetFont(s.Font)
  9034.  
  9035. local w,h = surface.GetTextSize(v.name)
  9036.  
  9037. draw.SimpleTextOutlined(v.name,s.Font,Blueprint:GetWide() / 2 - (w / 2),185,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  9038.  
  9039. end
  9040.  
  9041.  
  9042.  
  9043. local Icon = vgui.Create("DImage", Blueprint)
  9044.  
  9045. Icon:SetPos(25,5)
  9046.  
  9047. Icon:SetSize(150,150)
  9048.  
  9049. Icon:SetImage(v.icon)
  9050.  
  9051.  
  9052.  
  9053. if i==3 and (k == result) then endat = 5 + (num * 205) end
  9054.  
  9055. num = (num + 1)
  9056.  
  9057. end
  9058.  
  9059. end
  9060.  
  9061.  
  9062.  
  9063. timer.Simple(0, function()
  9064.  
  9065. surface.PlaySound("doors/vent_open2.wav")
  9066.  
  9067. StartCaseOpen(result,endat,items[result].name,items[result],color,key,redeemplatform)
  9068.  
  9069. end)
  9070.  
  9071.  
  9072.  
  9073. return BackGround
  9074.  
  9075. end
  9076.  
  9077.  
  9078.  
  9079. function zm.IncomingCase(l)
  9080.  
  9081. local casetype = net.ReadUInt(6)
  9082.  
  9083. local result = net.ReadUInt(6)
  9084.  
  9085. if !zm.IsOpen() then zm.Open() end
  9086.  
  9087. if casetype == 1 then
  9088.  
  9089. zm.OpenHiddenTab(zm.OpenCase("Blueprints Case",Color(102,140,255, 150),LDRP_SH.TableToNumericalKeys(LDRP_SH.Blueprints),result,nil,nil,nil,true))
  9090.  
  9091. elseif casetype == 2 then
  9092.  
  9093. zm.OpenHiddenTab(zm.OpenCase("Weapons Case",Color(255,121,77, 150),LDRP_SH.TableToNumericalKeys(LDRP_SH.WeaponsCase),result))
  9094.  
  9095. elseif casetype == 3 then
  9096.  
  9097. zm.OpenHiddenTab(zm.OpenCase("Rares Case",Color(230,115,0),LDRP_SH.TableToNumericalKeys(LDRP_SH.RaresCase),result))
  9098.  
  9099. elseif casetype == 4 then
  9100.  
  9101. zm.OpenHiddenTab(zm.OpenCase("Cash Case",Color(0,158,0),LDRP_SH.TableToNumericalKeys(LDRP_SH.CashCasePrizes),result))
  9102.  
  9103. elseif casetype == 5 then
  9104.  
  9105. zm.OpenHiddenTab(zm.OpenCase("GenCorp Case",Color(66,161,255),LDRP_SH.TableToNumericalKeys(LDRP_SH.GenCorpCase),result))
  9106.  
  9107. elseif casetype == 6 then
  9108.  
  9109. zm.OpenHiddenTab(zm.OpenCase("Magik Box",Color(112,48,160),LDRP_SH.TableToNumericalKeys(LDRP_SH.MagikBoxCase),result))
  9110.  
  9111. end
  9112.  
  9113. end
  9114.  
  9115. net.Receive("OpenCase",zm.IncomingCase)
  9116.  
  9117.  
  9118.  
  9119. function zm.OpenSteamCase(l)
  9120.  
  9121. local result = net.ReadUInt(4)
  9122.  
  9123. local key = net.ReadString()
  9124.  
  9125. local redeemplatform = net.ReadString()
  9126.  
  9127. local gamelink = net.ReadString()
  9128.  
  9129. local games = net.ReadTable()
  9130.  
  9131. local items = {}
  9132.  
  9133. for k,v in ipairs(games) do
  9134.  
  9135. table.insert(items, {name = v, icon = "zarp/steamgame256.png"})
  9136.  
  9137. end
  9138.  
  9139.  
  9140.  
  9141. zm.OpenHiddenTab(zm.OpenCase("Steam Game Case",Color(66,161,255),items,result,key,redeemplatform,gamelink))
  9142.  
  9143. end
  9144.  
  9145. net.Receive("OpenSteamCase",zm.OpenSteamCase)
  9146.  
  9147.  
  9148.  
  9149. local AdventSoundEnabled = true
  9150.  
  9151. function zm.ZARPAdventCalendarTab()
  9152.  
  9153. local CalendarBG = Material("zarp/adventcalendar16-bg.jpg","noclamp smooth")
  9154.  
  9155. local CalendarLogo = Material("zarp/zarpadvent-logo.png","noclamp smooth")
  9156.  
  9157. local AdventSticker = Material("zarp/adventcalendar-sticker.png","noclamp smooth")
  9158.  
  9159. local LightBulbSprite = Material("zarp/advent-lightsprite.png","noclamp smooth")
  9160.  
  9161. local SoundIcon = Material("zarp/slots-summer-soundicon.png","noclamp smooth")
  9162.  
  9163. local SoundMutedIcon = Material("zarp/slots-summer-soundmutedicon.png","noclamp smooth")
  9164.  
  9165. local LightSprite = Material("effects/yellowflare")
  9166.  
  9167.  
  9168.  
  9169. local HasSeenIntro = tobool(cookie.GetString("ZARPAdvent16Intro","false"))
  9170.  
  9171.  
  9172.  
  9173. local ClientData = {}
  9174.  
  9175. for k,v in pairs(string.Explode(";",cookie.GetString("ZARPAdvent16",""))) do
  9176.  
  9177. table.insert(ClientData,tonumber(v))
  9178.  
  9179. end
  9180.  
  9181.  
  9182.  
  9183. local LightSprites = {{50, 490, 10, Color(255,0,0)},{250, 490, -30, Color(51,51,255)},{450, 490, 20, Color(0,255,0)},{650, 490, -15, Color(255,255,0)},{850, 490, 15, Color(51,51,255)},
  9184.  
  9185. {50, 30, 190, Color(255,255,0)},{275, 30, 160, Color(51,51,255)},{425, 30, 200, Color(0,255,0)},{675, 30, 170,Color(255,0,0) },{825, 30, 190, Color(0,255,0)}}
  9186.  
  9187.  
  9188.  
  9189. local BackGround = vgui.Create("DPanel",F4Menu)
  9190.  
  9191. BackGround:SetSize(890,520)
  9192.  
  9193. BackGround.Paint = function(s,w,h)
  9194.  
  9195. surface.SetMaterial(CalendarBG)
  9196.  
  9197. surface.SetDrawColor(color_white)
  9198.  
  9199. surface.DrawTexturedRect( 0,0,w,h )
  9200.  
  9201.  
  9202.  
  9203. //Calendar logo
  9204.  
  9205. if HasSeenIntro then
  9206.  
  9207. surface.SetMaterial(CalendarLogo)
  9208.  
  9209. surface.SetDrawColor(color_white)
  9210.  
  9211. surface.DrawTexturedRect( w - 357,h - 136,302,91 )
  9212.  
  9213. end
  9214.  
  9215. end
  9216.  
  9217. BackGround.PaintOver = function(s,w,h)
  9218.  
  9219. //Light sprites bottom
  9220.  
  9221. for k,v in pairs(LightSprites) do
  9222.  
  9223. surface.SetMaterial(LightBulbSprite)
  9224.  
  9225. surface.SetDrawColor(color_white)
  9226.  
  9227. surface.DrawTexturedRectRotated( v[1],v[2],34,84,v[3] )
  9228.  
  9229. end
  9230.  
  9231. end
  9232.  
  9233. BackGround.OnRemove = function(s,w,h)
  9234.  
  9235. for k,v in pairs(s.Sprites) do
  9236.  
  9237. v:Remove()
  9238.  
  9239. end
  9240.  
  9241. if IsValid(AdventCalendarLoop) then AdventCalendarLoop:Stop() AdventCalendarLoop = nil end
  9242.  
  9243. end
  9244.  
  9245.  
  9246.  
  9247. //Advent play sound
  9248.  
  9249. local function AdventPlaySound(soundfile, vol, loop, pitch, ambienceloop, inplaceloop)
  9250.  
  9251. if not AdventSoundEnabled then return end
  9252.  
  9253. if pitch then sound.Play( soundfile, LocalPlayer():GetPos(), 75, pitch, (vol / 100) ) return end
  9254.  
  9255. sound.PlayFile(soundfile,loop and "noblock" or "", function(chan)
  9256.  
  9257. if IsValid(chan) then
  9258.  
  9259. if loop then
  9260.  
  9261. AdventCalendarLoop = chan
  9262.  
  9263. AdventCalendarLoop:EnableLooping(true)
  9264.  
  9265. end
  9266.  
  9267. chan:SetVolume(vol or 50)
  9268.  
  9269. end
  9270.  
  9271. end)
  9272.  
  9273. end
  9274.  
  9275. AdventPlaySound("sound/darkrp/christmas_loop.mp3", 0.5, true)
  9276.  
  9277.  
  9278.  
  9279. //Create animated light sprites
  9280.  
  9281. BackGround.Sprites = {}
  9282.  
  9283. local function CreateLightSprite(x,y,color)
  9284.  
  9285. local Sprite = CreateSprite(LightSprite)
  9286.  
  9287. Sprite:SetParent(BackGround)
  9288.  
  9289. Sprite:SetColor(color)
  9290.  
  9291. Sprite:SetDrawOnTop(true)
  9292.  
  9293.  
  9294.  
  9295. Sprite:SetSize(150,150)
  9296.  
  9297. Sprite:SetPos(x,y)
  9298.  
  9299.  
  9300.  
  9301. local delay = math.random(1.5,3.5)
  9302.  
  9303. local maxsize = math.random(300,350)
  9304.  
  9305.  
  9306.  
  9307. function Sprite:GlowEffect()
  9308.  
  9309. Sprite:SizeTo( Sprite:GetSize() <= 150 and maxsize or 150, Sprite:GetSize() <= 150 and maxsize or 150, delay, 0, -1, function() Sprite:GlowEffect() end)
  9310.  
  9311. end
  9312.  
  9313. Sprite:GlowEffect()
  9314.  
  9315. //Sprite:SetDrawOnTop(true)
  9316.  
  9317. table.insert(BackGround.Sprites, Sprite)
  9318.  
  9319. end
  9320.  
  9321. for k,v in pairs(LightSprites) do
  9322.  
  9323. CreateLightSprite(v[1],v[2],v[4])
  9324.  
  9325. end
  9326.  
  9327.  
  9328.  
  9329. local date = os.date("!*t",os.time())
  9330.  
  9331. //local date = {month = 12, day = 8}
  9332.  
  9333. local function HasDayPassed(day)
  9334.  
  9335. if (date.month != 12) then return true
  9336.  
  9337. elseif (date.day > day) then return true
  9338.  
  9339. else return false end
  9340.  
  9341. end
  9342.  
  9343.  
  9344.  
  9345. local AdventList = vgui.Create( "DIconLayout",BackGround)
  9346.  
  9347. AdventList:SetSize( 850,490 )
  9348.  
  9349. AdventList:SetPos(45,30)
  9350.  
  9351. AdventList:SetSpaceY(5)
  9352.  
  9353. AdventList:SetSpaceX(5)
  9354.  
  9355.  
  9356.  
  9357. for k,v in pairs(ZARP.AdventCalendar) do
  9358.  
  9359. local AdventDoor = AdventList:Add("DButton")
  9360.  
  9361. AdventDoor:SetSize(110,110)
  9362.  
  9363. AdventDoor.StickerColor = 255
  9364.  
  9365. //AdventDoor:SizeTo( 110, 110, (0.1 * k), 0, 1, function() end )
  9366.  
  9367. AdventDoor:SetText("")
  9368.  
  9369. AdventDoor.Paint = function(s,w,h)
  9370.  
  9371. if !HasSeenIntro then return end
  9372.  
  9373. surface.SetMaterial(v[6] or AdventSticker)
  9374.  
  9375. //surface.SetDrawColor(s:GetDisabled() and Color(128,128,128,200) or color_white)
  9376.  
  9377.  
  9378.  
  9379. if s.DayDone then
  9380.  
  9381. surface.SetDrawColor(Color(77,77,77,200))
  9382.  
  9383. else
  9384.  
  9385. surface.SetDrawColor(Color(255,v[6] and 255 or s.StickerColor,v[6] and 255 or s.StickerColor))
  9386.  
  9387. end
  9388.  
  9389. s.ImageSize = math.Approach(s.ImageSize or 0, w, FrameTime() * 150)
  9390.  
  9391. s.ImagePos = math.Approach(s.ImagePos or 55, 0, FrameTime() * 75)
  9392.  
  9393. surface.DrawTexturedRect( s:IsDown() and (s.ImagePos + 3) or s.ImagePos,s:IsDown() and (s.ImagePos + 3) or s.ImagePos,s:IsDown() and (s.ImageSize - 6) or s.ImageSize,s:IsDown() and (s.ImageSize - 6) or s.ImageSize )
  9394.  
  9395.  
  9396.  
  9397. if s:IsHovered() then
  9398.  
  9399. s.StickerColor = math.Approach(s.StickerColor, 255, FrameTime() * 400)
  9400.  
  9401. else
  9402.  
  9403. s.StickerColor = math.Approach(s.StickerColor, 51, FrameTime() * 400)
  9404.  
  9405. end
  9406.  
  9407.  
  9408.  
  9409. //surface.SetDrawColor(Color(255,255,255,50))
  9410.  
  9411. //surface.DrawRect( 0,0,w,h )
  9412.  
  9413. if (s.ImageSize >= w) then
  9414.  
  9415. s.TextAlpha = math.Approach(s.TextAlpha or 0, 255, FrameTime() * 300)
  9416.  
  9417. draw.SimpleTextOutlined(v[1],"ZMenuHeader",(w /2),(h / 2),Color(255,255,255,s.TextAlpha),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 1, Color(0,0,0,s.TextAlpha) )
  9418.  
  9419. end
  9420.  
  9421. end
  9422.  
  9423. if table.HasValue(ClientData,v[1]) or HasDayPassed(v[1]) then
  9424.  
  9425. AdventDoor:SetCursor("no")
  9426.  
  9427. AdventDoor:SetDisabled(true)
  9428.  
  9429. AdventDoor.DayDone = true
  9430.  
  9431. end
  9432.  
  9433. AdventDoor.DoClick = function()
  9434.  
  9435. if date.day != v[1] then return end
  9436.  
  9437. AdventPlaySound("sound/darkrp/advent_open.wav", 100)
  9438.  
  9439. RunConsoleCommand("_ZARPAdventCalendar", v[1])
  9440.  
  9441. end
  9442.  
  9443. if date.day != v[1] and !HasDayPassed(v[1]) then AdventDoor:SetTooltip(string.format("Claim this gift on December %i%s",v[1],v[5])) AdventDoor:SetCursor("no") AdventDoor:SetDisabled(true) end
  9444.  
  9445. end
  9446.  
  9447.  
  9448.  
  9449. //Advent calendar intro
  9450.  
  9451. if !HasSeenIntro then
  9452.  
  9453. local MarkupText = markup.Parse([[<font=OpenSans24Font>We’re giving away a gift every day with the ZARP Advent Calendar. This year the gifts are better than ever. Log in each day to open the next gift. Simply find the current day on the calendar and click to uncover the gift. If you miss a day, the gift will be gone forever! So be sure to login and uncover your gifts. Plus we’ll be giving out rare gifts on certain days too. Merry Christmas ZARP!</font>]], 600)
  9454.  
  9455. local AdventIntro = vgui.Create("DPanel",BackGround)
  9456.  
  9457. AdventIntro:SetSize(890,520)
  9458.  
  9459. AdventIntro:SetDrawOnTop(true)
  9460.  
  9461. AdventIntro.Paint = function(s,w,h)
  9462.  
  9463. surface.SetDrawColor(Color(77,77,77,240))
  9464.  
  9465. surface.DrawRect(0,0,w,h)
  9466.  
  9467.  
  9468.  
  9469. //Draw logo
  9470.  
  9471. surface.SetMaterial(CalendarLogo)
  9472.  
  9473. surface.SetDrawColor(color_white)
  9474.  
  9475. surface.DrawTexturedRect( (w / 2) - 225,20,450,136)
  9476.  
  9477.  
  9478.  
  9479. if MarkupText then MarkupText:Draw((w / 2) - 300, 161) end
  9480.  
  9481. end
  9482.  
  9483.  
  9484.  
  9485. local IntroConfirmBtn = vgui.Create("DButton",AdventIntro)
  9486.  
  9487. IntroConfirmBtn:SetPos((AdventIntro:GetWide() / 2) - 175, 181 + MarkupText:GetHeight())
  9488.  
  9489. IntroConfirmBtn:SetSize(350,64)
  9490.  
  9491. IntroConfirmBtn:SetText("")
  9492.  
  9493. IntroConfirmBtn.Paint = function(s,w,h)
  9494.  
  9495. surface.SetDrawColor(Color( 204,0,0,255 ))
  9496.  
  9497. surface.DrawRect( 0,0,w,h )
  9498.  
  9499. if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
  9500.  
  9501. draw.SimpleTextOutlined("Continue to Calendar","Trebuchet24",(w / 2),(h / 2),Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 1, Color(0,0,0,200) )
  9502.  
  9503. end
  9504.  
  9505. IntroConfirmBtn.DoClick = function()
  9506.  
  9507. AdventIntro:Remove()
  9508.  
  9509. cookie.Set( "ZARPAdvent16Intro","true")
  9510.  
  9511. HasSeenIntro = true
  9512.  
  9513. end
  9514.  
  9515. end
  9516.  
  9517.  
  9518.  
  9519. local SoundBtn = vgui.Create("DButton",BackGround)
  9520.  
  9521. SoundBtn:SetSize(40,40)
  9522.  
  9523. SoundBtn:SetText("")
  9524.  
  9525. SoundBtn:SetPos(BackGround:GetWide() - 100, BackGround:GetTall() - 45)
  9526.  
  9527. SoundBtn.Paint = function(s,w,h)
  9528.  
  9529. surface.SetMaterial(AdventSoundEnabled and SoundIcon or SoundMutedIcon)
  9530.  
  9531. surface.SetDrawColor(color_white)
  9532.  
  9533. if s:IsDown() then surface.DrawTexturedRect( 2,2,w-4,h-4 )
  9534.  
  9535. else surface.DrawTexturedRect( 0,0,w,h ) end
  9536.  
  9537. end
  9538.  
  9539. SoundBtn.DoClick = function()
  9540.  
  9541. AdventSoundEnabled = !AdventSoundEnabled
  9542.  
  9543. print(AdventSoundEnabled)
  9544.  
  9545. if !AdventSoundEnabled and IsValid(AdventCalendarLoop) then AdventCalendarLoop:Pause()
  9546.  
  9547. elseif IsValid(AdventCalendarLoop) then AdventCalendarLoop:Play() AdventCalendarLoop:SetVolume(0.4) end
  9548.  
  9549.  
  9550.  
  9551. if AdventSoundEnabled and not IsValid(AdventCalendarLoop) then
  9552.  
  9553. AdventPlaySound("sound/darkrp/christmas_loop.mp3", 0.5, false, nil, true)
  9554.  
  9555. end
  9556.  
  9557. end
  9558.  
  9559.  
  9560.  
  9561. return BackGround
  9562.  
  9563. end
  9564.  
  9565.  
  9566.  
  9567. function zm.AdventCalendarOpened(len)
  9568.  
  9569. local day = net.ReadUInt(8)
  9570.  
  9571. if not day then return end
  9572.  
  9573.  
  9574.  
  9575. local adventreward
  9576.  
  9577. for k,v in pairs(ZARP.AdventCalendar) do
  9578.  
  9579. if v[1] == day then adventreward = k end
  9580.  
  9581. end
  9582.  
  9583.  
  9584.  
  9585. cookie.Set("ZARPAdvent16",string.format("%s;%i",cookie.GetString("ZARPAdvent16",""),day))
  9586.  
  9587.  
  9588.  
  9589. local daystring = string.format("ZARP Advent Calendar - December %i%s",day,ZARP.AdventCalendar[adventreward][5])
  9590.  
  9591.  
  9592.  
  9593. CasePopUp(daystring, string.format("Today's gift is: %s",ZARP.AdventCalendar[adventreward][2]), ZARP.AdventCalendar[adventreward][3], Color(255,51,51), nil, nil, nil, true)
  9594.  
  9595. surface.PlaySound("darkrp/santa1.mp3")
  9596.  
  9597. end
  9598.  
  9599. net.Receive("AdventCalendar",zm.AdventCalendarOpened)
  9600.  
  9601.  
  9602.  
  9603. local LDRP = {}
  9604.  
  9605.  
  9606.  
  9607. function LDRP.OpenItemOptions(item)
  9608.  
  9609. if LocalPlayer().Inventory[item] then
  9610.  
  9611. local WepNames = LDRP_SH.NicerWepNames
  9612.  
  9613. local OptionsMenu = vgui.Create("DFrame")
  9614.  
  9615. OptionsMenu:SetPos(-200, ScrH()*.5-80)
  9616.  
  9617. OptionsMenu:MakePopup()
  9618.  
  9619. OptionsMenu:SetSize(200, 284)
  9620.  
  9621. OptionsMenu:MoveTo(ScrW()*.5-100,ScrH()*.5-80,.3)
  9622.  
  9623. local Tbl = LDRP_SH.AllItems[item]
  9624.  
  9625.  
  9626.  
  9627. OptionsMenu.Paint = function(s,w,h)
  9628.  
  9629. draw.RoundedBox(6,0,0,w,h,Color(50,50,50,180))
  9630.  
  9631. local name = WepNames[Tbl.nicename] or Tbl.nicename
  9632.  
  9633. draw.SimpleTextOutlined(name .. " - " .. LocalPlayer().Inventory[item] .. " left","Trebuchet20",100,14,Color(255,255,255,200),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  9634.  
  9635. end
  9636.  
  9637. OptionsMenu:SetTitle("")
  9638.  
  9639. OptionsMenu.MakeClose = function()
  9640.  
  9641. OptionsMenu:MoveTo(ScrW(),ScrH()*.5-80,.3)
  9642.  
  9643. timer.Simple(.3,function()
  9644.  
  9645. if OptionsMenu:IsValid() then OptionsMenu:Close() end
  9646.  
  9647. end)
  9648.  
  9649. end
  9650.  
  9651.  
  9652.  
  9653. local counter
  9654.  
  9655.  
  9656.  
  9657. local UseButton = vgui.Create("DButton",OptionsMenu)
  9658.  
  9659. UseButton:SetPos(4,30)
  9660.  
  9661. UseButton:SetSize(192,32)
  9662.  
  9663. UseButton:SetText(Tbl.usename or "Use")
  9664.  
  9665. if Tbl.cuse then
  9666.  
  9667. UseButton.DoClick = function()
  9668.  
  9669. if counter:GetValue() != 1 then
  9670.  
  9671. local name = WepNames[Tbl.nicename] or Tbl.nicename
  9672.  
  9673. Derma_Query("Are you sure you want to use "..(counter and math.Round(counter:GetValue()) or "").." ".. name.."(s)", "Confirm Usage" , "Yes", function()
  9674.  
  9675. RunConsoleCommand("_inven","use",item, counter:GetValue()) OptionsMenu.MakeClose() end, "No", function() OptionsMenu.MakeClose() end)
  9676.  
  9677. return
  9678.  
  9679. end
  9680.  
  9681. if (Tbl.usename == "Open Case") then ZARP.SetNewItemLogSuppressed(true) end
  9682.  
  9683. RunConsoleCommand("_inven","use",item, counter:GetValue())
  9684.  
  9685. OptionsMenu.MakeClose()
  9686.  
  9687. end
  9688.  
  9689. else
  9690.  
  9691. UseButton:SetDisabled(true)
  9692.  
  9693. end
  9694.  
  9695.  
  9696.  
  9697. local DropButton = vgui.Create("DButton",OptionsMenu)
  9698.  
  9699. DropButton:SetPos(4,66)
  9700.  
  9701. DropButton:SetSize(192,32)
  9702.  
  9703. DropButton:SetText("Drop")
  9704.  
  9705. DropButton.DoClick = function()
  9706.  
  9707. if (item == "nuclear equipment") and ZARP.NukeConfig then
  9708.  
  9709. local notenoughplayers,notenoughcops
  9710.  
  9711. local numcops = 0
  9712.  
  9713. for k,v in pairs(player.GetAll()) do if v:IsCP() then numcops = (numcops + 1) end end
  9714.  
  9715. if (#player.GetAll() < ZARP.NukeConfig.MinPlayers) then notenoughplayers = true
  9716.  
  9717. elseif (numcops < ZARP.NukeConfig.MinCops) then notenoughcops = true end
  9718.  
  9719.  
  9720.  
  9721. if notenoughplayers or notenoughcops then
  9722.  
  9723. Derma_Query( string.format("There are currently not enough %s online to launch a nuke. There needs to be %i online. Do you still want to drop the item? (It cannot be picked up again)", notenoughplayers and "players" or "cops", notenoughplayers and ZARP.NukeConfig.MinPlayers or ZARP.NukeConfig.MinCops), "Drop Confirmation", "Yes", function()
  9724.  
  9725. RunConsoleCommand("_inven","drop",item)
  9726.  
  9727. OptionsMenu.MakeClose()
  9728.  
  9729. end, "Cancel", function() OptionsMenu.MakeClose() end)
  9730.  
  9731. else
  9732.  
  9733. RunConsoleCommand("_inven","drop",item)
  9734.  
  9735. OptionsMenu.MakeClose()
  9736.  
  9737. end
  9738.  
  9739. else
  9740.  
  9741. RunConsoleCommand("_inven","drop",item)
  9742.  
  9743. OptionsMenu.MakeClose()
  9744.  
  9745. end
  9746.  
  9747. end
  9748.  
  9749. if Tbl.nodrop then DropButton:SetDisabled(true) end
  9750.  
  9751.  
  9752.  
  9753. //Convert to gems
  9754.  
  9755. local gemsvalue = ZARP.GetItemGemValue(item)
  9756.  
  9757. local GemsButton = vgui.Create("DButton",OptionsMenu)
  9758.  
  9759. GemsButton:SetPos(4,102)
  9760.  
  9761. GemsButton:SetSize(192,32)
  9762.  
  9763. GemsButton:SetText(string.format("Convert to Gems (%s Gems)",ZARP.formatNumber(gemsvalue or 0)))
  9764.  
  9765. GemsButton.DoClick = function()
  9766.  
  9767. local am = IsValid(counter) and counter:GetValue() or 1
  9768.  
  9769. Derma_Query(string.format("Are you sure you want to convert %i %s(s) into %i Gems?",am, Tbl.nicename or item,(am * gemsvalue)), "Confirm Conversion", "Convert", function()
  9770.  
  9771. RunConsoleCommand("_inven","gems",item,am) if IsValid(OptionsMenu) then OptionsMenu.MakeClose() end end, "Cancel", function() if IsValid(OptionsMenu) then OptionsMenu.MakeClose() end end)
  9772.  
  9773. end
  9774.  
  9775. if not gemsvalue then GemsButton:SetDisabled(true) end
  9776.  
  9777.  
  9778.  
  9779. //Auction item
  9780.  
  9781. local AuctionButton = vgui.Create("DButton",OptionsMenu)
  9782.  
  9783. AuctionButton:SetPos(4,138)
  9784.  
  9785. AuctionButton:SetSize(192,32)
  9786.  
  9787. AuctionButton:SetText("Auction Item")
  9788.  
  9789. AuctionButton.DoClick = function()
  9790.  
  9791. OptionsMenu.MakeClose()
  9792.  
  9793. local name = WepNames[Tbl.nicename] or Tbl.nicename
  9794.  
  9795. local AuctionFrame = vgui.Create("DFrame")
  9796.  
  9797. AuctionFrame:SetSize(200,223)
  9798.  
  9799. AuctionFrame:Center()
  9800.  
  9801. AuctionFrame:MakePopup()
  9802.  
  9803. AuctionFrame:SetTitle("")
  9804.  
  9805. AuctionFrame.Paint = function(s,w,h)
  9806.  
  9807. draw.RoundedBox(6,0,0,w,h,Color(50,50,50,180))
  9808.  
  9809. draw.SimpleTextOutlined(name,"Trebuchet20",100,14,Color(255,255,255,200),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  9810.  
  9811. end
  9812.  
  9813.  
  9814.  
  9815. local StartLbl = vgui.Create("DLabel",AuctionFrame)
  9816.  
  9817. StartLbl:SetPos(4,27)
  9818.  
  9819. StartLbl:SetText("Start Price ($):")
  9820.  
  9821. StartLbl:SizeToContents()
  9822.  
  9823. local StartPrice = vgui.Create("DNumberWang",AuctionFrame)
  9824.  
  9825. StartPrice:SetPos(4,30 + StartLbl:GetTall())
  9826.  
  9827. StartPrice:SetSize(192,32)
  9828.  
  9829. StartPrice:SetText(10000)
  9830.  
  9831. StartPrice:SetMinMax(10000,1000000000)
  9832.  
  9833.  
  9834.  
  9835. local MinIncrLbl = vgui.Create("DLabel",AuctionFrame)
  9836.  
  9837. MinIncrLbl:SetPos(4,80)
  9838.  
  9839. MinIncrLbl:SetText("Minimum Increment ($):")
  9840.  
  9841. MinIncrLbl:SizeToContents()
  9842.  
  9843. local MinIncr = vgui.Create("DNumberWang",AuctionFrame)
  9844.  
  9845. MinIncr:SetPos(4,84 + MinIncrLbl:GetTall())
  9846.  
  9847. MinIncr:SetSize(192,32)
  9848.  
  9849. MinIncr:SetText(1000)
  9850.  
  9851. MinIncr:SetMinMax(1000,1000000)
  9852.  
  9853.  
  9854.  
  9855. local LengthLbl = vgui.Create("DLabel",AuctionFrame)
  9856.  
  9857. LengthLbl:SetPos(4,133)
  9858.  
  9859. LengthLbl:SetText("Auction Length:")
  9860.  
  9861. LengthLbl:SizeToContents()
  9862.  
  9863. local Length = vgui.Create("DComboBox",AuctionFrame)
  9864.  
  9865. Length:SetPos(4,137 + MinIncrLbl:GetTall())
  9866.  
  9867. Length:SetSize(192,32)
  9868.  
  9869. for k,v in pairs(LDRP_SH.AuctionLengths) do
  9870.  
  9871. Length:AddChoice(v[1],k,k==1)
  9872.  
  9873. end
  9874.  
  9875.  
  9876.  
  9877. local Submit = vgui.Create("DButton",AuctionFrame)
  9878.  
  9879. Submit:SetPos(4,186)
  9880.  
  9881. Submit:SetSize(192,32)
  9882.  
  9883. Submit:SetText("Auction Item")
  9884.  
  9885. Submit.DoClick = function(s)
  9886.  
  9887. if (StartPrice:GetValue() > StartPrice:GetMax()) or (StartPrice:GetValue() < StartPrice:GetMin()) then
  9888.  
  9889. Derma_Message(string.format("Auction Start Price must be between: ($%i-$%i)",StartPrice:GetMin(),StartPrice:GetMax()),"Auction Error")
  9890.  
  9891. elseif (MinIncr:GetValue() > MinIncr:GetMax()) or (MinIncr:GetValue() < MinIncr:GetMin()) then
  9892.  
  9893. Derma_Message(string.format("Minimum Increment must be between: ($%i-$%i)",MinIncr:GetMin(),MinIncr:GetMax()),"Auction Error")
  9894.  
  9895. else
  9896.  
  9897. RunConsoleCommand("_listauctionitem",item,StartPrice:GetValue(),MinIncr:GetValue(),Length:GetSelectedID())
  9898.  
  9899. AuctionFrame:Close()
  9900.  
  9901. //zm.Close()
  9902.  
  9903. end
  9904.  
  9905. end
  9906.  
  9907. end
  9908.  
  9909. if table.HasValue(LDRP_SH.AuctionItemBlacklist, item) then AuctionButton:SetDisabled(true) end
  9910.  
  9911.  
  9912.  
  9913. local BankButton = vgui.Create("DButton",OptionsMenu)
  9914.  
  9915. BankButton:SetPos(4,174)
  9916.  
  9917. BankButton:SetSize(192,32)
  9918.  
  9919. BankButton:SetText("Bank Item ")
  9920.  
  9921. BankButton.DoClick = function()
  9922.  
  9923. ZARP.ShopItemOptions(item,"bank","Put in bank") OptionsMenu.MakeClose()
  9924.  
  9925. end
  9926.  
  9927.  
  9928.  
  9929. local SendToButton = vgui.Create("DButton",OptionsMenu)
  9930.  
  9931. SendToButton:SetPos(4,210)
  9932.  
  9933. SendToButton:SetSize(192,32)
  9934.  
  9935. SendToButton:SetText("Gift Item to Player")
  9936.  
  9937. SendToButton.DoClick = function()
  9938.  
  9939. local name = WepNames[Tbl.nicename] or Tbl.nicename
  9940.  
  9941. local playermenu = DermaMenu(SendToButton)
  9942.  
  9943. for k,v in pairs(player.GetAll()) do
  9944.  
  9945. if (v != LocalPlayer()) then playermenu:AddOption(v:Nick(), function()
  9946.  
  9947. Derma_Query("Are you sure you want to send "..(counter and math.Round(counter:GetValue()) or "").." ".. name.. "(s) to "..v:Nick().."?", "Confirm Action" , "Yes", function()
  9948.  
  9949. RunConsoleCommand("_inven", "gift",item, counter:GetValue(), v:UserID()) OptionsMenu.MakeClose() end, "Cancel", function() OptionsMenu.MakeClose() end)
  9950.  
  9951. end) end
  9952.  
  9953. end
  9954.  
  9955. playermenu:Open()
  9956.  
  9957. end
  9958.  
  9959.  
  9960.  
  9961. local RemoveButton = vgui.Create("DButton",OptionsMenu)
  9962.  
  9963. RemoveButton:SetPos(4,246)
  9964.  
  9965. RemoveButton:SetSize(192,32)
  9966.  
  9967. RemoveButton:SetText("Remove")
  9968.  
  9969. RemoveButton.DoClick = function()
  9970.  
  9971. local name = WepNames[Tbl.nicename] or Tbl.nicename
  9972.  
  9973. Derma_Query("Are you sure you want to remove "..(counter and math.Round(counter:GetValue()) or "").." ".. name.. "(s) " .."?", "Confirm Action" , "Yes", function()
  9974.  
  9975. RunConsoleCommand("_inven", "delete",item, counter:GetValue()) OptionsMenu.MakeClose() end, "Cancel", function() OptionsMenu.MakeClose() end)
  9976.  
  9977. end
  9978.  
  9979.  
  9980.  
  9981. counter = vgui.Create("DNumSlider",OptionsMenu)
  9982.  
  9983. counter:SetPos(4,275)
  9984.  
  9985. counter:SetWidth(180)
  9986.  
  9987. counter:SizeToContents()
  9988.  
  9989. counter:SetText("How Many?")
  9990.  
  9991. counter:SetMax(LocalPlayer().Inventory[item])
  9992.  
  9993. counter:SetMin(1)
  9994.  
  9995. counter:SetMax(LocalPlayer().Inventory[item])
  9996.  
  9997. counter:SetDecimals(0)
  9998.  
  9999. counter:SetValue(1)
  10000.  
  10001. counter:SetVisible(false)
  10002.  
  10003. if Tbl.multiuse then OptionsMenu:SetSize(200, OptionsMenu:GetTall() + 27) counter:SetVisible(true)
  10004.  
  10005. if gemsvalue then
  10006.  
  10007. counter.OnValueChanged = function(s,num)
  10008.  
  10009. local num = math.Round(num)
  10010.  
  10011. GemsButton:SetText(string.format("Convert to Gems (%s Gems)",ZARP.formatNumber((gemsvalue or 0) * num)))
  10012.  
  10013. end
  10014.  
  10015. end
  10016.  
  10017. end
  10018.  
  10019. end
  10020.  
  10021. end
  10022.  
  10023.  
  10024.  
  10025. function zm.InventoryTab()
  10026.  
  10027. local WepNames = LDRP_SH.NicerWepNames
  10028.  
  10029. local BackGround = vgui.Create("DPanel",F4Menu)
  10030.  
  10031. BackGround:SetPos(4,4)
  10032.  
  10033. BackGround:SetSize(890,520)
  10034.  
  10035. BackGround.Paint = function(s,w,h)
  10036.  
  10037. local InvWeight = 0
  10038.  
  10039. for k,v in pairs(LocalPlayer().Inventory or {}) do
  10040.  
  10041. if v >= 1 then
  10042.  
  10043. InvWeight = InvWeight+(LDRP_SH.AllItems[k].weight*v)
  10044.  
  10045. end
  10046.  
  10047. end
  10048.  
  10049.  
  10050.  
  10051. draw.RoundedBox(6,0,0,w,h,Color(55, 100, 5, 150))
  10052.  
  10053. -- draw.RoundedBox(0,0,l*.01,w,l*.085,Color(250,250,250,220))
  10054.  
  10055. draw.SimpleTextOutlined("Inventory","ZMenuHeader",w*.5,h*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  10056.  
  10057. draw.SimpleTextOutlined("Weight: " .. InvWeight .. " out of " .. ZARP.CalculateMaxInventoryWeight(),"Trebuchet22",w*.5,h*.97,Color(255,255,255,200),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  10058.  
  10059. end
  10060.  
  10061.  
  10062.  
  10063. local ItemList = vgui.Create("DPanelList",BackGround)
  10064.  
  10065. ItemList:SetPos(4,56)
  10066.  
  10067. ItemList:SetSize(880,436)
  10068.  
  10069. ItemList:SetPadding(4)
  10070.  
  10071. ItemList:SetSpacing(4)
  10072.  
  10073. ItemList:EnableVerticalScrollbar(true)
  10074.  
  10075. ItemList:EnableHorizontal(true)
  10076.  
  10077. ItemList.Paint = function()
  10078.  
  10079. draw.RoundedBox(6,0,0,880,436,Color(250,250,250,220))
  10080.  
  10081. end
  10082.  
  10083. local CurIcons = {}
  10084.  
  10085.  
  10086.  
  10087. function ItemList:Update() -- This is probably a horrible way to do this, but look at half of the DarkRP code and see how much shittier that is instead of complaining about my code
  10088.  
  10089. for k,v in pairs(LocalPlayer().Inventory or {}) do
  10090.  
  10091. local Check = CurIcons[k]
  10092.  
  10093. if Check then
  10094.  
  10095. if Check.am != v or v <= 0 then
  10096.  
  10097. local ItemTbl = LDRP_SH.AllItems[k]
  10098.  
  10099. if !ItemTbl then continue end
  10100.  
  10101. if v <= 0 then
  10102.  
  10103. ItemList:RemoveItem(Check.vgui)
  10104.  
  10105. CurIcons[k] = nil
  10106.  
  10107. else
  10108.  
  10109. Check.vgui:SetToolTip(ItemTbl.nicename .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
  10110.  
  10111. CurIcons[k].am = v
  10112.  
  10113. end
  10114.  
  10115. end
  10116.  
  10117. elseif v > 0 then
  10118.  
  10119. local ItemTbl = LDRP_SH.AllItems[k]
  10120.  
  10121. if !ItemTbl then continue end
  10122.  
  10123. local ItemIcon = CreateIcon(ItemList,ItemTbl.mdl,78,78,function() LDRP.OpenItemOptions(k) end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,k)
  10124.  
  10125. CurIcons[k] = {["vgui"] = ItemIcon,["am"] = v}
  10126.  
  10127. local Namez = WepNames[ItemTbl.nicename] or ItemTbl.nicename
  10128.  
  10129. ItemIcon:SetToolTip(Namez .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
  10130.  
  10131.  
  10132.  
  10133.  
  10134.  
  10135. ItemList:AddItem(ItemIcon)
  10136.  
  10137. end
  10138.  
  10139. end
  10140.  
  10141. end
  10142.  
  10143.  
  10144.  
  10145. //New items panel
  10146.  
  10147. local NewItemsLog = vgui.Create("DPanel",BackGround)
  10148.  
  10149. NewItemsLog:SetPos(0,BackGround:GetTall() - 108)
  10150.  
  10151. NewItemsLog:SetSize(BackGround:GetWide(),108)
  10152.  
  10153. NewItemsLog.Paint = function(s,w,h)
  10154.  
  10155. draw.RoundedBox(6,0,0,w,h,Color(55, 100, 5,225))
  10156.  
  10157. draw.SimpleTextOutlined("New Items added to your inventory recently","Trebuchet22",5,2,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP, 2, Color(0,0,0,200) )
  10158.  
  10159. end
  10160.  
  10161.  
  10162.  
  10163. local CurItemsLog = {}
  10164.  
  10165. local NewItemLogList = vgui.Create( "DHorizontalScroller",NewItemsLog )
  10166.  
  10167. NewItemLogList:SetOverlap(-3)
  10168.  
  10169. NewItemLogList:SetSize(567,78)
  10170.  
  10171. NewItemLogList:SetPos(5,25)
  10172.  
  10173. NewItemLogList.Think = function(s,w,h)
  10174.  
  10175. for k,v in pairs(LocalPlayer().NewItemsLog) do
  10176.  
  10177. if !CurItemsLog[k] then
  10178.  
  10179. local ItemTbl = LDRP_SH.AllItems[k]
  10180.  
  10181. if !ItemTbl then continue end
  10182.  
  10183. local ItemIcon = CreateIcon(NewItemLogList,ItemTbl.mdl,78,78,function() end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,k)
  10184.  
  10185. ItemIcon.ID = k
  10186.  
  10187. ItemIcon.ItemAmount = v
  10188.  
  10189. local Namez = WepNames[ItemTbl.nicename] or ItemTbl.nicename
  10190.  
  10191. ItemIcon:SetToolTip(Namez .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
  10192.  
  10193.  
  10194.  
  10195. CurItemsLog[k] = ItemIcon
  10196.  
  10197. NewItemLogList:AddPanel(ItemIcon)
  10198.  
  10199. end
  10200.  
  10201. end
  10202.  
  10203. for k,v in pairs(CurItemsLog) do
  10204.  
  10205. if !LocalPlayer().NewItemsLog[v.ID] then
  10206.  
  10207. table.RemoveByValue(NewItemLogList.Panels, v)
  10208.  
  10209. CurItemsLog[k] = nil
  10210.  
  10211. v:Remove()
  10212.  
  10213. v = nil
  10214.  
  10215. NewItemLogList:InvalidateLayout(true)
  10216.  
  10217. continue
  10218.  
  10219. else
  10220.  
  10221. v.ItemAmount = LocalPlayer().NewItemsLog[v.ID]
  10222.  
  10223. end
  10224.  
  10225. end
  10226.  
  10227. end
  10228.  
  10229.  
  10230.  
  10231. local ConfirmLogBtn = vgui.Create("DButton",NewItemsLog)
  10232.  
  10233. ConfirmLogBtn:SetPos(610, 48)
  10234.  
  10235. ConfirmLogBtn:SetSize(250,32)
  10236.  
  10237. ConfirmLogBtn:SetText("")
  10238.  
  10239. ConfirmLogBtn.Paint = function(s,w,h)
  10240.  
  10241. surface.SetDrawColor(Color(0,179,45))
  10242.  
  10243. surface.DrawRect( s:IsDown() and 2 or 0,s:IsDown() and 2 or 0,s:IsDown() and w - 4 or w,s:IsDown() and h - 4 or h )
  10244.  
  10245. if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( s:IsDown() and 2 or 0,s:IsDown() and 2 or 0,s:IsDown() and w - 4 or w,s:IsDown() and h - 4 or h ) end
  10246.  
  10247.  
  10248.  
  10249. draw.SimpleTextOutlined("Confirm new items","Tre22",w / 2,16,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  10250.  
  10251. end
  10252.  
  10253. ConfirmLogBtn.DoClick = function()
  10254.  
  10255. LocalPlayer().NewItemsLog = {}
  10256.  
  10257. NewItemsLog:SetVisible(false)
  10258.  
  10259. end
  10260.  
  10261. NewItemsLog:SetVisible(false)
  10262.  
  10263.  
  10264.  
  10265. BackGround.Think = function()
  10266.  
  10267. ItemList:Update()
  10268.  
  10269. if ZARP.GetNumberNewItemsInLog() >= 1 and !NewItemsLog:IsVisible() then
  10270.  
  10271. NewItemsLog:SetVisible(true)
  10272.  
  10273. end
  10274.  
  10275. end
  10276.  
  10277.  
  10278.  
  10279. return BackGround
  10280.  
  10281. end
  10282.  
  10283.  
  10284.  
  10285.  
  10286.  
  10287. function zm.PremiumTab()
  10288.  
  10289. local EntitiesPanel = vgui.Create("DPanelList")
  10290.  
  10291. EntitiesPanel:EnableVerticalScrollbar( true )
  10292.  
  10293. EntitiesPanel:SetSpacing(10)
  10294.  
  10295. function EntitiesPanel:Update()
  10296.  
  10297. self:Clear(true)
  10298.  
  10299.  
  10300.  
  10301. local BuyTitle = vgui.Create("DPanel")
  10302.  
  10303. BuyTitle:SetSize(0,43)
  10304.  
  10305. BuyTitle.Paint = function()
  10306.  
  10307. draw.RoundedBox(4,0,0, BuyTitle:GetWide() - 8, BuyTitle:GetTall(), Color(30,30,30,150))
  10308.  
  10309. draw.SimpleTextOutlined("ZarpGaming Donation Page", "ZMenuHeader", (BuyTitle:GetWide() - 8) / 2 , 25, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10310.  
  10311.  
  10312.  
  10313. end
  10314.  
  10315.  
  10316.  
  10317. local BuyPanel = vgui.Create("DPanel")
  10318.  
  10319. BuyPanel:SetSize(0,60)
  10320.  
  10321. BuyPanel.Paint = function()
  10322.  
  10323. draw.RoundedBox(4,0,0, BuyPanel:GetWide() - 8, BuyPanel:GetTall(), Color(55, 100, 5,150))
  10324.  
  10325. draw.SimpleTextOutlined(vipmenutext, "KonthHUD2", (BuyPanel:GetWide() - 8) / 2 , 20, Color(73, 180, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10326.  
  10327. draw.SimpleTextOutlined(vipmenutext1, "KonthHUD2", 10 , 30, Color(73, 180, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color(0,0,0,255))
  10328.  
  10329. end
  10330.  
  10331.  
  10332.  
  10333. EntitiesPanel:AddItem( BuyTitle )
  10334.  
  10335. EntitiesPanel:AddItem( BuyPanel )
  10336.  
  10337.  
  10338.  
  10339. local prodname
  10340.  
  10341. local price
  10342.  
  10343. local duration
  10344.  
  10345. local textColor
  10346.  
  10347. local material
  10348.  
  10349. local clickurl
  10350.  
  10351. material = Material ("vip-iconzarp.png")
  10352.  
  10353. if not (LocalPlayer():IsZarpVIP()) then
  10354.  
  10355. prodname = "Zarp VIP"
  10356.  
  10357. duration = "Permanent"
  10358.  
  10359. price = " $19.95"
  10360.  
  10361. clickurl = "http://zarpgaming.com/index.php/zarp-vip"
  10362.  
  10363. vipmenutext = "Upgrade to ZARP VIP today!"
  10364.  
  10365. vipmenutext1 = "Help support our servers plus get instant access to loads of extra features and and benefits."
  10366.  
  10367. textColor = Color(255, 209, 72, 255)
  10368.  
  10369. else
  10370.  
  10371. prodname = "Zarp VIP (Purchased)"
  10372.  
  10373. duration = "Permanent"
  10374.  
  10375. price = "Paid for"
  10376.  
  10377. clickurl = "http://zarpgaming.com/index.php/zarp-vip"
  10378.  
  10379. vipmenutext = "ZARP VIP is active!"
  10380.  
  10381. vipmenutext1 = "If you need help or support please contact an admin or post in the forum for the speediest reply."
  10382.  
  10383. textColor = Color(0,255,0,255)
  10384.  
  10385. end
  10386.  
  10387. local BuyButton = vgui.Create( "DButton" )
  10388.  
  10389. BuyButton:SetSize( 250, 80 )
  10390.  
  10391. BuyButton:SetText("")
  10392.  
  10393. BuyButton.Paint = function(s)
  10394.  
  10395. draw.RoundedBox(4,0,0, BuyButton:GetWide() - 8, BuyButton:GetTall(), Color(13, 120, 185, 100))
  10396.  
  10397. draw.RoundedBox(4,2,2, BuyButton:GetWide() - 8 - 4, BuyButton:GetTall() / 2, Color(13, 120, 185, 100))
  10398.  
  10399. draw.SimpleTextOutlined("ZarpGaming - "..prodname , "KonthHUD2", (BuyButton:GetWide() - 8) / 2, 15, textColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10400.  
  10401. draw.SimpleTextOutlined("Duration : "..duration, "KonthHUD2", (BuyButton:GetWide() - 8) / 2, 40, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10402.  
  10403. draw.SimpleTextOutlined("Price : "..price, "KonthHUD2", (BuyButton:GetWide() - 8) / 2, 65, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10404.  
  10405. surface.SetDrawColor(255, 255, 255, 700)
  10406.  
  10407. surface.SetMaterial( material )
  10408.  
  10409. surface.DrawTexturedRect( 16, 8, 24, 24 )
  10410.  
  10411. if s:IsHovered() then
  10412.  
  10413. draw.RoundedBox(4,0,0, BuyButton:GetWide() - 8, BuyButton:GetTall(), Color(0, 0, 0, 75))
  10414.  
  10415. end
  10416.  
  10417. end
  10418.  
  10419. BuyButton.DoClick = function()
  10420.  
  10421. gui.OpenURL(clickurl)
  10422.  
  10423. end
  10424.  
  10425.  
  10426.  
  10427. EntitiesPanel:AddItem( BuyButton )
  10428.  
  10429.  
  10430.  
  10431. local purchased = LocalPlayer().DarkRPVars.PurchasedBoosters or 0
  10432.  
  10433. local claimed = LocalPlayer().DarkRPVars.Boosters or 0
  10434.  
  10435. local BoosterBtn = vgui.Create( "DButton" )
  10436.  
  10437. BoosterBtn:SetSize( 250, 80 )
  10438.  
  10439. BoosterBtn:SetText("")
  10440.  
  10441. BoosterBtn.Paint = function(s,w,h)
  10442.  
  10443. draw.RoundedBox(4,0,0, w - 8, h, Color(0,230,57))
  10444.  
  10445. draw.RoundedBox(4,2,2, w - 8 - 4, h / 2, Color(0,204,51))
  10446.  
  10447. draw.SimpleTextOutlined("ZarpGaming - Booster Pack" , "KonthHUD2", (w - 8) / 2, 15, textColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10448.  
  10449. if purchased >= 1 then
  10450.  
  10451. draw.SimpleTextOutlined(string.format("You have %i active booster pack(s)",claimed), "KonthHUD2", (w - 8) / 2, 40, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10452.  
  10453. if purchased > claimed then
  10454.  
  10455. draw.SimpleTextOutlined(string.format("You have %i booster pack(s) ready to be activated. Click here to claim them.",(purchased - claimed)), "KonthHUD2", (w - 8) / 2, 65, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10456.  
  10457. else
  10458.  
  10459. draw.SimpleTextOutlined("Click here to purchase another booster pack.", "KonthHUD2", (w - 8) / 2, 65, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10460.  
  10461. end
  10462.  
  10463. else
  10464.  
  10465. draw.SimpleTextOutlined("You can purchase a booster pack multiple times.", "KonthHUD2", (w - 8) / 2, 40, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10466.  
  10467. draw.SimpleTextOutlined("You will receive cases,cash and other upgrades. Click here to find out more.", "KonthHUD2", (w - 8) / 2, 65, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10468.  
  10469. end
  10470.  
  10471. surface.SetDrawColor(255, 255, 255, 700)
  10472.  
  10473. surface.SetMaterial( material )
  10474.  
  10475. surface.DrawTexturedRect( 16, 8, 24, 24 )
  10476.  
  10477. if s:IsHovered() then
  10478.  
  10479. draw.RoundedBox(4,0,0, w - 8, h, Color(0, 0, 0, 75))
  10480.  
  10481. end
  10482.  
  10483. end
  10484.  
  10485.  
  10486.  
  10487. if (claimed == purchased) then
  10488.  
  10489. BoosterBtn.DoClick = function() gui.OpenURL("http://zarpgaming.com/index.php/zarp-vip/booster-pack") end
  10490.  
  10491. else
  10492.  
  10493. BoosterBtn.DoClick = function() RunConsoleCommand("_ClaimBoosterPacks") zm.Close() end
  10494.  
  10495. end
  10496.  
  10497.  
  10498.  
  10499. EntitiesPanel:AddItem( BoosterBtn )
  10500.  
  10501.  
  10502.  
  10503.  
  10504.  
  10505. end
  10506.  
  10507.  
  10508.  
  10509. EntitiesPanel:Update()
  10510.  
  10511. return EntitiesPanel
  10512.  
  10513. end
  10514.  
  10515.  
  10516.  
  10517. function zm.VaultTab()
  10518.  
  10519. if not ZARP.VaultConfig or not ZARP.VaultConfig.Positions[string.lower(game.GetMap())] then return end
  10520.  
  10521. local w = 890
  10522.  
  10523. local l = 520
  10524.  
  10525. local vaultdata = ZARP.VaultConfig.Positions[string.lower(game.GetMap())]
  10526.  
  10527. local entsfound = ents.FindInBox(vaultdata.vaultmin, vaultdata.vaultmax)
  10528.  
  10529. local isinvault = LocalPlayer():GetActiveWeapon() and table.HasValue(entsfound,LocalPlayer():GetActiveWeapon())
  10530.  
  10531. if LocalPlayer():IsCP() then isinvault = false end
  10532.  
  10533.  
  10534.  
  10535. local BackGround = vgui.Create("DPanel",F4Menu)
  10536.  
  10537. BackGround:SetSize(l,w)
  10538.  
  10539. BackGround.Paint = function()
  10540.  
  10541. draw.RoundedBox(4,0,0,w,l,Color(13, 120, 185, 100))
  10542.  
  10543. draw.SimpleTextOutlined("ZARP BANK VAULT","ZMenuHeader",w*.5,l*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  10544.  
  10545. end
  10546.  
  10547.  
  10548.  
  10549. local BankList = vgui.Create("DScrollPanel", BackGround)
  10550.  
  10551. BankList:SetPos(0,54)
  10552.  
  10553. BankList:SetSize( w, 456 )
  10554.  
  10555. BankList:SetPadding(15)
  10556.  
  10557.  
  10558.  
  10559. function BankList:Update()
  10560.  
  10561. self:Clear(true)
  10562.  
  10563.  
  10564.  
  10565. local BuyPanel = vgui.Create("DPanel")
  10566.  
  10567. BuyPanel:SetSize(0,100)
  10568.  
  10569. BuyPanel.Paint = function()
  10570.  
  10571. draw.RoundedBox(4,0,0, BuyPanel:GetWide() - 8, BuyPanel:GetTall(), Color(255,255,255,30))
  10572.  
  10573. draw.SimpleTextOutlined("You can earn cash and cases by robbing the vault. Police will be alerted when the robbery is started.", "KonthHUD2", (BuyPanel:GetWide() - 8) / 2 , 20, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10574.  
  10575. draw.SimpleTextOutlined("Cash will be divided by all players inside the vault who started the robbery.", "KonthHUD2", (BuyPanel:GetWide() - 8) / 2 , 40, Color(73, 180, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10576.  
  10577. draw.SimpleTextOutlined("Any cases in the vault will spawn if you complete the robbery successfully.", "KonthHUD2", (BuyPanel:GetWide() - 8) / 2 , 60, Color(73, 180, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10578.  
  10579. end
  10580.  
  10581.  
  10582.  
  10583. BuyPanel:Dock( TOP )
  10584.  
  10585. BuyPanel:DockMargin( 8, 0, 0, 4 )
  10586.  
  10587. BankList:AddItem( BuyPanel )
  10588.  
  10589.  
  10590.  
  10591. local VaultLogo = Material("zarp/vault32.png","noclamp smooth")
  10592.  
  10593. local BuyButton = vgui.Create( "DButton" )
  10594.  
  10595. BuyButton:SetSize( 250, 80 )
  10596.  
  10597. BuyButton:SetText("")
  10598.  
  10599. BuyButton.Paint = function()
  10600.  
  10601. draw.RoundedBox(4,0,0, BuyButton:GetWide() - 8, BuyButton:GetTall(), Color(89,89,89))
  10602.  
  10603. draw.RoundedBox(4,2,2, BuyButton:GetWide() - 8 - 4, BuyButton:GetTall() / 2, Color(128,128,128))
  10604.  
  10605. draw.SimpleTextOutlined(isinvault and "Start a vault robbery" or (LocalPlayer():IsCP() and "Cops cannot raid the vault.") or "You must be inside the vault to start the robbery" , "KonthHUD2", (BuyButton:GetWide() - 8) / 2, 15, isinvault and Color(0,255,0) or Color(230,0,0), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10606.  
  10607. draw.SimpleTextOutlined("Defend the vault", "KonthHUD2", (BuyButton:GetWide() - 8) / 2, 40, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10608.  
  10609. draw.SimpleTextOutlined("Start", "KonthHUD2", (BuyButton:GetWide() - 8) / 2, 65, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10610.  
  10611. surface.SetDrawColor(255, 255, 255, 255)
  10612.  
  10613. surface.SetMaterial( VaultLogo )
  10614.  
  10615. surface.DrawTexturedRect( 16, 8, 24, 24 )
  10616.  
  10617. end
  10618.  
  10619. if !isinvault then BuyButton:SetCursor("no") end
  10620.  
  10621. BuyButton.DoClick = function()
  10622.  
  10623. if isinvault then RunConsoleCommand("_StartVaultRobbery") end
  10624.  
  10625. end
  10626.  
  10627.  
  10628.  
  10629. local PlayersLbl = vgui.Create("DLabel")
  10630.  
  10631. PlayersLbl:SetSize(0,100)
  10632.  
  10633. PlayersLbl:SetFont("KonthHUD2")
  10634.  
  10635. if isinvault then
  10636.  
  10637. local playerstext
  10638.  
  10639. local numinvault = 0
  10640.  
  10641. for k,v in pairs(ents.FindInBox(vaultdata.vaultmin,vaultdata.vaultmax)) do
  10642.  
  10643. if v:IsPlayer() and v:Alive() then
  10644.  
  10645. numinvault = (numinvault) + 1
  10646.  
  10647. if not playerstext then playerstext = "Players: " .. v:Nick()
  10648.  
  10649. else playerstext = playerstext .. "," .. v:Nick() end
  10650.  
  10651. end
  10652.  
  10653. end
  10654.  
  10655. if numinvault >= 1 then
  10656.  
  10657. PlayersLbl:SetText(string.format("You and %i other(s) are inside the vault.",
  10658.  
  10659. numinvault))
  10660.  
  10661. PlayersLbl:SetTooltip(playerstext)
  10662.  
  10663. else
  10664.  
  10665. PlayersLbl:SetText("You are the only one inside the vault.")
  10666.  
  10667. end
  10668.  
  10669. else PlayersLbl:SetVisible(false) end
  10670.  
  10671. PlayersLbl.Paint = function()
  10672.  
  10673. draw.RoundedBox(4,0,0, BuyButton:GetWide() - 8, BuyButton:GetTall(), Color(255,255,255,30))
  10674.  
  10675. end
  10676.  
  10677. PlayersLbl:SizeToContents()
  10678.  
  10679.  
  10680.  
  10681. BuyButton:Dock( TOP )
  10682.  
  10683. BuyButton:DockMargin( 8, 0, 0, 4 )
  10684.  
  10685. BankList:AddItem( BuyButton )
  10686.  
  10687. PlayersLbl:Dock( TOP )
  10688.  
  10689. PlayersLbl:DockMargin( 8, 0, 0, 4 )
  10690.  
  10691. BankList:AddItem( PlayersLbl )
  10692.  
  10693.  
  10694.  
  10695. local vaultent = ents.FindByClass("zarp_vault")[1]
  10696.  
  10697.  
  10698.  
  10699. if vaultent then
  10700.  
  10701. local VaultLbl = vgui.Create("DLabel")
  10702.  
  10703. surface.SetFont("ZMenuHeader")
  10704.  
  10705. local cashtext = string.format("Cash: $%s",ZARP.formatNumber(vaultent:GetNWInt("cash")))
  10706.  
  10707. local casestext = string.format("Cases: %s",ZARP.formatNumber(vaultent:GetNWInt("cases")))
  10708.  
  10709. local w,h = surface.GetTextSize(cashtext)
  10710.  
  10711. local cw,ch = surface.GetTextSize(casestext)
  10712.  
  10713. VaultLbl:SetText("")
  10714.  
  10715. VaultLbl:SetSize(cw + w, h)
  10716.  
  10717. VaultLbl.Paint = function(s)
  10718.  
  10719. local start = (s:GetWide() / 2) - ((w + cw) / 2)
  10720.  
  10721. draw.WordBox( 0, start, 0, cashtext, "ZMenuHeader", Color(0,204,0,50), color_white )
  10722.  
  10723. draw.WordBox( 0, start + w, 0, casestext, "ZMenuHeader", Color(102,140,255, 150,50), color_white )
  10724.  
  10725. end
  10726.  
  10727.  
  10728.  
  10729. VaultLbl:Dock( TOP )
  10730.  
  10731. VaultLbl:DockMargin( 8, 0, 0, 4 )
  10732.  
  10733. BankList:AddItem( VaultLbl )
  10734.  
  10735. end
  10736.  
  10737. end
  10738.  
  10739.  
  10740.  
  10741. BankList:Update()
  10742.  
  10743. return BackGround
  10744.  
  10745. end
  10746.  
  10747.  
  10748.  
  10749. function zm.BankTab()
  10750.  
  10751. local BackGround = vgui.Create("EditablePanel")
  10752.  
  10753. BackGround:MakePopup()
  10754.  
  10755. BackGround:SetSize(890,520)
  10756.  
  10757. BackGround.Paint = function(s,w,h)
  10758.  
  10759. //draw.RoundedBox(4,0,0,w,h,Color(66,161,255))
  10760.  
  10761. //draw.SimpleTextOutlined("ZARP BANK VAULT","ZMenuHeader",w*.5,l*.05,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  10762.  
  10763. end
  10764.  
  10765. BackGround.Think = function()
  10766.  
  10767. if input.IsKeyDown(zm.key) then zm.Close() end
  10768.  
  10769. end
  10770.  
  10771.  
  10772.  
  10773.  
  10774.  
  10775.  
  10776.  
  10777. local welcometext
  10778.  
  10779. local dayhour = os.date("*t",os.time()).hour
  10780.  
  10781.  
  10782.  
  10783. if dayhour >= 6 and dayhour <= 11 then welcometext = "Good morning, %s."
  10784.  
  10785. elseif dayhour >= 12 and dayhour <= 17 then welcometext = "Good afternoon, %s."
  10786.  
  10787. else welcometext = "Good evening, %s." end
  10788.  
  10789. welcometext = string.format(welcometext, LocalPlayer():Nick())
  10790.  
  10791.  
  10792.  
  10793. local BankPanel = vgui.Create("DPanel",BackGround)
  10794.  
  10795. BankPanel:SetSize(443,520)
  10796.  
  10797. BankPanel.Paint = function(s,w,h)
  10798.  
  10799. draw.RoundedBox(4,0,0,w,h,Color(204,0,0,100))
  10800.  
  10801. draw.SimpleTextOutlined("NATIONAL BANK","ZMenuHeader",w / 2,21,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  10802.  
  10803.  
  10804.  
  10805. //draw.SimpleTextOutlined(welcometext, "KonthHUD2", w / 2 , 55, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
  10806.  
  10807. end
  10808.  
  10809.  
  10810.  
  10811. //Account area panel
  10812.  
  10813. local BankLogo = Material("zarp/bank-logo.png","smooth noclamp")
  10814.  
  10815. local AccountPanel = vgui.Create("DPanel",BankPanel)
  10816.  
  10817. AccountPanel:SetPos(2,40)
  10818.  
  10819. AccountPanel:SetSize(439,150)
  10820.  
  10821. AccountPanel.Paint = function(s,w,h)
  10822.  
  10823. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
  10824.  
  10825. surface.SetDrawColor(255, 255, 255, 255)
  10826.  
  10827. surface.SetMaterial( BankLogo )
  10828.  
  10829. surface.DrawTexturedRect( 5, 17.5, 115, 115 )
  10830.  
  10831. end
  10832.  
  10833.  
  10834.  
  10835. local AccountDetailsPanel = vgui.Create("DPanel",AccountPanel)
  10836.  
  10837. AccountDetailsPanel:SetPos(123, 18)
  10838.  
  10839. AccountDetailsPanel:SetSize(AccountPanel:GetWide() - 126, 132)
  10840.  
  10841. AccountDetailsPanel.Paint = function(s,w,h)
  10842.  
  10843. draw.SimpleTextOutlined(welcometext, "Tre20", w / 2 , -3, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0,0,0,255))
  10844.  
  10845.  
  10846.  
  10847. draw.RoundedBox( 0, 15, 20, (w - 30), 24, LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")] and LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")].clr or Color(89,89,89) )
  10848.  
  10849. draw.SimpleTextOutlined(LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")] and LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")].type or "Standard Account", "Tre20", w / 2 , 22, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0,0,0,255))
  10850.  
  10851.  
  10852.  
  10853. draw.RoundedBox( 0, 15, 47, (w - 30), 30, Color(89,89,89,150) )
  10854.  
  10855. draw.SimpleTextOutlined(string.format("Balance: $%s",string.Comma(LocalPlayer().Bank["curcash"] or 0)), "Tre24", w / 2 , 50, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0,0,0,255))
  10856.  
  10857. draw.SimpleTextOutlined(string.format("Interest Rate: %s%% per year",LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")] and tostring(math.Round(LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")].interest,1)) or "0.0"), "Tre20", w / 2 , 78, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0,0,0,255))
  10858.  
  10859. draw.SimpleTextOutlined(string.format("Yearly Interest: $%s",LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")] and string.Comma(math.Round((LocalPlayer().Bank["curcash"] / 100) * LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")].interest)) or "0"), "Tre20", w / 2 , 95, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0,0,0,255))
  10860.  
  10861. end
  10862.  
  10863.  
  10864.  
  10865. local DepositPanel = vgui.Create("DPanel",BankPanel)
  10866.  
  10867. DepositPanel:SetPos(2,193)
  10868.  
  10869. DepositPanel:SetSize(439,40)
  10870.  
  10871. DepositPanel.Paint = function(s,w,h)
  10872.  
  10873. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
  10874.  
  10875. end
  10876.  
  10877.  
  10878.  
  10879. local DepositLbl = vgui.Create("DLabel",DepositPanel)
  10880.  
  10881. DepositLbl:SetPos(3, 9)
  10882.  
  10883. DepositLbl:SetFont("Tre22")
  10884.  
  10885. DepositLbl:SetColor(color_white)
  10886.  
  10887. DepositLbl:SetText("Deposit Funds ($):")
  10888.  
  10889. DepositLbl:SizeToContents()
  10890.  
  10891.  
  10892.  
  10893. local DepositAmount = vgui.Create("DNumberWang",DepositPanel)
  10894.  
  10895. DepositAmount:SetPos(160, 4)
  10896.  
  10897. DepositAmount:SetSize(140,32)
  10898.  
  10899. DepositAmount:SetFont("Tre22")
  10900.  
  10901. DepositAmount:SetText(1000)
  10902.  
  10903. DepositAmount:SetMinMax(1,LocalPlayer().DarkRPVars.money)
  10904.  
  10905.  
  10906.  
  10907. local DepositBtn = vgui.Create("DButton",DepositPanel)
  10908.  
  10909. DepositBtn:SetPos(303, 4)
  10910.  
  10911. DepositBtn:SetSize(100,32)
  10912.  
  10913. DepositBtn:SetText("")
  10914.  
  10915. DepositBtn.Paint = function(s,w,h)
  10916.  
  10917. surface.SetDrawColor(Color(179,0,0))
  10918.  
  10919. surface.DrawRect( 0,0,w,h )
  10920.  
  10921. if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
  10922.  
  10923. draw.SimpleTextOutlined("Deposit","Tre22",50,16,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  10924.  
  10925. if s:GetDisabled() then
  10926.  
  10927. surface.SetDrawColor(Color(100,100,100,240))
  10928.  
  10929. surface.DrawRect( 0,0,w,h )
  10930.  
  10931. end
  10932.  
  10933. end
  10934.  
  10935. DepositBtn.Think = function()
  10936.  
  10937. if (LocalPlayer().DarkRPVars.money < DepositAmount:GetValue()) then DepositBtn:SetDisabled(true) DepositBtn:SetToolTip("You can not afford that.")
  10938.  
  10939. else DepositBtn:SetDisabled(false) DepositBtn:SetToolTip(nil) end
  10940.  
  10941. end
  10942.  
  10943. DepositBtn.DoClick = function()
  10944.  
  10945. RunConsoleCommand("_bnk","money",-DepositAmount:GetValue())
  10946.  
  10947. end
  10948.  
  10949.  
  10950.  
  10951. local WithdrawPanel = vgui.Create("DPanel",BankPanel)
  10952.  
  10953. WithdrawPanel:SetPos(2,236)
  10954.  
  10955. WithdrawPanel:SetSize(439,40)
  10956.  
  10957. WithdrawPanel.Paint = function(s,w,h)
  10958.  
  10959. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
  10960.  
  10961. end
  10962.  
  10963.  
  10964.  
  10965. local WithdrawLbl = vgui.Create("DLabel",WithdrawPanel)
  10966.  
  10967. WithdrawLbl:SetPos(3, 9)
  10968.  
  10969. WithdrawLbl:SetFont("Tre22")
  10970.  
  10971. WithdrawLbl:SetColor(color_white)
  10972.  
  10973. WithdrawLbl:SetText("Withdraw Funds ($):")
  10974.  
  10975. WithdrawLbl:SizeToContents()
  10976.  
  10977.  
  10978.  
  10979. local WithdrawAmount = vgui.Create("DNumberWang",WithdrawPanel)
  10980.  
  10981. WithdrawAmount:SetPos(160, 4)
  10982.  
  10983. WithdrawAmount:SetSize(140,32)
  10984.  
  10985. WithdrawAmount:SetFont("Tre22")
  10986.  
  10987. WithdrawAmount:SetText(1000)
  10988.  
  10989. WithdrawAmount:SetMinMax(1,LocalPlayer().Bank["curcash"] or 0)
  10990.  
  10991.  
  10992.  
  10993. local WithdrawBtn = vgui.Create("DButton",WithdrawPanel)
  10994.  
  10995. WithdrawBtn:SetPos(303, 4)
  10996.  
  10997. WithdrawBtn:SetSize(100,32)
  10998.  
  10999. WithdrawBtn:SetText("")
  11000.  
  11001. WithdrawBtn.Paint = function(s,w,h)
  11002.  
  11003. surface.SetDrawColor(Color(179,0,0))
  11004.  
  11005. surface.DrawRect( 0,0,w,h )
  11006.  
  11007. if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
  11008.  
  11009. draw.SimpleTextOutlined("Withdraw","Tre22",50,16,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  11010.  
  11011. if s:GetDisabled() then
  11012.  
  11013. surface.SetDrawColor(Color(100,100,100,240))
  11014.  
  11015. surface.DrawRect( 0,0,w,h )
  11016.  
  11017. end
  11018.  
  11019. end
  11020.  
  11021. WithdrawBtn.Think = function()
  11022.  
  11023. if LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")] and ((tonumber(LocalPlayer():getDarkRPVar("NextWithdraw")) or 0) > ZARP.UTCTime() ) then WithdrawBtn:SetDisabled(true) WithdrawBtn:SetToolTip("You have already made a withdrawal or upgraded an account today.")
  11024.  
  11025. elseif ((LocalPlayer().Bank["curcash"] or 0) < WithdrawAmount:GetValue()) then WithdrawBtn:SetDisabled(true) WithdrawBtn:SetToolTip("Your available balance is not enough.")
  11026.  
  11027. else WithdrawBtn:SetDisabled(false) WithdrawBtn:SetToolTip(nil) end
  11028.  
  11029. end
  11030.  
  11031. WithdrawBtn.DoClick = function()
  11032.  
  11033. RunConsoleCommand("_bnk","money",WithdrawAmount:GetValue())
  11034.  
  11035. end
  11036.  
  11037.  
  11038.  
  11039. local upgradetext = markup.Parse("<font=Default>If you want to upgrade your account make sure your balance meets the minimum required amount. Select the type of account you want to upgrade to, add an additional deposit if needed and then click Upgrade Account.</font>",400)
  11040.  
  11041.  
  11042.  
  11043. local UpgradePanel = vgui.Create("DPanel",BankPanel)
  11044.  
  11045. UpgradePanel:SetPos(2,279)
  11046.  
  11047. UpgradePanel:SetSize(439,163)
  11048.  
  11049. UpgradePanel.Paint = function(s,w,h)
  11050.  
  11051. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
  11052.  
  11053. draw.SimpleTextOutlined("Upgrade Your Account", "KonthHUD2", w / 2 , 3, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0,0,0,255))
  11054.  
  11055. upgradetext:Draw(20, 25)
  11056.  
  11057. end
  11058.  
  11059.  
  11060.  
  11061. local BalanceLbl = vgui.Create("DLabel",UpgradePanel)
  11062.  
  11063. BalanceLbl:SetPos(3, 65)
  11064.  
  11065. BalanceLbl:SetFont("Tre22")
  11066.  
  11067. BalanceLbl:SetColor(color_white)
  11068.  
  11069. BalanceLbl.Think = function(s)
  11070.  
  11071. s:SetText(string.format("Current Balance: $%s",string.Comma(LocalPlayer().Bank["curcash"] or 0)))
  11072.  
  11073. s:SizeToContents()
  11074.  
  11075. end
  11076.  
  11077.  
  11078.  
  11079. local UpgradeLbl = vgui.Create("DLabel",UpgradePanel)
  11080.  
  11081. UpgradeLbl:SetPos(3, 95)
  11082.  
  11083. UpgradeLbl:SetFont("Tre22")
  11084.  
  11085. UpgradeLbl:SetColor(color_white)
  11086.  
  11087. UpgradeLbl:SetText("New Account:")
  11088.  
  11089. UpgradeLbl:SizeToContents()
  11090.  
  11091.  
  11092.  
  11093. local AccountsList = vgui.Create("DComboBox",UpgradePanel)
  11094.  
  11095. AccountsList:SetPos(120,91)
  11096.  
  11097. AccountsList:SetSize(315,32)
  11098.  
  11099. AccountsList:SetValue("Select One")
  11100.  
  11101. AccountsList:SetSortItems(false)
  11102.  
  11103. for k,v in pairs(LDRP_SH.TableToNumericalKeys(LDRP_SH.BankAccounts)) do
  11104.  
  11105. AccountsList:AddChoice(string.format("%s (min: $%s)",v.type,string.Comma(v.min)),v.name)
  11106.  
  11107. end
  11108.  
  11109.  
  11110.  
  11111. local AdditionalDepositLbl = vgui.Create("DLabel",UpgradePanel)
  11112.  
  11113. AdditionalDepositLbl:SetPos(3, 130)
  11114.  
  11115. AdditionalDepositLbl:SetFont("Tre22")
  11116.  
  11117. AdditionalDepositLbl:SetColor(color_white)
  11118.  
  11119. AdditionalDepositLbl:SetText("Deposit ($):")
  11120.  
  11121. AdditionalDepositLbl:SizeToContents()
  11122.  
  11123.  
  11124.  
  11125. local AdditionalDepositAmount = vgui.Create("DNumberWang",UpgradePanel)
  11126.  
  11127. AdditionalDepositAmount:SetPos(120, 126)
  11128.  
  11129. AdditionalDepositAmount:SetSize(140,32)
  11130.  
  11131. AdditionalDepositAmount:SetFont("Tre22")
  11132.  
  11133. AdditionalDepositAmount:SetText(1000)
  11134.  
  11135. AdditionalDepositAmount:SetMinMax(1000,LocalPlayer().DarkRPVars.money)
  11136.  
  11137. AdditionalDepositAmount:SetFont("Tre22")
  11138.  
  11139.  
  11140.  
  11141. local UpgradeBtn = vgui.Create("DButton",UpgradePanel)
  11142.  
  11143. UpgradeBtn:SetPos(123 + AdditionalDepositAmount:GetWide(), 126)
  11144.  
  11145. UpgradeBtn:SetSize(150,32)
  11146.  
  11147. UpgradeBtn:SetText("")
  11148.  
  11149. UpgradeBtn.Paint = function(s,w,h)
  11150.  
  11151. surface.SetDrawColor(Color(179,0,0))
  11152.  
  11153. surface.DrawRect( 0,0,w,h )
  11154.  
  11155. if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
  11156.  
  11157. draw.SimpleTextOutlined("Upgrade Account","Tre22",w / 2,16,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  11158.  
  11159. if s:GetDisabled() then
  11160.  
  11161. surface.SetDrawColor(Color(100,100,100,240))
  11162.  
  11163. surface.DrawRect( 0,0,w,h )
  11164.  
  11165. end
  11166.  
  11167. end
  11168.  
  11169. UpgradeBtn.Think = function()
  11170.  
  11171. local selected,id = AccountsList:GetSelected()
  11172.  
  11173.  
  11174.  
  11175. if not selected then UpgradeBtn:SetDisabled(true) UpgradeBtn:SetToolTip("You must select an account type.")
  11176.  
  11177. elseif ((LocalPlayer().Bank["curcash"] or 0) + LocalPlayer().DarkRPVars.money) < LDRP_SH.BankAccounts[id].min then UpgradeBtn:SetDisabled(true) UpgradeBtn:SetToolTip("You cannot afford this upgrade.")
  11178.  
  11179. elseif ((LocalPlayer().Bank["curcash"] or 0) + AdditionalDepositAmount:GetValue()) < LDRP_SH.BankAccounts[id].min then UpgradeBtn:SetDisabled(true) UpgradeBtn:SetToolTip(string.format("You must enter a higher deposit to reach $%s",string.Comma(LDRP_SH.BankAccounts[id].min)))
  11180.  
  11181. else UpgradeBtn:SetDisabled(false) UpgradeBtn:SetToolTip(nil) end
  11182.  
  11183. end
  11184.  
  11185. UpgradeBtn.DoClick = function()
  11186.  
  11187. local selected,id = AccountsList:GetSelected()
  11188.  
  11189. RunConsoleCommand("_bnk","upgrade",AdditionalDepositAmount:GetValue(),id)
  11190.  
  11191. AccountsList.selected = nil
  11192.  
  11193. AccountsList:SetValue("Select One")
  11194.  
  11195. end
  11196.  
  11197.  
  11198.  
  11199. local InterestPanel = vgui.Create("DPanel",BankPanel)
  11200.  
  11201. InterestPanel:SetPos(2,445)
  11202.  
  11203. InterestPanel:SetSize(439,40)
  11204.  
  11205. InterestPanel.Paint = function(s,w,h)
  11206.  
  11207. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
  11208.  
  11209. end
  11210.  
  11211.  
  11212.  
  11213. local InterestLbl = vgui.Create("DLabel",InterestPanel)
  11214.  
  11215. InterestLbl:SetPos(3, 9)
  11216.  
  11217. InterestLbl:SetFont("Tre22")
  11218.  
  11219. InterestLbl:SetColor(color_white)
  11220.  
  11221. InterestLbl:SetText("Daily Interest:")
  11222.  
  11223. InterestLbl:SizeToContents()
  11224.  
  11225.  
  11226.  
  11227. local InterestBtn = vgui.Create("DButton",InterestPanel)
  11228.  
  11229. InterestBtn:SetPos(145, 4)
  11230.  
  11231. InterestBtn:SetSize(AccountDetailsPanel:GetWide() - 30,32)
  11232.  
  11233. InterestBtn:SetText("")
  11234.  
  11235. InterestBtn.Paint = function(s,w,h)
  11236.  
  11237. surface.SetDrawColor(Color(179,0,0))
  11238.  
  11239. surface.DrawRect( 0,0,w,h )
  11240.  
  11241. if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
  11242.  
  11243.  
  11244.  
  11245. local dailyinterest = LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")] and math.Round((((LocalPlayer().Bank["curcash"] or 0) / 100) * LDRP_SH.BankAccounts[tonumber(LocalPlayer():getDarkRPVar("BankType"))].interest) / 365) or 0
  11246.  
  11247. draw.SimpleTextOutlined(string.format("Collect $%s interest",string.Comma(dailyinterest)),"Tre22",w / 2,16,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  11248.  
  11249. if s:GetDisabled() then
  11250.  
  11251. surface.SetDrawColor(Color(100,100,100,240))
  11252.  
  11253. surface.DrawRect( 0,0,w,h )
  11254.  
  11255. end
  11256.  
  11257. end
  11258.  
  11259. InterestBtn.Think = function()
  11260.  
  11261. local dailyinterest = LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")] and math.Round((((LocalPlayer().Bank["curcash"] or 0) / 100) * LDRP_SH.BankAccounts[LocalPlayer():getDarkRPVar("BankType")].interest) / 365) or 0
  11262.  
  11263.  
  11264.  
  11265. if (dailyinterest <= 0) then InterestBtn:SetDisabled(true) InterestBtn:SetToolTip("You have no interest to collect.")
  11266.  
  11267. elseif (LocalPlayer():getDarkRPVar("NextInterest") or 0) > ZARP.UTCTime() then InterestBtn:SetDisabled(true) InterestBtn:SetToolTip("You can collect your interest again tomorrow.")
  11268.  
  11269. else InterestBtn:SetDisabled(false) InterestBtn:SetToolTip(nil) end
  11270.  
  11271. end
  11272.  
  11273. InterestBtn.DoClick = function()
  11274.  
  11275. RunConsoleCommand("_bnk","interest",1)
  11276.  
  11277. end
  11278.  
  11279.  
  11280.  
  11281. local safetydeposittext = markup.Parse("<font=Default>You can use the bank safety deposit box as extra storage in addition to your inventory. To withdraw these items you will need talk to the Banker NPC. You can now deposit items directly from your inventory.</font>",417)
  11282.  
  11283.  
  11284.  
  11285. local SafetyDepositPanel = vgui.Create("DPanel",BackGround)
  11286.  
  11287. SafetyDepositPanel:SetPos(447,0)
  11288.  
  11289. SafetyDepositPanel:SetSize(443,520)
  11290.  
  11291. SafetyDepositPanel.Paint = function(s,w,h)
  11292.  
  11293. draw.RoundedBox(4,0,0,w,h,Color(66,161,255,100))
  11294.  
  11295. draw.SimpleTextOutlined("SAFETY DEPOSIT BOX","ZMenuHeader",w / 2,21,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
  11296.  
  11297. //safetydeposittext:Draw(15, 40)
  11298.  
  11299.  
  11300.  
  11301. //Bank weight
  11302.  
  11303. local BankWeight = 0
  11304.  
  11305. for k,v in pairs(LocalPlayer().Bank) do
  11306.  
  11307. if k == "curcash" then continue end
  11308.  
  11309. if v and v >= 1 then
  11310.  
  11311. BankWeight = BankWeight+(LDRP_SH.AllItems[k].weight*v)
  11312.  
  11313. end
  11314.  
  11315. end
  11316.  
  11317. draw.SimpleTextOutlined("Bank Weight: " .. BankWeight .. " out of " .. ZARP.CalculateMaxBankWeight(),"Trebuchet22",w/2,h - 25,Color(255,255,255,200),TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP, 2, Color(0,0,0,200) )
  11318.  
  11319. end
  11320.  
  11321.  
  11322.  
  11323. local WepNames = LDRP_SH.NicerWepNames
  11324.  
  11325. local BankItemsList = vgui.Create("DPanelList",SafetyDepositPanel)
  11326.  
  11327. BankItemsList:SetPos(3, 40)
  11328.  
  11329. BankItemsList:SetSize(437,447)
  11330.  
  11331. BankItemsList:SetPadding(10)
  11332.  
  11333. BankItemsList:SetSpacing(5)
  11334.  
  11335.  
  11336.  
  11337. BankItemsList:EnableVerticalScrollbar(true)
  11338.  
  11339. BankItemsList:EnableHorizontal(true)
  11340.  
  11341. BankItemsList.Paint = function(s)
  11342.  
  11343. local x, y = s:GetWide() - 1, s:GetTall() - 1
  11344.  
  11345. surface.SetDrawColor( 0, 0, 0, 255)
  11346.  
  11347. surface.DrawLine( 0, 0, x, 0 )
  11348.  
  11349. surface.DrawLine( 0, 0, 0, y )
  11350.  
  11351. surface.DrawLine( x, 0, x, y + 1 )
  11352.  
  11353. surface.DrawLine( 0, y, x, y )
  11354.  
  11355.  
  11356.  
  11357. draw.RoundedBox(0, 1, 1, s:GetWide() - 2, s:GetTall() - 2, Color(30, 30, 30, 200))
  11358.  
  11359. end
  11360.  
  11361.  
  11362.  
  11363. local CurIcons = {}
  11364.  
  11365.  
  11366.  
  11367. function BankItemsList:Think()
  11368.  
  11369. for k,v in pairs(LocalPlayer().Bank) do
  11370.  
  11371. if k == "curcash" then continue end
  11372.  
  11373.  
  11374.  
  11375. local Check = CurIcons[k]
  11376.  
  11377. if Check then
  11378.  
  11379. if Check.am != v or v <= 0 then
  11380.  
  11381. local ItemTbl = LDRP_SH.AllItems[k]
  11382.  
  11383. if !ItemTbl then continue end
  11384.  
  11385. if v <= 0 then
  11386.  
  11387. BankItemsList:RemoveItem(Check.vgui)
  11388.  
  11389. CurIcons[k] = nil
  11390.  
  11391. else
  11392.  
  11393. local Namez = WepNames[ItemTbl.nicename] or ItemTbl.nicename
  11394.  
  11395. Check.vgui:SetToolTip(Namez .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
  11396.  
  11397. CurIcons[k].am = v
  11398.  
  11399. end
  11400.  
  11401. end
  11402.  
  11403. elseif v > 0 then
  11404.  
  11405. local ItemTbl = LDRP_SH.AllItems[k]
  11406.  
  11407. if !ItemTbl then continue end
  11408.  
  11409. local ItemIcon = CreateIcon(BankItemsList,ItemTbl.mdl,79,79,function() ZARP.ShopItemOptions(k,"takeout","Take Out") end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,k)
  11410.  
  11411. CurIcons[k] = {["vgui"] = ItemIcon,["am"] = v}
  11412.  
  11413. local Namez = WepNames[ItemTbl.nicename] or ItemTbl.nicename
  11414.  
  11415. ItemIcon:SetToolTip(Namez .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
  11416.  
  11417.  
  11418.  
  11419. BankItemsList:AddItem(ItemIcon)
  11420.  
  11421. end
  11422.  
  11423. end
  11424.  
  11425. end
  11426.  
  11427.  
  11428.  
  11429. return BackGround
  11430.  
  11431. end
  11432.  
  11433.  
  11434.  
  11435. local NiceNames = LDRP_SH.NicerWepNames
  11436.  
  11437. function zm.CraftingTab()
  11438.  
  11439. local CraftingList = vgui.Create("DPanelList")
  11440.  
  11441. CraftingList:EnableVerticalScrollbar(true)
  11442.  
  11443. CraftingList:SetPadding(4)
  11444.  
  11445. CraftingList:SetSpacing(4)
  11446.  
  11447.  
  11448.  
  11449. local IcoSize = 64
  11450.  
  11451. local RW,RH = 900,70
  11452.  
  11453. local Selected
  11454.  
  11455. for k,v in pairs(LDRP_SH.TableToNumericalKeys(LDRP_SH.CraftItems)) do
  11456.  
  11457. local Recipe = vgui.Create("DPanel")
  11458.  
  11459. Recipe:SetSize(RW,RH)
  11460.  
  11461.  
  11462.  
  11463. local Str
  11464.  
  11465. local num = 0
  11466.  
  11467. for c,b in pairs(v.recipe) do
  11468.  
  11469.  
  11470.  
  11471. num = num+1
  11472.  
  11473. if Str then
  11474.  
  11475. Str = Str .. ", " .. b .. " " .. (NiceNames[c] or c)
  11476.  
  11477. else
  11478.  
  11479. Str = b .. " " .. (NiceNames[c] or c)
  11480.  
  11481. end
  11482.  
  11483. end
  11484.  
  11485.  
  11486.  
  11487. Recipe.Paint = function(s)
  11488.  
  11489. draw.RoundedBox( 0, 0, 0, Recipe:GetWide() , RH, v.specialcolor or Color(150, 150, 150, 100))
  11490.  
  11491. draw.RoundedBox( 0, 0, 0, Recipe:GetWide() , RH, (Selected == v.name and Color(140, 140, 140, 180)) or Hovered == k and Color(80, 80, 80, 180) or Color(30, 30, 30, 180) )
  11492.  
  11493. draw.SimpleTextOutlined( v.name .. " (lvl " .. v.lvl .. ")", "Trebuchet24", 10+(IcoSize), RH*.5, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, 2, Color(0,0,0,255) )
  11494.  
  11495. draw.SimpleTextOutlined( "Resources needed: " .. Str, "Trebuchet22", 283+(IcoSize), RH*.5, Color(255,255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, 2, Color(0,0,0,255) )
  11496.  
  11497.  
  11498.  
  11499. local x, y = s:GetWide() - 1, s:GetTall() - 1
  11500.  
  11501. surface.SetDrawColor( 0, 0, 0, 255)
  11502.  
  11503. surface.DrawLine( 0, 0, x, 0 )
  11504.  
  11505. surface.DrawLine( 0, 0, 0, y )
  11506.  
  11507. surface.DrawLine( x, 0, x, y + 1 )
  11508.  
  11509. surface.DrawLine( 0, y, x, y )
  11510.  
  11511.  
  11512.  
  11513. if v.specialcolor then
  11514.  
  11515. draw.WordBox( 6, s:GetWide() - 110, 15, "LIMITED TIME", "Bebas24Font", Color(51,102,255), color_white )
  11516.  
  11517. end
  11518.  
  11519.  
  11520.  
  11521. end
  11522.  
  11523. local Icon
  11524.  
  11525. if v.icon then
  11526.  
  11527. Icon = vgui.Create("SpawnIcon",Recipe)
  11528.  
  11529. Icon:SetModel(v.icon)
  11530.  
  11531. else
  11532.  
  11533. Icon = vgui.Create("DImageButton",Recipe)
  11534.  
  11535. Icon:SetImage(v.imageicon)
  11536.  
  11537. end
  11538.  
  11539. Icon:SetPos(4,4)
  11540.  
  11541. Icon:SetSize(IcoSize, IcoSize)
  11542.  
  11543. Icon.OnCursorEntered = function() return false end
  11544.  
  11545. Icon:SetToolTip()
  11546.  
  11547. Icon.OnMousePressed = function() return false end
  11548.  
  11549.  
  11550.  
  11551. local InvisButton = vgui.Create("DButton",Recipe)
  11552.  
  11553. InvisButton:SetSize(RW,RH)
  11554.  
  11555. InvisButton:SetDrawBackground(false)
  11556.  
  11557. InvisButton.DoClick = function()
  11558.  
  11559. local least
  11560.  
  11561. if LocalPlayer().Inventory then
  11562.  
  11563. for k,v in pairs(v.recipe) do
  11564.  
  11565. local cancraft = (LocalPlayer().Inventory[k] or 0) / v
  11566.  
  11567. if not least then least = cancraft end
  11568.  
  11569. if cancraft < least then least = cancraft end
  11570.  
  11571. end
  11572.  
  11573. end
  11574.  
  11575. Selected = v.name
  11576.  
  11577. local CraftMenu = DermaMenu(InvisButton)
  11578.  
  11579. CraftMenu:AddOption( "Craft 1", function() RunConsoleCommand("__crft",Selected) end )
  11580.  
  11581. if least >= 5 then CraftMenu:AddOption( "Craft 5", function() RunConsoleCommand("__crft",Selected,5) end) end
  11582.  
  11583. if least >= 10 then CraftMenu:AddOption( "Craft 10", function() RunConsoleCommand("__crft",Selected,10) end) end
  11584.  
  11585. if least >= 25 then CraftMenu:AddOption( "Craft 25", function() RunConsoleCommand("__crft",Selected,25) end) end
  11586.  
  11587. if least >= 50 then CraftMenu:AddOption( "Craft 50", function() RunConsoleCommand("__crft",Selected,50) end) end
  11588.  
  11589. CraftMenu:AddOption( "Cancel", function() end )
  11590.  
  11591. CraftMenu:Open()
  11592.  
  11593. end
  11594.  
  11595. InvisButton.OnCursorEntered = function()
  11596.  
  11597. Hovered = v.name
  11598.  
  11599. end
  11600.  
  11601. InvisButton.OnCursorExited = function()
  11602.  
  11603. Hovered = nil
  11604.  
  11605. end
  11606.  
  11607. InvisButton:SetText("")
  11608.  
  11609. CraftingList:AddItem(Recipe)
  11610.  
  11611. end
  11612.  
  11613.  
  11614.  
  11615. return CraftingList
  11616.  
  11617. end
  11618.  
  11619.  
  11620.  
  11621. -- Category configuration
  11622.  
  11623. zm.categories =
  11624.  
  11625. {
  11626.  
  11627.  
  11628.  
  11629. {
  11630.  
  11631. title = "ACTIONS",
  11632.  
  11633. color = Color( 30, 30, 30, 250 ),
  11634.  
  11635. icon = "icon16/star.png",
  11636.  
  11637. func = zm.Actions
  11638.  
  11639. },
  11640.  
  11641.  
  11642.  
  11643. {
  11644.  
  11645. title = "JOBS",
  11646.  
  11647. color = Color( 30, 30, 30, 250 ),
  11648.  
  11649. icon = "icon16/user_suit.png",
  11650.  
  11651. func = zm.Jobs
  11652.  
  11653. },
  11654.  
  11655.  
  11656.  
  11657. {
  11658.  
  11659. title = "SHOP",
  11660.  
  11661. color = Color( 30, 30, 30, 250 ),
  11662.  
  11663. icon = "icon16/cart.png",
  11664.  
  11665. func = zm.Shop
  11666.  
  11667. },
  11668.  
  11669.  
  11670.  
  11671. {
  11672.  
  11673. title = "SKILLS",
  11674.  
  11675. color = Color( 30, 30, 30, 250 ),
  11676.  
  11677. icon = "icon16/chart_bar.png",
  11678.  
  11679. func = zm.SkillsTab
  11680.  
  11681. },
  11682.  
  11683.  
  11684.  
  11685. {
  11686.  
  11687. title = "Crafting",
  11688.  
  11689. color = Color( 30, 30, 30, 250 ),
  11690.  
  11691. icon = "icon16/bricks.png",
  11692.  
  11693. func = zm.CraftingTab
  11694.  
  11695. },
  11696.  
  11697.  
  11698.  
  11699. {
  11700.  
  11701. title = "Gangs",
  11702.  
  11703. color = Color( 30, 30, 30, 250 ),
  11704.  
  11705. icon = "icon16/user_gray.png",
  11706.  
  11707. func = zm.GangsTab
  11708.  
  11709. },
  11710.  
  11711.  
  11712.  
  11713. {
  11714.  
  11715. title = "Inventory",
  11716.  
  11717. color = Color( 30, 30, 30, 250 ),
  11718.  
  11719. icon = "icon16/box.png",
  11720.  
  11721. func = zm.InventoryTab,
  11722.  
  11723. inventory = true
  11724.  
  11725. },
  11726.  
  11727.  
  11728.  
  11729.  
  11730.  
  11731. {
  11732.  
  11733. title = "DONATE",
  11734.  
  11735. color = Color( 30, 30, 30, 250 ),
  11736.  
  11737. icon = "icon16/award_star_silver_2.png",
  11738.  
  11739. func = zm.PremiumTab
  11740.  
  11741. }
  11742.  
  11743. }
  11744.  
  11745.  
  11746.  
  11747. concommand.Add( "+zarp_rpmenu", zm.Open )
  11748.  
  11749. concommand.Add( "-zarp_rpmenu", zm.Close )
Add Comment
Please, Sign In to add comment