Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------------------------------
- local zm = {}
- -- General configuration
- zm.key = KEY_F4
- zm.logo = Material("zarp/zarplogo.png","noclamp smooth")
- zm.font_cat = "Bebas24Font"
- -- Main frame metrics
- zm.w = 900
- zm.h = 600 + 30
- zm.logo_h = 60 + 40
- zm.frame_size = 20
- zm.content_padding = 5
- zm.content_w = zm.w - 10
- zm.content_h = zm.h - zm.logo_h - 10
- -- Colors
- zm.color_frame = Color( 51,51,51,200 )
- zm.color_frame_outline = Color( 51,51,51,200 )
- zm.color_bg = Color( 30, 30, 30, 250 )
- zm.color_logo_bg = Color( 30, 30, 30, 200 )
- zm.color_cat_text = Color( 200, 200, 200, 255 )
- zm.color_cat_text_hover = Color( 255, 255, 255, 255 )
- zm.color_cat = Color( 55, 100, 5,200 )
- zm.color_cat_active = zm.color_bg
- -- Category button metrics
- zm.cat_offset = 240
- zm.cat_padding = 18
- zm.cat_w = 140
- zm.cat_h = 45
- zm.open = false
- zm.ctl = {}
- zm.tabs = false
- --[[
- DRAW (BACKGROUND)
- --]]
- function zm.Draw()
- if not zm.IsOpen() then return end
- local sw, sh = ScrW(), ScrH()
- local x = sw / 2 - zm.w / 2
- local y = sh / 2 - zm.h / 2
- 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 )
- surface.SetDrawColor( zm.color_frame_outline )
- 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 )
- --draw.RoundedBox( 10, x, y + zm.logo_h, zm.w, zm.h - zm.logo_h, zm.color_bg )
- --draw.RoundedBox( 4, x + 12, y - 45, 25, 100, Color( 200, 255, 200, 255 ) )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( zm.logo )
- surface.DrawTexturedRect( x + 6, y+10, 250, 79 )
- end
- hook.Add( "HUDPaint", "DrawZARPMenu", zm.Draw )
- --[[
- OPEN / CLOSE
- --]]
- function zm.Open(tab)
- if LocalPlayer():IsInEvent() then return end
- ZARP.SetNewItemLogSuppressed(false)
- if ZFrame and IsValid(ZFrame) then ZFrame.Close() end
- zm.open = true
- gui.EnableScreenClicker( true )
- local sw, sh = ScrW(), ScrH()
- local x = sw / 2 - zm.w / 2
- local y = sh / 2 - zm.h / 2
- if not zm.mposx then zm.mposx, zm.mposy = gui.MousePos() end
- --gui.SetMousePos( zm.mposx, zm.mposy )
- local cx = x + zm.cat_offset
- local cy = y
- zm.ctl.bgpanel = zm.ctl.bgpanel or vgui.Create( "DPanel" )
- zm.ctl.bgpanel:SetPos( x, y + zm.logo_h)
- zm.ctl.bgpanel:SetSize( zm.w, zm.h - zm.logo_h )
- zm.ctl.bgpanel:SetVisible( true )
- function zm.ctl.bgpanel:Paint()
- draw.RoundedBox( 10, 0, 0, zm.w, zm.h - zm.logo_h, zm.color_bg )
- end
- -- Make category tabs
- for i = 1, #zm.categories do
- zm.ctl[ "cat_btn_" .. i ] = zm.ctl[ "cat_btn_" .. i ] or vgui.Create( "DButton", self )
- local cat = zm.categories[ i ]
- local btn = zm.ctl[ "cat_btn_" .. i ]
- btn:SetText( cat.title )
- DLabel.SetFont( btn, zm.font_cat )
- if zm.active == btn then
- btn:SetSize( zm.cat_w, zm.cat_h )
- if i > 4 then
- btn:SetPos( btn.cx + 34 - zm.cat_w * 2 - 176 * 2, btn.cy + 15 + 40 - zm.cat_h - 5)
- else
- btn:SetPos( btn.cx + 34, btn.cy + 15 + 40 )
- end
- btn:SetTextColor( zm.color_cat_text_hover )
- else
- btn:SetSize( zm.cat_w, zm.cat_h - 5 )
- if i > 4 then
- btn:SetPos( cx + 34 - zm.cat_w * 2 - 176 * 2, cy + 20 + 40 - zm.cat_h - 5)
- else
- btn:SetPos( cx + 34, cy + 20 + 40 )
- end
- btn:SetTextColor( zm.color_cat_text )
- end
- btn:SetVisible( true )
- btn:SetImage( cat.icon )
- DLabel.SetExpensiveShadow( btn, 2, Color( 0,0,0,255 ) )
- btn.cat = i
- btn.cx = cx
- btn.cy = cy
- function btn:Paint()
- local w, h = btn:GetWide(), btn:GetTall()
- local col
- if zm.active == btn then
- col = zm.color_cat_active
- else
- col = zm.color_cat
- end
- if i > 4 then
- draw.RoundedBox( 6, 0, 0, w, h, col)
- else
- draw.RoundedBoxEx( 6, 0, 0, w, h, col, true, true, false, false )
- end
- end
- if cat.inventory then
- function btn:PaintOver(w,h)
- if ZARP.GetNumberNewItemsInLog() >= 1 then
- surface.SetFont("Bebas24Font")
- local str = string.format("%i NEW",ZARP.GetNumberNewItemsInLog())
- local tw,th = surface.GetTextSize(str)
- draw.WordBox( 6, w - (tw + 14), 2, str, "Bebas24Font", Color(255,51,51), color_white )
- end
- end
- end
- function btn:DoClick()
- if zm.hiddentab then zm.hiddentab:Remove() end
- if zm.categories[ self.cat ].specialfunc then
- zm.categories[ self.cat ].specialfunc()
- return
- end
- if zm.active then
- zm.active:MakeInactive()
- end
- zm.active = btn
- btn:SetTall( zm.cat_h )
- if i > 4 then
- btn:SetPos( btn.cx + 34 - zm.cat_w * 2 - 176 * 2, btn.cy + 15 + 40 - zm.cat_h - 5)
- else
- btn:SetPos( btn.cx + 34, btn.cy + 15 + 40 )
- end
- if zm.tabs and isfunction(zm.tabs[ zm.active.cat ]) then
- zm.tabs[ zm.active.cat ] = zm.tabs[ zm.active.cat ]()
- zm.tabs[ zm.active.cat ]:SetPos( x + 5, y + zm.logo_h + 5 )
- zm.tabs[ zm.active.cat ]:SetSize( zm.content_w, zm.content_h )
- elseif zm.tabs then
- zm.tabs[ zm.active.cat ]:SetVisible(true)
- end
- end
- function btn:MakeInactive()
- btn:SetTextColor( zm.color_cat_text )
- btn:SetTall( zm.cat_h - 5 )
- if i > 4 then
- btn:SetPos( btn.cx + 34 - zm.cat_w * 2 - 176 * 2, btn.cy + 20 + 40 - zm.cat_h - 5)
- else
- btn:SetPos( btn.cx + 34, btn.cy + 20 + 40 )
- end
- if zm.tabs then
- if ispanel(zm.tabs[ zm.active.cat ]) then zm.tabs[ zm.active.cat ]:SetVisible( false ) end
- end
- end
- function btn:OnCursorEntered()
- btn:SetTextColor( zm.color_cat_text_hover )
- end
- function btn:OnCursorExited()
- if zm.active ~= btn then
- btn:SetTextColor( zm.color_cat_text )
- end
- end
- function btn:PerformLayout()
- if ( IsValid( self.m_Image ) ) then
- self.m_Image:SetPos( 15, (self:GetTall() - self.m_Image:GetTall()) * 0.5 )
- self:SetTextInset( -10, 0 )
- end
- DLabel.PerformLayout( self )
- end
- cx = cx + zm.cat_w + zm.cat_padding
- if not zm.active and i == 1 then btn:DoClick()
- elseif tab and i == tab then btn:DoClick() end
- end
- -- Fill category tabs
- if not zm.tabs then
- zm.tabs = {}
- for k, v in pairs( zm.categories ) do
- if v.func then
- zm.tabs[ k ] = v.func
- //zm.tabs[ k ]:SetVisible( false )
- //zm.tabs[ k ]:SetPos( x + 5, y + zm.logo_h + 5 )
- //zm.tabs[ k ]:SetSize( zm.content_w, zm.content_h )
- end
- end
- else
- for k, v in pairs( zm.tabs ) do
- if ispanel(v) and v.Update then v:Update() end
- end
- end
- if zm.active and zm.active.cat then
- if ispanel(zm.tabs[ zm.active.cat ]) then
- zm.tabs[ zm.active.cat ]:SetVisible( true )
- else
- zm.tabs[ zm.active.cat ] = zm.tabs[ zm.active.cat ]()
- zm.tabs[ zm.active.cat ]:SetPos( x + 5, y + zm.logo_h + 5 )
- zm.tabs[ zm.active.cat ]:SetSize( zm.content_w, zm.content_h )
- end
- end
- end
- function zm.OpenHiddenTab(tab)
- if not tab then return end
- for k, v in pairs( zm.categories ) do
- if ispanel(zm.tabs[ k ]) then zm.tabs[ k ]:SetVisible( false ) end
- end
- if zm.hiddentab then zm.hiddentab:Remove() end
- local sw, sh = ScrW(), ScrH()
- local x = sw / 2 - zm.w / 2
- local y = sh / 2 - zm.h / 2
- zm.hiddentab = tab
- zm.hiddentab:SetVisible( true )
- zm.hiddentab:SetPos( x + 5, y + zm.logo_h + 5 )
- zm.hiddentab:SetSize( zm.content_w, zm.content_h )
- end
- local AdventCalendarLoop = AdventCalendarLoop or false
- function zm.Close()
- zm.open = false
- zm.mposx, zm.mposy = gui.MousePos()
- gui.EnableScreenClicker( false )
- if zm.ctl then
- for k, v in pairs( zm.ctl ) do
- v:SetVisible( false )
- end
- end
- if zm.tabs then
- for k, v in pairs( zm.tabs ) do
- if ispanel(v) then v:SetVisible( false ) end
- end
- if zm.hiddentab then zm.hiddentab:Remove() end
- end
- ZARP.SetNewItemLogSuppressed(false)
- //Remove after christmas event
- if IsValid(AdventCalendarLoop) then AdventCalendarLoop:Stop() AdventCalendarLoop = nil end
- end
- function zm.IsOpen()
- return zm.open
- end
- function zm.PlayerBindPress(ply, bind, down)
- if (bind=="gm_showspare2") and down then
- if zm.IsOpen() then zm.Close()
- else zm.Open() end
- return true
- end
- end
- hook.Add( "PlayerBindPress", "ZARPMenu_PlayerBindPress", zm.PlayerBindPress )
- function ZARP.OpenMenu(tab, vaulttab, banktab)
- zm.Open(tab)
- if vaulttab then zm.OpenHiddenTab(zm.VaultTab())
- elseif banktab then zm.OpenHiddenTab(zm.BankTab())
- end
- end
- local RankData =
- {
- ["vip"] = { "vip-iconzarp.png", Color( 150, 150, 170, 255 ) },
- ["moderator"] = { "icon16/award_star_gold_3.png", Color( 200, 100, 0, 255 ) },
- ["admin"] = { "icon16/shield.png", Color( 200, 0, 0, 255 ) },
- ["superadmin"] = { "icon16/shield_add.png", Color( 200, 0, 0, 255 ) },
- ["headadmin"] = { "icon16/star.png", Color( 4, 6, 167, 255 ) },
- ["Developer"] = { "icon16/award_star_bronze_1.png" , Color( 0, 175, 175, 200 ) },
- ["Co-Owner"] = { "icon16/asterisk_orange.png" , Color( 0, 175, 175, 200 ) },
- ["Owner"] = { "icon16/asterisk_yellow.png", Color( 0, 175, 175, 200 ) }
- }
- local function MakeSign( rankname, parent )
- local rank = RankData[ rankname ]
- local icon = vgui.Create( "DImage", parent )
- icon:SetImage( rank[1] )
- icon:SetPos( 64 -8, 64 -8 )
- icon:SetMouseInputEnabled( false )
- if rank == "vip" then
- icon:SetSize( 20, 20 )
- else
- icon:SetSize( 16, 16 )
- end
- return icon
- end
- --[[
- ACTIONS TAB
- --]]
- CreateClientConVar("rp_playermodel", "", true, true)
- local _actpanel
- local function MakeNiceButton(auto, text,clr,txtclr)
- local btn = vgui.Create("DButton")
- btn.bgcol = clr or Color( 200, 200, 200, 255 )
- function btn:Paint()
- if not self.drawcol then self.drawcol = self.bgcol end
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.drawcol )
- end
- if text then
- btn.PaintOver = function(s,w,h)
- draw.WordBox( 6, s:GetWide() - 45, 2, text, "Bebas24Font", Color(255,51,51), color_white )
- end
- end
- function btn:OnCursorEntered()
- self.hover = true
- self.drawcol = Color( self.bgcol.r + 25, self.bgcol.g + 25, self.bgcol.b + 25, self.bgcol.a )
- end
- function btn:OnCursorExited()
- self.hover = false
- self.drawcol = self.bgcol
- end
- function btn:OnMouseWheeled(d)
- _actpanel:OnMouseWheeled(d)
- end
- if auto then
- btn:DockMargin(5,0,5,5)
- btn:SetTall(40)
- end
- if txtclr then btn:SetTextColor(txtclr) end
- return btn
- end
- local function MakeCategoryNice( cat, color )
- cat.bgcol = color or Color( 150, 150, 150, 255 )
- function cat:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.bgcol )
- end
- cat.Header:SetFont( "Tre20" )
- cat.Header:SetColor( Color( 255, 255, 255, 255 ) )
- function cat:OnMouseWheeled(d)
- _actpanel:OnMouseWheeled(d)
- end
- function cat.Header:OnMouseWheeled(d)
- _actpanel:OnMouseWheeled(d)
- end
- end
- local function MayorOptns()
- local MayCat = vgui.Create("DCollapsibleCategory")
- MakeCategoryNice( MayCat )
- MayCat:SetLabel("Mayor Actions")
- MayCat.bgcol = team.GetColor(LocalPlayer():Team())
- local maypanel = vgui.Create("DPanelList")
- maypanel:SetSize(470, 200)
- maypanel:SetAutoSize(true)
- maypanel:SetSpacing(5)
- maypanel:SetPadding(5)
- maypanel:EnableHorizontal(true)
- maypanel:EnableVerticalScrollbar(false)
- local buttonw, buttonh = 207, 40
- local SearchWarrant = MakeNiceButton()
- SearchWarrant:SetText(LANGUAGE.GetPhrase("request_warrant"))
- SearchWarrant.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if not ply.DarkRPVars.warrant then
- menu:AddOption(ply:Nick(), function()
- Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil,
- function(a)
- LocalPlayer():ConCommand("say /warrant ".. tostring(ply:UserID()).." ".. a)
- end, function() end ) end)
- end
- end
- menu:Open()
- end
- SearchWarrant:SetSize( buttonw, buttonh )
- maypanel:AddItem( SearchWarrant )
- local Warrant = MakeNiceButton()
- Warrant:SetText(LANGUAGE.GetPhrase("make_wanted"))
- Warrant.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if not ply.DarkRPVars.wanted then
- menu:AddOption(ply:Nick(), function() Derma_StringRequest("wanted", "Why would you make "..ply:Nick().." wanted?", nil,
- function(a)
- LocalPlayer():ConCommand("say /wanted ".. tostring(ply:UserID()).." ".. a)
- end, function() end ) end)
- end
- end
- menu:Open()
- end
- Warrant:SetSize( buttonw, buttonh )
- maypanel:AddItem( Warrant )
- local UnWarrant = MakeNiceButton()
- UnWarrant:SetText(LANGUAGE.GetPhrase("make_unwanted"))
- UnWarrant.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if ply.DarkRPVars.wanted then
- menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("say /unwanted " .. tostring(ply:UserID())) end)
- end
- end
- menu:Open()
- end
- UnWarrant:SetSize( buttonw, buttonh )
- maypanel:AddItem( UnWarrant )
- local Lockdown = MakeNiceButton()
- Lockdown:SetText(LANGUAGE.GetPhrase("initiate_lockdown"))
- Lockdown.DoClick = function()
- LocalPlayer():ConCommand("say /lockdown")
- end
- Lockdown:SetSize( buttonw, buttonh )
- maypanel:AddItem( Lockdown )
- local UnLockdown = MakeNiceButton()
- UnLockdown:SetText(LANGUAGE.GetPhrase("stop_lockdown"))
- UnLockdown.DoClick = function()
- LocalPlayer():ConCommand("say /unlockdown")
- end
- UnLockdown:SetSize( buttonw, buttonh )
- maypanel:AddItem( UnLockdown )
- local Lottery = MakeNiceButton()
- Lottery:SetText(LANGUAGE.GetPhrase("start_lottery"))
- Lottery.DoClick = function()
- Derma_StringRequest("Lottery",string.format("Enter the lottery ticket price: ($%s-%s)",GAMEMODE.Config.minlotterycost,GAMEMODE.Config.maxlotterycost),tostring(GAMEMODE.Config.maxlotterycost),function(val)
- LocalPlayer():ConCommand("say /lottery "..val)
- end)
- end
- Lottery:SetSize( buttonw, buttonh )
- maypanel:AddItem( Lottery )
- local GiveLicense = MakeNiceButton()
- GiveLicense:SetText(LANGUAGE.GetPhrase("give_license_lookingat"))
- GiveLicense.DoClick = function()
- LocalPlayer():ConCommand("say /givelicense")
- end
- GiveLicense:SetSize( buttonw, buttonh )
- maypanel:AddItem( GiveLicense )
- local PlaceLaws = MakeNiceButton()
- PlaceLaws:SetText("Place a screen containing the laws.")
- PlaceLaws.DoClick = function()
- LocalPlayer():ConCommand("say /placelaws")
- end
- PlaceLaws:SetSize( buttonw, buttonh )
- maypanel:AddItem( PlaceLaws )
- local AddLaws = MakeNiceButton()
- AddLaws:SetText("Add a law.")
- AddLaws.DoClick = function()
- Derma_StringRequest("Add a law", "Type the law you would like to add here.", "", function(law)
- LocalPlayer():ConCommand("say /addlaw " .. law)
- end)
- end
- AddLaws:SetSize( buttonw, buttonh )
- maypanel:AddItem( AddLaws )
- local RemLaws = MakeNiceButton()
- RemLaws:SetText("Remove a law.")
- RemLaws.DoClick = function()
- Derma_StringRequest("Remove a law", "Enter the number of the law you would like to remove here.", "", function(num)
- LocalPlayer():ConCommand("say /removelaw " .. num)
- end)
- end
- RemLaws:SetSize( buttonw, buttonh )
- maypanel:AddItem( RemLaws )
- local OpenBail = MakeNiceButton()
- OpenBail:SetText("Open/Close Bail")
- OpenBail.DoClick = function()
- local menu = DermaMenu()
- menu:AddOption("Open Bail", function() LocalPlayer():ConCommand("say /bailsettings open 1") end)
- menu:AddOption("Close Bail", function() LocalPlayer():ConCommand("say /bailsettings open 0") end)
- menu:Open()
- end
- OpenBail:SetSize( buttonw, buttonh )
- maypanel:AddItem( OpenBail )
- local PayCops = MakeNiceButton()
- PayCops:SetText("Bail Payment")
- PayCops.DoClick = function()
- local menu = DermaMenu()
- menu:AddOption("Pay CP for Bail's", function() LocalPlayer():ConCommand("say /bailsettings pay 1") end)
- menu:AddOption("Do Not Pay CP for Bail's", function() LocalPlayer():ConCommand("say /bailsettings pay 0") end)
- menu:Open()
- end
- PayCops:SetSize( buttonw, buttonh )
- maypanel:AddItem( PayCops )
- local RequireBail = MakeNiceButton()
- RequireBail:SetText("Bail Requirement")
- RequireBail.DoClick = function()
- local menu = DermaMenu()
- menu:AddOption("Require Approval For Bail", function() LocalPlayer():ConCommand("say /bailsettings required 1") end)
- menu:AddOption("Do Not Require Approval For Bail", function() LocalPlayer():ConCommand("say /bailsettings required 0") end)
- menu:Open()
- end
- RequireBail:SetSize( buttonw, buttonh )
- maypanel:AddItem( RequireBail )
- MayCat:SetContents(maypanel)
- return MayCat
- end
- local function CPOptns()
- local CPCat = vgui.Create("DCollapsibleCategory")
- MakeCategoryNice( CPCat )
- CPCat.bgcol = team.GetColor(LocalPlayer():Team())
- CPCat:SetLabel("Law Enforcement Actions")
- local CPPanel = vgui.Create("DPanelList")
- CPPanel:SetSize(470, 200)
- CPPanel:SetAutoSize(true)
- CPPanel:SetSpacing(5)
- CPPanel:SetPadding(5)
- CPPanel:EnableHorizontal(true)
- CPPanel:EnableVerticalScrollbar(false)
- local buttonw, buttonh = 207, 40
- local SearchWarrant = MakeNiceButton()
- SearchWarrant:SetText(LANGUAGE.GetPhrase("request_warrant"))
- SearchWarrant.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if not ply.DarkRPVars.warrant then
- menu:AddOption(ply:Nick(), function()
- Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil,
- function(a)
- LocalPlayer():ConCommand("say /warrant ".. tostring(ply:UserID()).." ".. a)
- end, function() end ) end)
- end
- end
- menu:Open()
- end
- SearchWarrant:SetSize( buttonw, buttonh )
- CPPanel:AddItem( SearchWarrant )
- local Warrant = MakeNiceButton()
- Warrant:SetText(LANGUAGE.GetPhrase("searchwarrantbutton"))
- Warrant.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if not ply.DarkRPVars.wanted then
- menu:AddOption(ply:Nick(), function() Derma_StringRequest("wanted", "Why would you make "..ply:Nick().." wanted?", nil,
- function(a)
- if not IsValid(ply) then return end
- LocalPlayer():ConCommand("say /wanted ".. tostring(ply:UserID()).." ".. a)
- end, function() end ) end)
- end
- end
- menu:Open()
- end
- Warrant:SetSize( buttonw, buttonh )
- CPPanel:AddItem( Warrant )
- local UnWarrant = MakeNiceButton()
- UnWarrant:SetText(LANGUAGE.GetPhrase("unwarrantbutton"))
- UnWarrant.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if ply.DarkRPVars.wanted then
- menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("say /unwanted " .. tostring(ply:UserID())) end)
- end
- end
- menu:Open()
- end
- UnWarrant:SetSize( buttonw, buttonh )
- CPPanel:AddItem( UnWarrant )
- if LocalPlayer():Team() == TEAM_CHIEF or LocalPlayer():Team() == TEAM_PRISONGUARD or LocalPlayer():IsAdmin() then
- local SetJailPos = MakeNiceButton()
- SetJailPos:SetText(LANGUAGE.GetPhrase("set_jailpos"))
- SetJailPos.DoClick = function() LocalPlayer():ConCommand("say /jailpos") end
- SetJailPos:SetSize( buttonw, buttonh )
- CPPanel:AddItem( SetJailPos )
- local AddJailPos = MakeNiceButton()
- AddJailPos:SetText(LANGUAGE.GetPhrase("add_jailpos"))
- AddJailPos.DoClick = function() LocalPlayer():ConCommand("say /addjailpos") end
- AddJailPos:SetSize( buttonw, buttonh )
- CPPanel:AddItem( AddJailPos )
- end
- local ismayor -- Firstly look if there's a mayor
- local ischief -- Then if there's a chief
- for k,v in pairs(player.GetAll()) do
- if v:Team() == TEAM_MAYOR then
- ismayor = true
- break
- end
- end
- if not ismayor then
- for k,v in pairs(player.GetAll()) do
- if v:Team() == TEAM_CHIEF then
- ischief = true
- break
- end
- end
- end
- local Team = LocalPlayer():Team()
- if not ismayor and (Team == TEAM_CHIEF or (not ischief and Team == TEAM_POLICE)) then
- local GiveLicense = MakeNiceButton()
- GiveLicense:SetText(LANGUAGE.GetPhrase("give_license_lookingat"))
- GiveLicense.DoClick = function()
- LocalPlayer():ConCommand("say /givelicense")
- end
- GiveLicense:SetSize( buttonw, buttonh )
- CPPanel:AddItem( GiveLicense )
- end
- CPCat:SetContents(CPPanel)
- return CPCat
- end
- local function MobOptns()
- local MobCat = vgui.Create("DCollapsibleCategory")
- MakeCategoryNice( MobCat )
- MobCat.bgcol = team.GetColor(LocalPlayer():Team())
- MobCat:SetLabel("Mobboss options")
- local Mobpanel = vgui.Create("DPanelList")
- Mobpanel:SetSize(470, 200)
- Mobpanel:SetAutoSize(true)
- Mobpanel:SetSpacing(5)
- Mobpanel:SetPadding(5)
- Mobpanel:EnableHorizontal(true)
- Mobpanel:EnableVerticalScrollbar(false)
- local buttonw, buttonh = 207, 40
- local AgendaButton = MakeNiceButton()
- AgendaButton:SetText( "Set the Agenda" )
- AgendaButton.DoClick = function()
- Derma_StringRequest("Set Agenda", "New Agenda:", "", function(a) LocalPlayer():ConCommand("say /agenda " .. tostring(a)) end)
- end
- AgendaButton:SetSize( buttonw, buttonh )
- AgendaButton:SetImage( "icon16/vcard_edit.png" )
- Mobpanel:AddItem( AgendaButton )
- MobCat:SetContents(Mobpanel)
- return MobCat
- end
- local function HitOpts()
- local HitsCat = vgui.Create("DCollapsibleCategory")
- MakeCategoryNice( HitsCat )
- HitsCat.bgcol = team.GetColor(LocalPlayer():Team())
- HitsCat:SetLabel("Hit List")
- local panel = vgui.Create("DPanelList")
- panel:SetSize(470, 200)
- panel:SetAutoSize(true)
- panel:SetSpacing(5)
- panel:SetPadding(5)
- panel:EnableHorizontal(true)
- panel:EnableVerticalScrollbar(false)
- local buttonw, buttonh = 207, 40
- local HitListBtn = MakeNiceButton()
- HitListBtn:SetText( "View the current hits" )
- HitListBtn.DoClick = function()
- zm.OpenHiddenTab(zm.HitListTab())
- end
- HitListBtn:SetSize( buttonw, buttonh )
- HitListBtn:SetImage( "icon16/gun.png" )
- panel:AddItem( HitListBtn )
- HitsCat:SetContents(panel)
- return HitsCat
- end
- function zm.Actions()
- local mainframe = vgui.Create( "DPanel" )
- mainframe:SetSize( zm.content_w, zm.content_h )
- function mainframe:Paint() end
- local actionframe = vgui.Create( "DPanel", mainframe )
- actionframe:SetSize( zm.content_w / 2, zm.content_h )
- function actionframe:Paint() end
- local actionpanel = vgui.Create("DPanelList",actionframe)
- actionpanel:SetKeyboardInputEnabled(true)
- actionpanel:SetSpacing( 5 )
- actionpanel:SetPadding( 5 )
- actionpanel:SetSize( zm.content_w / 2 + 5, zm.content_h )
- --actionpanel:SetAutoSize( true )
- _actpanel = actionpanel
- actionpanel:EnableVerticalScrollbar( true )
- function actionpanel:Update()
- self:Clear(true)
- local MoneyCat = vgui.Create("DCollapsibleCategory")
- MakeCategoryNice( MoneyCat )
- MoneyCat.bgcol = Color( 112, 158, 63, 255 )
- MoneyCat:SetLabel("General")
- local MoneyPanel = vgui.Create("DPanelList")
- MoneyPanel:SetSize(470, 200)
- MoneyPanel:SetAutoSize(true)
- MoneyPanel:SetSpacing(5)
- MoneyPanel:SetPadding(5)
- MoneyPanel:EnableHorizontal(true)
- MoneyPanel:EnableVerticalScrollbar(false)
- local buttonw, buttonh = 207, 40
- local TradeBtn = MakeNiceButton()
- TradeBtn:SetText( "Send a trade request." )
- TradeBtn.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if ply ~= LocalPlayer() then
- menu:AddOption(ply:Nick(), function()
- RunConsoleCommand("__trd","start",ply:UserID())
- end)
- end
- end
- menu:Open()
- end
- TradeBtn:SetSize( buttonw, buttonh )
- TradeBtn:SetImage( "icon16/arrow_switch.png" )
- MoneyPanel:AddItem( TradeBtn )
- local SpawnMoneyButton = MakeNiceButton()
- SpawnMoneyButton:SetText(LANGUAGE.GetPhrase("drop_money"))
- SpawnMoneyButton.DoClick = function()
- Derma_StringRequest("Amount of money", "How much money do you want to drop?", "", function(a) LocalPlayer():ConCommand("say /dropmoney " .. tostring(a)) end)
- end
- SpawnMoneyButton:SetSize( buttonw, buttonh )
- SpawnMoneyButton:SetImage( "icon16/money.png" )
- MoneyPanel:AddItem( SpawnMoneyButton )
- if not LocalPlayer():IsStaff() then
- local CallAdmin = MakeNiceButton()
- CallAdmin:SetText( "Admin Request")
- CallAdmin.DoClick = function() HCallAdmin.Call() end
- CallAdmin:SetSize( buttonw, buttonh )
- CallAdmin:SetImage( "icon16/shield_add.png" )
- MoneyPanel:AddItem( CallAdmin )
- end
- local DropButton = MakeNiceButton()
- DropButton:SetText( "Drop/Holster current weapon" )
- DropButton.DoClick = function()
- local menu = DermaMenu()
- menu:AddOption("Drop", function() RunConsoleCommand("say","/drop") end)
- menu:AddOption("Holster", function() RunConsoleCommand("say","/holster") end)
- menu:Open()
- end
- DropButton:SetSize( buttonw, buttonh )
- DropButton:SetImage( "icon16/gun.png" )
- MoneyPanel:AddItem( DropButton )
- local PlaceHitButton = MakeNiceButton()
- PlaceHitButton:SetText( "Place a hit on someone" )
- PlaceHitButton.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if ply ~= LocalPlayer() then
- menu:AddOption(ply:Nick(), function()
- 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)
- end)
- end
- end
- menu:Open()
- end
- PlaceHitButton:SetSize( buttonw, buttonh )
- PlaceHitButton:SetImage( "icon16/bomb.png" )
- MoneyPanel:AddItem( PlaceHitButton )
- --[[local CallPolice = MakeNiceButton()
- CallPolice:SetText( "Call the police" )
- CallPolice.DoClick = function()
- Derma_StringRequest("Reason", "Why do you want to call the police and where are you?", "", function(a) LocalPlayer():ConCommand("say /911 " .. tostring(a)) end)
- end
- CallPolice:SetSize( buttonw, buttonh )
- CallPolice:SetImage( "icon16/phone.png" )
- MoneyPanel:AddItem( CallPolice )]]
- MoneyCat:SetContents(MoneyPanel)
- local Commands = vgui.Create("DCollapsibleCategory")
- MakeCategoryNice( Commands )
- Commands:SetLabel("Roleplay Options")
- local ActionsPanel = vgui.Create("DPanelList")
- ActionsPanel:SetSize(470, 200)
- ActionsPanel:SetAutoSize(true)
- ActionsPanel:SetSpacing(5)
- ActionsPanel:SetPadding(5)
- ActionsPanel:EnableHorizontal(true)
- ActionsPanel:EnableVerticalScrollbar(false)
- local buttonw, buttonh = 207, 40
- local NameButton = MakeNiceButton()
- NameButton:SetText( "Change your RP Name" )
- NameButton.DoClick = function()
- Derma_StringRequest("Change RP Name", "New RP Name:", "", function(a) LocalPlayer():ConCommand("say /rpname " .. tostring(a)) end)
- end
- NameButton:SetSize( buttonw, buttonh )
- NameButton:SetImage( "icon16/vcard_edit.png" )
- ActionsPanel:AddItem( NameButton )
- local JobButton = MakeNiceButton()
- JobButton:SetText( "Change your job title" )
- JobButton.DoClick = function()
- Derma_StringRequest("Change RP Name", "New Job Title:", "", function(a) LocalPlayer():ConCommand("say /job " .. tostring(a)) end)
- end
- JobButton:SetSize( buttonw, buttonh )
- JobButton:SetImage( "icon16/vcard_edit.png" )
- ActionsPanel:AddItem( JobButton )
- local Demote = MakeNiceButton()
- Demote:SetText(LANGUAGE.GetPhrase("demote_player_menu"))
- Demote.DoClick = function()
- local menu = DermaMenu()
- for _,ply in pairs(NickSortedPlayers()) do
- if ply ~= LocalPlayer() then
- menu:AddOption(ply:Nick(), function()
- Derma_StringRequest("Demote reason", "Why would you demote "..ply:Nick().."?", nil,
- function(a)
- LocalPlayer():ConCommand("say /demote ".. tostring(ply:UserID()).." ".. a)
- end, function() end )
- end)
- end
- end
- menu:Open()
- end
- Demote:SetSize( buttonw, buttonh )
- Demote:SetImage( "icon16/user_delete.png" )
- ActionsPanel:AddItem( Demote )
- local UnOwnAllDoors = MakeNiceButton()
- UnOwnAllDoors:SetText("Sell all of your doors")
- UnOwnAllDoors.DoClick = function() LocalPlayer():ConCommand("say /unownalldoors") end
- UnOwnAllDoors:SetSize( buttonw, buttonh )
- UnOwnAllDoors:SetImage( "icon16/table_delete.png" )
- ActionsPanel:AddItem( UnOwnAllDoors )
- Commands:SetContents(ActionsPanel)
- //Blueprints category
- local BlueprintsCat = vgui.Create("DCollapsibleCategory")
- MakeCategoryNice( BlueprintsCat )
- BlueprintsCat.bgcol = Color( 102,140,255 )
- BlueprintsCat:SetLabel("Blueprints and Upgrades")
- local ActionsPanel = vgui.Create("DPanelList")
- ActionsPanel:SetSize(470, 200)
- ActionsPanel:SetAutoSize(true)
- ActionsPanel:SetSpacing(5)
- ActionsPanel:SetPadding(5)
- ActionsPanel:EnableHorizontal(true)
- ActionsPanel:EnableVerticalScrollbar(false)
- local buttonw, buttonh = 207, 40
- local ViewBtn = MakeNiceButton(false)
- ViewBtn:SetText( "View My Blueprints" )
- ViewBtn.DoClick = function()
- zm.OpenHiddenTab(zm.BlueprintsTab())
- end
- ViewBtn:SetSize( buttonw, buttonh )
- ViewBtn:SetImage( "zarp/blueprint32.png" )
- ActionsPanel:AddItem( ViewBtn )
- local OtherBtn = MakeNiceButton()
- OtherBtn:SetText( "Check Bank Vault Status" )
- OtherBtn.DoClick = function()
- zm.OpenHiddenTab(zm.VaultTab())
- end
- OtherBtn:SetSize( buttonw, buttonh )
- OtherBtn:SetImage( "zarp/vault32.png" )
- ActionsPanel:AddItem( OtherBtn )
- local UpgradesBtn = MakeNiceButton(false)
- UpgradesBtn:SetText("Character Upgrades")
- UpgradesBtn.DoClick = function()
- zm.OpenHiddenTab(zm.UpgradesTab())
- end
- UpgradesBtn:SetSize( buttonw, buttonh )
- UpgradesBtn:SetImage( "zarp/zarp-characterupgradesicon.png" )
- ActionsPanel:AddItem( UpgradesBtn )
- local ObjectivesBtn = MakeNiceButton(false)
- ObjectivesBtn:SetText("Daily Objectives")
- ObjectivesBtn.DoClick = function()
- zm.OpenHiddenTab(zm.DailyObjectivesTab())
- end
- ObjectivesBtn:SetSize( buttonw, buttonh )
- ObjectivesBtn:SetImage( "zarp/zarp-dailyobjectives.png" )
- ActionsPanel:AddItem( ObjectivesBtn )
- local BankBtn = MakeNiceButton(false)
- BankBtn:SetText("National Bank")
- BankBtn.DoClick = function()
- zm.OpenHiddenTab(zm.BankTab())
- end
- BankBtn:SetSize( buttonw, buttonh )
- BankBtn:SetImage( "zarp/bank-logo32.png" )
- ActionsPanel:AddItem( BankBtn )
- -- local WheelBtn = MakeNiceButton(false,nil,Color(38,38,38),color_white)
- -- WheelBtn:SetText("Black Friday Wheel")
- -- WheelBtn.DoClick = function()
- -- zm.OpenHiddenTab(zm.WheelOfZARPTab())
- -- end
- -- WheelBtn:SetSize( buttonw, buttonh )
- -- WheelBtn:SetImage( "zarp/zarp-blackfridaywheelicon.png" )
- -- ActionsPanel:AddItem( WheelBtn )
- local AdventBtn = MakeNiceButton(false,"NEW",Color(255,51,51),color_white)
- AdventBtn:SetText( "ZARP Advent Calendar" )
- AdventBtn.DoClick = function()
- zm.OpenHiddenTab(zm.ZARPAdventCalendarTab())
- end
- AdventBtn:SetSize( buttonw, buttonh )
- AdventBtn:SetImage( "zarp/zarp-adventcalendaricon.png" )
- ActionsPanel:AddItem( AdventBtn )
- BlueprintsCat:SetContents(ActionsPanel)
- //Market category
- local MarketCat = vgui.Create("DCollapsibleCategory")
- MakeCategoryNice( MarketCat )
- MarketCat.bgcol = Color(255, 75, 15, 200)
- MarketCat:SetLabel("Shops and Events")
- local ActionsPanel = vgui.Create("DPanelList")
- ActionsPanel:SetSize(470, 200)
- ActionsPanel:SetAutoSize(true)
- ActionsPanel:SetSpacing(5)
- ActionsPanel:SetPadding(5)
- ActionsPanel:EnableHorizontal(true)
- ActionsPanel:EnableVerticalScrollbar(false)
- MarketCat:SetContents(ActionsPanel)
- local ViewBtn = MakeNiceButton()
- ViewBtn:SetText( "View All Shops" )
- ViewBtn.DoClick = function()
- zm.OpenHiddenTab(zm.ShopListTab())
- end
- ViewBtn:SetSize( buttonw, buttonh )
- ViewBtn:SetImage( "zarp/zarp-shopslisticon.png" )
- ActionsPanel:AddItem( ViewBtn )
- local AuctionHouseBtn = MakeNiceButton()
- AuctionHouseBtn:SetText( "Auction House" )
- AuctionHouseBtn.DoClick = function()
- zm.OpenHiddenTab(zm.AuctionHouseTab())
- end
- AuctionHouseBtn:SetSize( buttonw, buttonh )
- AuctionHouseBtn:SetImage( "zarp/zarp-auctionhouseicon.png" )
- ActionsPanel:AddItem( AuctionHouseBtn )
- actionpanel:AddItem(MoneyCat)
- actionpanel:AddItem(BlueprintsCat)
- actionpanel:AddItem(MarketCat)
- actionpanel:AddItem(Commands)
- if LocalPlayer():Team() == TEAM_MAYOR then
- actionpanel:AddItem(MayorOptns())
- elseif LocalPlayer():Team() == TEAM_CITIZEN then
- --actionpanel:AddItem(CitOptns())
- elseif LocalPlayer():IsCP() then
- actionpanel:AddItem(CPOptns())
- elseif LocalPlayer():Team() == TEAM_MOB then
- actionpanel:AddItem(MobOptns())
- elseif LocalPlayer():Team() == TEAM_HITMAN then
- actionpanel:AddItem(HitOpts())
- end
- end
- actionpanel:Update()
- function actionframe:Update() actionpanel:Update() end
- local infoframe = vgui.Create( "DPanel", mainframe )
- infoframe:SetSize( zm.content_w / 2 - 5, zm.content_h )
- infoframe:SetPos( zm.content_w / 2 + 5, 5 )
- function infoframe:Paint() end
- local namepart = vgui.Create( "DPanel", infoframe )
- namepart:SetSize( zm.content_w / 2 - 5, 60 )
- namepart.bgcol = Color( 0,0,0,0 )
- function namepart:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), namepart.bgcol )
- end
- local namelabel = vgui.Create( "DLabel", namepart )
- namelabel:SetFont( "HUDNumber4" )
- namelabel:SetPos( 5, 5 )
- namelabel:SetTextColor( Color( 255, 255, 255, 255 ) )
- local joblabel = vgui.Create( "DLabel", namepart )
- joblabel:SetFont( "Tre24" )
- joblabel:SetPos( 6.5, 30 )
- joblabel:SetTextColor( Color( 255, 255, 255, 255 ) )
- local jobsinfod = vgui.Create("DPanel", infoframe )
- jobsinfod:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
- jobsinfod:SetSize( zm.content_w / 2 - 5, 150 )
- jobsinfod:SetPos( 0, 65 )
- local jobsinfodesc = vgui.Create("DTextEntry", jobsinfod)
- --jobsinfot:SetFont( "Tre24" )
- --jobsinfot:SetTextColor( Color( 255, 255, 255, 255 ) )
- jobsinfodesc:SetPos( 1, 5 )
- jobsinfodesc:SetText( "" )
- jobsinfodesc:SetSize( zm.content_w / 2 - 75, 150 )
- jobsinfodesc:SetFont( "JobDesc" )
- --function jobsinfodesc:Paint() end
- jobsinfodesc:AllowInput( false )
- jobsinfodesc:SetMultiline( true )
- jobsinfodesc:SetDrawBackground( false )
- jobsinfodesc:SetDrawBorder( false )
- jobsinfodesc:SetMouseInputEnabled( false )
- if jobmodel and jobmodel:IsValid() then
- jobmodel:Remove()
- end
- jobmodel = vgui.Create("DModelPanel", jobsinfod )
- jobmodel:SetModel("")
- jobmodel:SetSize(75,280)
- jobmodel:SetAnimated(false)
- jobmodel:SetFOV(30)
- jobmodel:SetAnimSpeed(2)
- jobmodel:SetPos( zm.content_w / 2 - 65, -75 )
- function jobmodel:LayoutEntity()
- self:RunAnimation()
- end
- local function UpdateInfo( job )
- if not job then
- jobsinfod:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
- jobsinfodesc:SetText("")
- jobsinfodesc:SetVisible( false )
- jobmodel:SetModel("")
- return
- end
- joblabel:SetText( job.name )
- joblabel:SizeToContents()
- local desc = job.description
- local model = LocalPlayer():GetModel()
- jobsinfod:SetBackgroundColor( Color( 200, 200, 200, 255 ) )
- jobsinfodesc:SetText( desc )
- jobsinfodesc:SetVisible( true )
- namepart.bgcol = Color( job.color.r / 2, job.color.g / 2, job.color.b / 2, 255 )
- jobmodel:SetModel( model )
- jobmodel:RunAnimation()
- end
- UpdateInfo( nil )
- //ZARP Events Action panel
- local ZARPEvents = vgui.Create( "DPanel", infoframe )
- ZARPEvents:SetSize( zm.content_w / 2 - 5, 105 )
- ZARPEvents:SetPos( 0, 150 + 70 )
- local NoEvent
- if !ZARP.CurrentEvent or !ZARP.CurrentEvent.EventStartsAt then NoEvent = true end
- function ZARPEvents:Paint(w,h)
- draw.RoundedBox( 4, 0, 0, w, h, Color(51,51,51,200) )
- draw.DrawText("Next ZARP Event", "Tre24", 5, 5, color_white )
- if NoEvent then
- draw.DrawText("There is no scheduled event on this server.", "Tre22", 5, 30, color_white )
- else
- //Start progress bar
- surface.SetDrawColor(Color(255,255,255,100))
- surface.DrawRect( 74, 55, w - 79, 5 )
- //Progress
- local timeremaining = (ZARP.CurrentEvent.EventStartsAt - CurTime())
- local pxtotime = (w - 79) / (60*ZARP.EventCooldownTime)
- surface.SetDrawColor(Color(255,255,255,100))
- surface.DrawRect( 74, 55, math.Clamp((w - 79) - (pxtotime * timeremaining),0,w - 79), 5 )
- //Event icon
- surface.SetMaterial(ZARP.CurrentEvent.Icon)
- surface.SetDrawColor(color_white)
- surface.DrawTexturedRect(5,35,64,64)
- //Event subtitle
- draw.DrawText(string.format("%s event on %s",ZARP.CurrentEvent.Name,ZARP.CurrentEvent.EventArena[1]), "Tre20", 74, 35, color_white )
- //Time until
- local timestr = string.FormattedTime(math.Clamp(timeremaining,0,ZARP.CurrentEvent.EventStartsAt),"%02i:%02i")
- surface.SetFont("Tre24")
- local w,h = surface.GetTextSize((timeremaining > 0) and timestr or "In progress...")
- draw.DrawText( (timeremaining > 0) and timestr or "In progress...", "Tre24", 74, 65, color_white )
- if (timeremaining > 0) then
- //Cash prize
- surface.SetMaterial(ZARP.EventCashIcon)
- surface.SetDrawColor(color_white)
- surface.DrawTexturedRect( 79 + w,65, 22,22 )
- surface.SetFont("Tre22")
- local nw,nh = surface.GetTextSize("+$"..string.Comma(ZARP.CurrentEvent.CashPrize))
- draw.DrawText("+$"..string.Comma(ZARP.CurrentEvent.CashPrize), "Tre22", 103 + w, 65, color_white )
- //Item prize
- if ZARP.CurrentEvent.ItemPrize then
- surface.SetMaterial(ZARP.EventItemIcon)
- surface.SetDrawColor(color_white)
- surface.DrawTexturedRect( (108 + w) + nw,65, 22,22 )
- local itemname = LDRP_SH.NicerWepNames[ZARP.CurrentEvent.ItemPrize] or LDRP_SH.AllItems[ZARP.CurrentEvent.ItemPrize].nicename or ZARP.CurrentEvent.ItemPrize
- draw.DrawText("+"..itemname, "Tre22", (132 + w) + nw, 65, color_white )
- end
- end
- end
- end
- //Weapons info
- local weaponpart = vgui.Create( "DPanel", infoframe )
- weaponpart:SetSize( zm.content_w / 2 - 5, 190 )
- weaponpart.bgcol = Color( 150,150,150,255 )
- weaponpart:SetPos( 0, 260 + 70 )
- function weaponpart:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), weaponpart.bgcol )
- end
- local weaponlabel = vgui.Create( "DLabel", weaponpart )
- weaponlabel:SetFont( "Tre24" )
- weaponlabel:SetPos( 5, 5 )
- weaponlabel:SetTextColor( Color( 255, 255, 255, 255 ) )
- weaponlabel:SetText( "Weapons" )
- weaponlabel:SizeToContents()
- local weaponlist = vgui.Create( "DPanelList", weaponpart )
- weaponlist:SetSize( zm.content_w / 2 - 10, 145 )
- weaponlist:SetPos( 5, 35 )
- --weaponlist:SetAutoSize( true )
- weaponlist:EnableHorizontal( true )
- weaponlist:EnableVerticalScrollbar( true )
- weaponlist:SetPadding( 0 )
- weaponlist:SetSpacing( 5 )
- local blacklist = { "weapon_physcannon",
- "gmod_camera",
- "gmod_tool",
- "weapon_keypadchecker",
- "weapon_physgun",
- "keys"}
- local oldcount = 0
- local function UpdateWeaponInfo(force)
- local weps = LocalPlayer():GetWeapons()
- if not force then
- local c = table.Count( weps )
- if c == oldcount then return end
- oldcount = c
- end
- weaponlist:Clear()
- for k, v in pairs( weps ) do
- if not table.HasValue( blacklist, v:GetClass() ) then
- local pan = vgui.Create( "DButton" )
- pan:SetSize( 140, 40 )
- pan.drawcol = Color( 200, 200, 200, 255 )
- function pan:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.drawcol )
- end
- pan:SetMouseInputEnabled( true )
- pan:SetText( "" )
- function pan:OnCursorEntered()
- self.hover = true
- self.drawcol = Color( 225, 225, 225, 255 )
- end
- function pan:OnCursorExited()
- self.hover = false
- self.drawcol = Color( 200, 200, 200, 255 )
- end
- local cl = v:GetClass()
- pan.DoClick = function()
- local menu = DermaMenu()
- menu:AddOption("Equip", function() RunConsoleCommand( "use", cl ) end)
- menu:AddOption("Drop", function() RunConsoleCommand( "use", cl ) RunConsoleCommand( "say", "/drop" ) end)
- local ammo = ""
- local t = v:GetPrimaryAmmoType()
- if t == 7 then
- ammo = "shotgun ammo"
- elseif t == 3 then
- ammo = "pistol ammo"
- elseif t == 4 then
- ammo = "rifle ammo"
- end
- if ammo ~= "" then
- menu:AddOption("Buy Ammunition", function() RunConsoleCommand( "say", "/buyammo " .. ammo ) end)
- end
- menu:Open()
- end
- local icon = vgui.Create("SpawnIcon",pan)
- icon:InvalidateLayout( true )
- icon:SetSize(32, 32)
- icon:SetToolTip( desc )
- icon:SetPos( 4, -2 )
- icon:SetModel( v:GetModel() )
- icon:SetTooltip( v:GetPrintName() )
- icon:SetMouseInputEnabled( false )
- local label = vgui.Create("DLabel", pan)
- label:SetText( v:GetPrintName() )
- label:SizeToContents()
- label:SetPos( 35, 0 )
- label:CenterVertical()
- label:SetTextColor( Color(0,0,0,255))
- label:SetMouseInputEnabled( false )
- weaponlist:AddItem(pan)
- end
- end
- end
- function infoframe:Update()
- namelabel:SetText( LocalPlayer():Nick() )
- namelabel:SizeToContents()
- UpdateInfo( RPExtraTeams[ LocalPlayer():Team() ] )
- UpdateWeaponInfo(true)
- end
- timer.Create( "UpdateWeapons", 0.25, -1, function() if zm.IsOpen() then UpdateWeaponInfo() end end )
- function mainframe:Update() actionframe:Update() infoframe:Update() end
- mainframe:Update()
- return mainframe
- end
- //Gangs Tab
- function zm.GangsTab()
- //Top bar
- local PlayerHasGang = LocalPlayer().DarkRPVars.gang_name and not (LocalPlayer().DarkRPVars.gang_name == "") and true or false
- local catcolor = ZARP.GangInfo and ZARP.GangInfo.Color or team.GetColor(TEAM_GANG)
- local BackGround = vgui.Create("DPanel")
- local msg
- //BackGround:SetSize(890,45)
- BackGround.Paint = function(s,w,h)
- 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
- end
- local TopBarLayout = vgui.Create( "DIconLayout", BackGround )
- TopBarLayout:SetSize(890,45)
- TopBarLayout.Paint = function(s,w,h)
- draw.RoundedBox( 4, 0, 0, w, h, Color( 55, 100, 5,200 ))
- end
- //TopBarLayout:SetSpaceY(2)
- TopBarLayout:SetSpaceX(-2)
- local function AddGangInfoIcon(pnl, text, icon, steamid, textcolor)
- local infopanel = pnl:Add("DPanel")
- infopanel:SetDrawBackground(false)
- if icon then
- local img = vgui.Create("DImage", infopanel)
- img:SetImage(icon)
- img:SetSize(20,20)
- img:SetPos(2,2)
- elseif steamid then
- local ownerid = util.SteamIDTo64( steamid )
- local avatar = vgui.Create("AvatarImage",infopanel)
- local btn = vgui.Create("DButton",avatar)
- btn.DoClick = function()
- gui.OpenURL(string.format("http://steamcommunity.com/profiles/%s",ownerid))
- end
- btn:SetSize(20,20)
- btn:SetDrawBorder( false )
- btn:SetDrawBackground( false )
- btn:SetKeyboardInputEnabled( false )
- btn:SetText( "" )
- avatar:SetPos(2,2)
- avatar:SetSize(20,20)
- avatar:SetSteamID(ownerid, 32)
- end
- local lbl = vgui.Create("DLabel",infopanel)
- lbl:SetFont("Tre22")
- if textcolor then lbl:SetColor(textcolor) end
- lbl:SetPos((icon or steamid) and 25 or 2,0)
- lbl:SetText(text)
- lbl:SizeToContents()
- infopanel:SetSize(25 + lbl:GetWide(), 24)
- end
- local GangTabs = {}
- local function ChangeGangTab(tab)
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- msg = nil
- BackGround.CurrentTab = GangTabs[tab].func()
- for k,v in pairs(GangTabs) do
- v.button.IsSelected = false
- end
- GangTabs[tab].button.IsSelected = true
- end
- local function OpenGangDialog()
- //Gang dialog
- local fcol = Color( 30, 30, 30 )
- if PlayerHasGang then fcol = catcolor end
- local NewGangModal = vgui.Create("DFrame")
- NewGangModal:SetSize(450, 360)
- NewGangModal:Center()
- NewGangModal:SetVisible( true )
- NewGangModal:MakePopup( )
- NewGangModal:DoModal( )
- NewGangModal:SetSkin("DarkRP")
- if PlayerHasGang then
- NewGangModal:SetTitle("Edit gang settings for " .. LocalPlayer().DarkRPVars.gang_name)
- else
- NewGangModal:SetTitle("Create New Gang")
- end
- NewGangModal.Paint = function()
- draw.RoundedBox( 8, 0, 0, NewGangModal:GetWide(), NewGangModal:GetTall(), fcol )
- end
- local GPanel = vgui.Create( "DListLayout", NewGangModal)
- GPanel:SetSize(440, 350)
- GPanel:SetPos(5, 25)
- local namelbl = GPanel:Add("DLabel")
- namelbl:SetText("Name your new DarkRP Gang:")
- local nametxt = GPanel:Add("DTextEntry")
- if PlayerHasGang then nametxt:SetText(LocalPlayer().DarkRPVars.gang_name)
- else nametxt:SetText(LocalPlayer():Nick() .. "s Gang")
- end
- local feelbl = GPanel:Add("DLabel")
- feelbl:SetText("Choose Join Fee $(New members will pay this fee to you).")
- local fee = GPanel:Add("DNumberWang")
- fee:SetDecimals(0)
- fee:SetMinMax(0,100000)
- fee:SetWidth(50)
- if PlayerHasGang then fee:SetValue(ZARP.GangInfo.Fee or 0) end
- local collbl = GPanel:Add("DLabel")
- collbl:SetText("Choose your gang color.")
- local colorsel = GPanel:Add("DColorPalette")
- colorsel:SetButtonSize( 20 )
- colorsel.DoClick = function( panel, color, x, y )
- fcol = color
- end
- if PlayerHasGang then colorsel:SetColor(catcolor) end
- local finish = GPanel:Add("DButton")
- if PlayerHasGang then
- finish:SetText("Edit gang settings.")
- else
- finish:SetText(string.format("Create this gang ($%s)",string.Comma(GAMEMODE.Config.gangcost or 0)))
- end
- finish.DoClick = function()
- local namestr = string.Replace( nametxt:GetValue(), "*", "")
- local cmdstr = namestr.."*"..tostring(fee:GetValue()).."*".. fcol.r.."*"..fcol.g.."*"..fcol.b
- if PlayerHasGang then
- LocalPlayer():ConCommand("say /editgang "..tostring(cmdstr))
- else
- LocalPlayer():ConCommand("say /newgang "..tostring(cmdstr))
- end
- NewGangModal:Close()
- ChangeGangTab(1)
- end
- end
- //Tab buttons
- local MyGangBtn = vgui.Create("DButton", TopBarLayout)
- MyGangBtn:SetText("")
- MyGangBtn:SetSize(200,45)
- MyGangBtn.Paint = function(s,w,h)
- draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
- if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
- surface.SetFont("Trebuchet24")
- local tw,th = surface.GetTextSize("My Gang")
- 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) )
- end
- MyGangBtn.DoClick = function() ChangeGangTab(1) end
- local CreateGangBtn = vgui.Create("DButton", TopBarLayout)
- CreateGangBtn:SetText("")
- CreateGangBtn:SetSize(200,45)
- CreateGangBtn.Paint = function(s,w,h)
- draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
- if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
- surface.SetFont("Trebuchet24")
- local tw,th = surface.GetTextSize("Create Gang")
- 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) )
- if PlayerHasGang then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(100,100,100,240)) end
- end
- CreateGangBtn.DoClick = function() if not PlayerHasGang then OpenGangDialog() end end
- local LeaderboardsBtn = vgui.Create("DButton", TopBarLayout)
- LeaderboardsBtn:SetText("")
- LeaderboardsBtn:SetSize(200,45)
- LeaderboardsBtn.Paint = function(s,w,h)
- draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
- if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
- surface.SetFont("Trebuchet24")
- local tw,th = surface.GetTextSize("Leaderboards")
- 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) )
- end
- LeaderboardsBtn.DoClick = function() ChangeGangTab(3) end
- local function LeaderboardsTab()
- local function PopulateLeaderboards(len)
- local gangcount = net.ReadUInt(16)
- local gangs = {}
- for i=1, gangcount do
- 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)})
- end
- local totalgangs = net.ReadUInt(16)
- local page = net.ReadUInt(16)
- local totalpages = math.max(math.ceil(totalgangs / 20),1)
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- local ListPanel = vgui.Create("DPanel", BackGround)
- ListPanel:SetDrawBackground(false)
- ListPanel:SetPos(5,50)
- ListPanel:SetSize(880,540)
- BackGround.CurrentTab = ListPanel
- local GangsList = vgui.Create("DScrollPanel", ListPanel)
- GangsList:SetSize(880,445)
- GangsList:SetPadding(15)
- local GangIconMaterial = Material("zarp/zarp-gangicon.png")
- for k,v in pairs(gangs) do
- local Gang = vgui.Create("DPanel")
- Gang:SetSize(880,70)
- Gang.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- draw.RoundedBox(4,72,35,w - 77,30,Color(255,255,255,50)) -- Description background
- draw.SimpleTextOutlined(v.Name,"Trebuchet24",72,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- surface.SetMaterial(GangIconMaterial)
- surface.SetDrawColor(v.GangColor)
- surface.DrawTexturedRect( 3, 3, 64, 64 )
- if (page == 1) then
- draw.RoundedBox( 4, 0, 0, w, h, Color(51,51,51,50) )
- draw.SimpleTextOutlined(k,"Trebuchet24",32,24,color_white,TEXT_ALIGN_CENTER,TEXT_ALIGN_LEFT, 2, Color(0,0,0,200) )
- end
- end
- local InfoLayout = vgui.Create("DIconLayout",Gang)
- InfoLayout:SetPos(77,38)
- InfoLayout:SetSize(700, 24)
- AddGangInfoIcon(InfoLayout,string.format("Owner: %s", v.OwnerName),nil,v.SteamID,color_white)
- AddGangInfoIcon(InfoLayout,string.format("Upgrades: %s", v.Upgrades),"icon16/arrow_join.png",nil,color_white)
- AddGangInfoIcon(InfoLayout,string.format("Cash $%s", string.Comma(v.Cash)),"icon16/money.png",nil,color_white)
- AddGangInfoIcon(InfoLayout,string.format("Members: %s", v.MemberCount),"icon16/user_gray.png",nil,color_white)
- local JoinBtn = vgui.Create("DButton",Gang)
- JoinBtn:SetPos(750,4)
- JoinBtn:SetSize(100,25)
- JoinBtn:SetText("")
- JoinBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
- if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
- 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) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- JoinBtn.DoClick = function()
- LocalPlayer():ConCommand("say /applytogang "..v.SteamID)
- end
- if (v.Fee > 0) then JoinBtn:SetDisabled(true) end
- GangsList:AddItem(Gang)
- Gang:Dock( TOP )
- Gang:DockMargin( 4, 0, 0, 4 )
- end
- //Paging panel
- local function ChangePage(page)
- BackGround.CurrentTab:Remove()
- msg = "Loading leaderboards..."
- RunConsoleCommand("_requestGangLeaderboard", tostring(page))
- end
- local PagingLbl = vgui.Create("DLabel",ListPanel)
- PagingLbl:SetFont("Trebuchet22")
- PagingLbl:SetText(string.format("Page %s of %s (%s total gangs(s))",page,totalpages,totalgangs))
- PagingLbl:SizeToContents()
- PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
- //Back
- local BackBtn = vgui.Create("DButton",ListPanel)
- BackBtn:SetPos(PagingLbl:GetPos() - 35,450)
- BackBtn:SetSize(30,20)
- BackBtn:SetText("")
- BackBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined("<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- BackBtn.DoClick = function()
- ChangePage(page - 1)
- end
- if (page == 1) then BackBtn:SetDisabled(true) end
- local BackAllBtn = vgui.Create("DButton",ListPanel)
- BackAllBtn:SetPos(PagingLbl:GetPos() - 70,450)
- BackAllBtn:SetSize(30,20)
- BackAllBtn:SetText("")
- BackAllBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined("<<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- BackAllBtn.DoClick = function()
- ChangePage(1)
- end
- if (page == 1) then BackAllBtn:SetDisabled(true) end
- //Forward
- local ForwardBtn = vgui.Create("DButton",ListPanel)
- ForwardBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 5,450)
- ForwardBtn:SetSize(30,20)
- ForwardBtn:SetText("")
- ForwardBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined(">","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ForwardBtn.DoClick = function()
- ChangePage(page + 1)
- end
- if (page == totalpages) then ForwardBtn:SetDisabled(true) end
- local ForwardAllBtn = vgui.Create("DButton",ListPanel)
- ForwardAllBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 40,450)
- ForwardAllBtn:SetSize(30,20)
- ForwardAllBtn:SetText("")
- ForwardAllBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined(">>","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ForwardAllBtn.DoClick = function()
- ChangePage(totalpages)
- end
- if (page == totalpages) then ForwardAllBtn:SetDisabled(true) end
- end
- msg = "Loading leaderboards..."
- RunConsoleCommand("_requestGangLeaderboard", 1)
- net.Receive("Gang_Leaderboard", function(len)
- if IsValid(BackGround) then PopulateLeaderboards(len) end
- end)
- end
- local function MyGangTab()
- local hordiv = vgui.Create("DHorizontalDivider",BackGround)
- hordiv:SetLeftWidth(225)
- hordiv:SetPos(5,50)
- hordiv:SetSize(880,540)
- local GangOptions
- local Information
- function hordiv:Update()
- if GangOptions and GangOptions:IsValid() then
- Panel:Remove()
- end
- GangOptions = vgui.Create( "DListLayout")
- GangOptions:SetSize(225, 540)
- GangOptions:DockPadding(0,5,0,5)
- GangOptions.Paint = function(s,w,h)
- if PlayerHasGang then draw.RoundedBox( 4, 0, 0, w, h, ZARP.GangInfo and ZARP.GangInfo.Color or team.GetColor(TEAM_GANG) ) end
- end
- local IsOwner = LocalPlayer().DarkRPVars.gang_owner and true or false
- local IsOfficer = LocalPlayer().DarkRPVars.gang_officer and true or false
- PlayerHasGang = LocalPlayer().DarkRPVars.gang_name and not (LocalPlayer().DarkRPVars.gang_name == "") and true or false
- if (LocalPlayer().DarkRPVars.gang_name == "") then
- ZARP.GangInfo = nil
- end
- if IsOwner or IsOfficer then
- local Create = GangOptions:Add(MakeNiceButton(true))
- Create:SetImage( "icon16/add.png" )
- Create:SetText("Edit your gang settings.")
- Create.DoClick = function()
- if not ZARP.GangInfo then return end
- OpenGangDialog() end
- end
- if IsOwner or IsOfficer then
- local SendInvite = GangOptions:Add(MakeNiceButton(true))
- SendInvite:SetImage( "icon16/user_go.png" )
- SendInvite:SetText("Send an invite to join your gang.")
- SendInvite.DoClick = function()
- local menu = DermaMenu()
- local notfound = true
- for _,ply in pairs(player.GetAll()) do
- if ply ~= LocalPlayer() and ply.DarkRPVars and ply.DarkRPVars.gang_name != LocalPlayer().DarkRPVars.gang_name then
- local text = ply.DarkRPVars.gang_name and ply:Nick().."IN GANG ("..ply.DarkRPVars.gang_name..")" or ply:Nick()
- menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("say /invitegang ".. tostring(ply:SteamID())) end)
- notfound = false
- end
- end
- if notfound then
- menu:AddOption("Nobody Found", function() end)
- end
- menu:Open()
- end
- end
- local function ShowManageGangList(len, onlineonly)
- local members = {}
- local page
- local totalpages = math.ceil(ZARP.GangInfo.MemberCount / 20)
- local totalmembers = ZARP.GangInfo.MemberCount
- if not onlineonly then
- local membercount = net.ReadUInt(16)
- for i=1, membercount do
- table.insert(members, {Name = net.ReadString(), RankType = net.ReadUInt(4), SteamID = net.ReadString()})
- end
- page = net.ReadUInt(16)
- else members = ZARP.RetrieveOnlineGangMembers(LocalPlayer():getDarkRPVar("gang_name")) end
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- local ListPanel = vgui.Create("DPanel", BackGround)
- ListPanel:SetDrawBackground(false)
- ListPanel:SetPos(5,50)
- ListPanel:SetSize(880,540)
- BackGround.CurrentTab = ListPanel
- local MembersList = vgui.Create("DScrollPanel", ListPanel)
- MembersList:SetSize(880,445)
- MembersList:SetPadding(15)
- for k,v in pairs(members) do
- local IsLocalPlayer = onlineonly and (v == LocalPlayer()) or (v.SteamID == LocalPlayer():SteamID())
- local OnlinePlayer = len and player.GetBySteamID(v.SteamID) or onlineonly and v
- local IsGangOwner = onlineonly and v:getDarkRPVar("gang_owner") or (v.RankType == 1)
- local IsGangOfficer = onlineonly and v:getDarkRPVar("gang_officer") or (v.RankType == 2)
- local Member = vgui.Create("DPanel")
- Member:SetSize(880,36)
- Member.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- 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) )
- 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) )
- end
- local avatar = vgui.Create("AvatarImage",Member)
- local btn = vgui.Create("DButton",avatar)
- btn.DoClick = function()
- gui.OpenURL(string.format("http://steamcommunity.com/profiles/%s",
- onlineonly and v:SteamID64() or util.SteamIDTo64(v.SteamID) ))
- end
- btn:SetSize(32,32)
- btn:SetDrawBorder( false )
- btn:SetDrawBackground( false )
- btn:SetKeyboardInputEnabled( false )
- btn:SetText( "" )
- avatar:SetPos(8,2)
- avatar:SetSize(32,32)
- if onlineonly then avatar:SetPlayer(v)
- else avatar:SetSteamID(util.SteamIDTo64(v.SteamID)) end
- local RankIcon = vgui.Create("DImage", Member)
- RankIcon:SetImage(IsGangOwner and "icon16/user_suit.png" or IsGangOfficer and "icon16/user_orange.png" or "icon16/user.png")
- RankIcon:SetSize(20,20)
- RankIcon:SetPos(615,8)
- local ManageBtn = vgui.Create("DButton",Member)
- ManageBtn:SetPos(770,2)
- ManageBtn:SetSize(100,30)
- ManageBtn:SetText("")
- ManageBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
- draw.SimpleTextOutlined("Manage","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ManageBtn.DoClick = function()
- local menu = DermaMenu()
- if IsGangOfficer then menu:AddOption("Demote to Member", function()
- if OnlinePlayer then LocalPlayer():ConCommand("say /gangdemote ".. tostring(OnlinePlayer:SteamID())) else LocalPlayer():ConCommand("say /managegang demote ".. v.SteamID) end ChangeGangTab(1)
- end)
- 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)
- end
- 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)
- menu:Open()
- end
- if IsLocalPlayer or IsGangOwner or (not IsOwner and not IsOfficer) then ManageBtn:SetDisabled(true) end
- MembersList:AddItem(Member)
- Member:Dock( TOP )
- Member:DockMargin( 4, 0, 0, 4 )
- end
- //Paging panel
- local function ChangePage(page)
- BackGround.CurrentTab:Remove()
- msg = "Loading members..."
- RunConsoleCommand("_requestGangMembers", tostring(page))
- end
- local PagingLbl = vgui.Create("DLabel",ListPanel)
- PagingLbl:SetFont("Trebuchet22")
- if onlineonly then PagingLbl:SetText(string.format("%s online member(s).",#members))
- else PagingLbl:SetText(string.format("Page %s of %s (%s total member(s))",page,totalpages,ZARP.GangInfo.MemberCount)) end
- PagingLbl:SizeToContents()
- PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
- //Back
- local BackBtn = vgui.Create("DButton",ListPanel)
- BackBtn:SetPos(PagingLbl:GetPos() - 35,450)
- BackBtn:SetSize(30,20)
- BackBtn:SetText("")
- BackBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined("<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- BackBtn.DoClick = function()
- RunConsoleCommand("_requestGangMembers", tostring(page - 1))
- end
- if onlineonly or (page == 1) then BackBtn:SetDisabled(true) end
- local BackAllBtn = vgui.Create("DButton",ListPanel)
- BackAllBtn:SetPos(PagingLbl:GetPos() - 70,450)
- BackAllBtn:SetSize(30,20)
- BackAllBtn:SetText("")
- BackAllBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined("<<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- BackAllBtn.DoClick = function()
- RunConsoleCommand("_requestGangMembers", 1)
- end
- if onlineonly or (page == 1) then BackAllBtn:SetDisabled(true) end
- //Forward
- local ForwardBtn = vgui.Create("DButton",ListPanel)
- ForwardBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 5,450)
- ForwardBtn:SetSize(30,20)
- ForwardBtn:SetText("")
- ForwardBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined(">","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ForwardBtn.DoClick = function()
- RunConsoleCommand("_requestGangMembers", tostring(page + 1))
- end
- if onlineonly or (page == totalpages) then ForwardBtn:SetDisabled(true) end
- local ForwardAllBtn = vgui.Create("DButton",ListPanel)
- ForwardAllBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 40,450)
- ForwardAllBtn:SetSize(30,20)
- ForwardAllBtn:SetText("")
- ForwardAllBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined(">>","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ForwardAllBtn.DoClick = function()
- RunConsoleCommand("_requestGangMembers", totalpages)
- end
- if onlineonly or (page == totalpages) then ForwardAllBtn:SetDisabled(true) end
- end
- local function ShowGangApplicationsList(len)
- local applications = {}
- local count = net.ReadUInt(16)
- for i=1, count do
- table.insert(applications, {Name = net.ReadString(), SteamID = net.ReadString()})
- end
- local page = net.ReadUInt(16)
- local totalpages = math.max(math.ceil(ZARP.GangInfo.Applications / 20),1)
- local totalapplications = ZARP.GangInfo.Applications
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- local ListPanel = vgui.Create("DPanel", BackGround)
- ListPanel:SetDrawBackground(false)
- ListPanel:SetPos(5,50)
- ListPanel:SetSize(880,540)
- BackGround.CurrentTab = ListPanel
- local ApplicationsList = vgui.Create("DScrollPanel", ListPanel)
- ApplicationsList:SetSize(880,445)
- ApplicationsList:SetPadding(15)
- for k,v in pairs(applications) do
- local IsLocalPlayer = onlineonly and (v == LocalPlayer()) or (v.SteamID == LocalPlayer():SteamID())
- local OnlinePlayer = len and player.GetBySteamID(v.SteamID) or onlineonly and v
- local IsGangOwner = onlineonly and v:getDarkRPVar("gang_owner") or (v.RankType == 1)
- local IsGangOfficer = onlineonly and v:getDarkRPVar("gang_officer") or (v.RankType == 2)
- local Application = vgui.Create("DPanel")
- Application:SetSize(880,36)
- Application.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- 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) )
- end
- local avatar = vgui.Create("AvatarImage",Application)
- local btn = vgui.Create("DButton",avatar)
- btn.DoClick = function()
- gui.OpenURL(string.format("http://steamcommunity.com/profiles/%s",
- onlineonly and v:SteamID64() or util.SteamIDTo64(v.SteamID) ))
- end
- btn:SetSize(32,32)
- btn:SetDrawBorder( false )
- btn:SetDrawBackground( false )
- btn:SetKeyboardInputEnabled( false )
- btn:SetText( "" )
- avatar:SetPos(8,2)
- avatar:SetSize(32,32)
- if onlineonly then
- avatar:SetPlayer(v)
- else avatar:SetSteamID(v.SteamID) end
- local AcceptBtn = vgui.Create("DButton",Application)
- AcceptBtn:SetPos(665,2)
- AcceptBtn:SetSize(100,30)
- AcceptBtn:SetText("")
- AcceptBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
- draw.SimpleTextOutlined("Accept","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- AcceptBtn.DoClick = function() LocalPlayer():ConCommand("say /managegang add "..v.SteamID) ChangeGangTab(1) end
- if not IsOwner and not IsOfficer then AcceptBtn:SetDisabled(true) end
- local IgnoreBtn = vgui.Create("DButton",Application)
- IgnoreBtn:SetPos(770,2)
- IgnoreBtn:SetSize(100,30)
- IgnoreBtn:SetText("")
- IgnoreBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
- draw.SimpleTextOutlined("Ignore","Trebuchet18",50,15,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- IgnoreBtn.DoClick = function() LocalPlayer():ConCommand("say /managegang ignore "..v.SteamID) ChangeGangTab(1) end
- if not IsOwner and not IsOfficer then IgnoreBtn:SetDisabled(true) end
- ApplicationsList:AddItem(Application)
- Application:Dock( TOP )
- Application:DockMargin( 4, 0, 0, 4 )
- end
- //Paging panel
- local function ChangePage(page)
- BackGround.CurrentTab:Remove()
- msg = "Loading applications..."
- RunConsoleCommand("_requestGangApplications", tostring(page))
- end
- local PagingLbl = vgui.Create("DLabel",ListPanel)
- PagingLbl:SetFont("Trebuchet22")
- PagingLbl:SetText(string.format("Page %s of %s (%s total applications(s))",page,totalpages,totalapplications))
- PagingLbl:SizeToContents()
- PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
- //Back
- local BackBtn = vgui.Create("DButton",ListPanel)
- BackBtn:SetPos(PagingLbl:GetPos() - 35,450)
- BackBtn:SetSize(30,20)
- BackBtn:SetText("")
- BackBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined("<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- BackBtn.DoClick = function()
- ChangePage(page - 1)
- end
- if onlineonly or (page == 1) then BackBtn:SetDisabled(true) end
- local BackAllBtn = vgui.Create("DButton",ListPanel)
- BackAllBtn:SetPos(PagingLbl:GetPos() - 70,450)
- BackAllBtn:SetSize(30,20)
- BackAllBtn:SetText("")
- BackAllBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined("<<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- BackAllBtn.DoClick = function()
- ChangePage(1)
- end
- if onlineonly or (page == 1) then BackAllBtn:SetDisabled(true) end
- //Forward
- local ForwardBtn = vgui.Create("DButton",ListPanel)
- ForwardBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 5,450)
- ForwardBtn:SetSize(30,20)
- ForwardBtn:SetText("")
- ForwardBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined(">","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ForwardBtn.DoClick = function()
- ChangePage(page + 1)
- end
- if onlineonly or (page == totalpages) then ForwardBtn:SetDisabled(true) end
- local ForwardAllBtn = vgui.Create("DButton",ListPanel)
- ForwardAllBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 40,450)
- ForwardAllBtn:SetSize(30,20)
- ForwardAllBtn:SetText("")
- ForwardAllBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined(">>","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ForwardAllBtn.DoClick = function()
- ChangePage(totalpages)
- end
- if onlineonly or (page == totalpages) then ForwardAllBtn:SetDisabled(true) end
- end
- if PlayerHasGang then
- local PendingInvites = GangOptions:Add(MakeNiceButton(true))
- PendingInvites:SetImage( "icon16/email.png" )
- PendingInvites:SetText("Review Pending Applications")
- PendingInvites.DoClick = function()
- if not ZARP.GangInfo then return end
- BackGround.CurrentTab:Remove()
- msg = "Loading applications..."
- RunConsoleCommand("_requestGangApplications", 1)
- end
- net.Receive("Gang_Applications", function(len)
- if IsValid(BackGround) then msg = nil ShowGangApplicationsList(len) end
- end)
- local ManageGang = GangOptions:Add(MakeNiceButton(true))
- ManageGang:SetImage( "icon16/user_gray.png" )
- ManageGang:SetText("Manage and Promote Members")
- ManageGang.DoClick = function()
- if not ZARP.GangInfo then return end
- local menu = DermaMenu()
- menu:AddOption("Online members", function() ShowManageGangList(nil, true) end)
- menu:AddOption("All members", function()
- BackGround.CurrentTab:Remove()
- msg = "Loading members..."
- RunConsoleCommand("_requestGangMembers", 1) end)
- menu:Open()
- end
- net.Receive("Gang_List", function(len)
- if IsValid(BackGround) then msg = nil ShowManageGangList(len) end
- end)
- local Leave = GangOptions:Add(MakeNiceButton(true))
- Leave:SetImage( "icon16/delete.png" )
- Leave:SetText("Leave this gang.")
- Leave.DoClick = function()
- if not LocalPlayer().DarkRPVars.gang_name then return end
- 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,
- "Yes I want to leave", function() LocalPlayer():ConCommand("say /removegang") timer.Simple(1, function() if IsValid(BackGround) then ChangeGangTab(1) end end) end,
- "Cancel", function() return end
- )
- end
- end
- if IsOwner then
- local ChangeOwner = GangOptions:Add(MakeNiceButton(true))
- ChangeOwner:SetImage( "icon16/user_edit.png" )
- ChangeOwner:SetText("Change the owner of this gang.")
- ChangeOwner.DoClick = function()
- if not LocalPlayer().DarkRPVars.gang_name then return end
- local gangname = LocalPlayer().DarkRPVars.gang_name
- local menu = DermaMenu()
- for _,ply in pairs(player.GetAll()) do
- if ply ~= LocalPlayer() then
- menu:AddOption(ply:Nick(), function()
- Derma_Query(string.format("Are you sure you want to transfer %s to %s (%s)?",gangname,ply:Nick(),ply:SteamName()), "Change Gang Ownership",
- "Yes I want to change the owner", function() LocalPlayer():ConCommand("say /changegang ".. tostring(ply:SteamID())) zm.Close() end,
- "Cancel", function() return end
- )
- end)
- end
- end
- menu:Open()
- end
- end
- if PlayerHasGang then
- local Funds = GangOptions:Add(MakeNiceButton(true))
- Funds:SetImage( "icon16/money_add.png" )
- Funds:SetText("Add funds to the gang.")
- Funds.DoClick = function()
- 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)
- end
- end
- if Information and Information:IsValid() then
- Information:Remove()
- end
- function doGangInfoPanel()
- if Information and Information:IsValid() then
- Information:Remove()
- end
- Information = vgui.Create( "DPanel" )
- Information:SetPos(378,0)
- Information:SetSize(370, 540)
- Information:SetDrawBackground(false)
- local lblLeft = vgui.Create("DLabel",Information)
- lblLeft:SetPos(5,0)
- lblLeft:SetText(PlayerHasGang and LocalPlayer().DarkRPVars.gang_name or "No Gang")
- lblLeft:SetFont("ZMenuHeader")
- lblLeft:SizeToContents()
- local GangInfoLayout = vgui.Create("DListLayout",Information)
- GangInfoLayout:SetPos(5,35)
- GangInfoLayout:SetWide(215)
- local GangInfoLayoutRight
- if ZARP.GangInfo then
- GangInfoLayoutRight = vgui.Create("DListLayout",Information)
- GangInfoLayoutRight:SetPos(235,35)
- GangInfoLayoutRight:SetWide(315)
- end
- if ZARP.GangInfo then
- AddGangInfoIcon(GangInfoLayout,string.format("Owner: %s", ZARP.GangInfo.OwnerName), nil, ZARP.GangInfo.OwnerSteamID)
- AddGangInfoIcon(GangInfoLayout,string.format("Members: %s",string.Comma(ZARP.GangInfo.MemberCount or 0)), "icon16/user_gray.png")
- AddGangInfoIcon(GangInfoLayoutRight,string.format("Gang Cash $%s",string.Comma(ZARP.GangInfo.Cash or 0)), "icon16/money.png")
- AddGangInfoIcon(GangInfoLayoutRight,string.format("Gang Loot: %s",string.Comma(ZARP.GangInfo.Loot or 0)), "zarp/loot32.png")
- 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
- AddGangInfoIcon(GangInfoLayout,string.format("Your Rank: %s",LocalPlayer():getDarkRPVar("gang_owner")
- and "Owner" or LocalPlayer():getDarkRPVar("gang_officer") and "Officer" or "Member"), LocalPlayer():getDarkRPVar("gang_owner")
- and "icon16/user_suit.png" or LocalPlayer():getDarkRPVar("gang_officer") and "icon16/user_orange.png" or "icon16/user.png")
- if ZARP.GangInfo.Applications > 0 then
- AddGangInfoIcon(GangInfoLayout,string.format("Pending Applications: %s",ZARP.GangInfo.Applications), "icon16/email.png")
- end
- else
- AddGangInfoIcon(GangInfoLayout,"Use the leaderboards to search for a gang to join or create your own.","icon16/zoom.png")
- GangInfoLayout:SetWide(570)
- end
- //GangInfoLayout:SizeToContents()
- //GangInfoLayoutRight:SizeToContents()
- //Gang upgrades
- local UpgradesScroller = vgui.Create( "DHorizontalScroller",Information )
- UpgradesScroller:SetOverlap( 3 )
- UpgradesScroller:SetSize(640,300)
- UpgradesScroller:SetPos(5,50 + (#GangInfoLayout:GetChildren() * 24))
- UpgradesScroller.Paint = function(s,w,h)
- //draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- end
- for k,v in pairs(ZARP.GangUpgrades) do
- local HasUpgrade = ZARP.GangHasItem(nil, v.id)
- local Upgrade = vgui.Create("DPanel")
- local DescMarkup = markup.Parse(string.format("<font=Trebuchet18><colour=255, 255, 255, 255>%s</colour></font>",v.desc),160)
- Upgrade:SetSize(160,240)
- Upgrade.Paint = function(s,w,h)
- //draw.RoundedBox(4,0,0,w,h,Color(51,51,51))
- surface.SetFont("Trebuchet22")
- local tw,th = surface.GetTextSize(v.title)
- 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) )
- DescMarkup:Draw(w / 2 - (DescMarkup:GetWidth() / 2),170)
- end
- local Icon = vgui.Create("DImage",Upgrade)
- Icon:SetSize(150,150)
- Icon:SetPos(5, 0)
- Icon:SetImage(string.format("zarp/%s",v.icon))
- if not HasUpgrade then Icon:SetAlpha(30) end
- if not HasUpgrade then
- local CashLbl
- local LootLbl
- if v.cash > 0 then
- CashLbl = vgui.Create("DLabel",Upgrade)
- CashLbl:SetFont("Trebuchet20")
- CashLbl:SetText(string.format("Cash $%s",string.Comma(v.cash)))
- CashLbl:SizeToContents()
- CashLbl:SetPos((Upgrade:GetWide() / 2) - (CashLbl:GetWide() / 2),175 + DescMarkup:GetHeight())
- end
- if v.loot > 0 then
- LootLbl = vgui.Create("DLabel",Upgrade)
- LootLbl:SetFont("Trebuchet20")
- LootLbl:SetText(string.format("Loot: %s",string.Comma(v.loot)))
- LootLbl:SizeToContents()
- LootLbl:SetPos((Upgrade:GetWide() / 2) - (LootLbl:GetWide() / 2),(CashLbl and 195 or 175) + DescMarkup:GetHeight())
- end
- local PurchaseBtn = vgui.Create("DButton",Upgrade)
- PurchaseBtn:SetPos(30,220 + DescMarkup:GetHeight())
- PurchaseBtn:SetSize(100,25)
- PurchaseBtn:SetText("")
- PurchaseBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89,255))
- draw.SimpleTextOutlined("Purchase","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then draw.RoundedBox(4,0,0,w,h,Color(100,100,100,240)) end
- end
- PurchaseBtn.DoClick = function() LocalPlayer():ConCommand("say /buygangitem "..v.id) end
- if (not IsOwner and not IsOfficer) or not ZARP.GangInfo then PurchaseBtn:SetDisabled(true) PurchaseBtn:SetToolTip("You must be a gang owner or officer")
- elseif (v.cash > ZARP.GangInfo.Cash) or (v.loot > ZARP.GangInfo.Loot) then PurchaseBtn:SetDisabled(true) PurchaseBtn:SetToolTip("Not enough cash or loot")
- elseif v.requires and not ZARP.GangHasItem(nil,v.requires) then PurchaseBtn:SetDisabled(true) PurchaseBtn:SetToolTip("Requires the previous upgrade") end
- end
- UpgradesScroller:AddPanel(Upgrade)
- end
- hordiv:SetRight(Information)
- end
- doGangInfoPanel()
- hordiv:SetLeft(GangOptions)
- end
- hordiv:Update()
- return hordiv
- end
- table.insert(GangTabs, {func = MyGangTab, button = MyGangBtn })
- table.insert(GangTabs, {func = CreateGangTab, button = CreateGangBtn })
- table.insert(GangTabs, {func = LeaderboardsTab, button = LeaderboardsBtn })
- if PlayerHasGang and not ZARP.GangInfo then
- msg = "Loading Gang Data..."
- RunConsoleCommand("_requestGangData")
- net.Receive( "Gang_Data", function(len)
- ZARP.GangInfo = {}
- ZARP.GangInfo.Cash = net.ReadUInt(32)
- ZARP.GangInfo.Fee = net.ReadUInt(32)
- ZARP.GangInfo.Color = net.ReadColor()
- ZARP.GangInfo.Upgrades = net.ReadString()
- ZARP.GangInfo.OwnerName = net.ReadString()
- ZARP.GangInfo.OwnerSteamID = net.ReadString()
- ZARP.GangInfo.MemberCount = net.ReadUInt(16)
- ZARP.GangInfo.Applications = net.ReadUInt(16)
- ZARP.GangInfo.Loot = net.ReadUInt(32)
- if IsValid(BackGround) then msg = nil ChangeGangTab(1) end
- end)
- net.Receive( "Gang_SummaryData", function(len)
- if not ZARP.GangInfo then return end
- ZARP.GangInfo.Cash = net.ReadUInt(32)
- ZARP.GangInfo.MemberCount = net.ReadUInt(16)
- ZARP.GangInfo.Applications = net.ReadUInt(16)
- ZARP.GangInfo.Loot = net.ReadUInt(32)
- if IsValid(BackGround) then msg = nil ChangeGangTab(1) end
- end)
- else
- ChangeGangTab(1) //My gang tab
- end
- return BackGround
- end
- --[[
- SHOP TAB
- --]]
- local HoverMat = Material( "vgui/spawnmenu/hover" )
- function zm.MakeShopItem( model, desc, cmd, name, price, entpanel, vip, img,salepct )
- local icon
- if img then
- icon = vgui.Create("DImageButton")
- icon:SetImage( img )
- icon:SetSize(64, 64)
- icon:SetToolTip( false )
- icon.DoClick = function() LocalPlayer():ConCommand("say "..cmd) end
- icon.OnCursorEntered = function() entpanel:SetInfo( model, name, price, desc, img, salepct ) end
- icon.OnCursorExited = function() entpanel:SetInfo( false ) end
- icon.PaintOver = function(s,w,h)
- if salepct then
- draw.WordBox( 4, 0, 5, "SALE", "Tre20", Color(255,51,51), color_white )
- end
- if !icon.Hovered then return end
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( HoverMat )
- icon:DrawTexturedRect()
- end
- icon:SetPos( 2, 2 )
- else
- icon = vgui.Create("SpawnIcon")
- icon:InvalidateLayout( true )
- icon:SetModel( model )
- icon:SetSize(64, 64)
- icon:SetToolTip( false )
- icon.DoClick = function() LocalPlayer():ConCommand("say "..cmd) end
- icon.OnCursorEntered = function() entpanel:SetInfo( model, name, price, desc, img, salepct ) end
- icon.OnCursorExited = function() entpanel:SetInfo( false ) end
- icon:SetPos( 2, 2 )
- icon.PaintOver = function(s,w,h)
- if salepct then
- draw.WordBox( 4, 0, 5, "SALE", "Tre20", Color(255,51,51), color_white )
- end
- if !icon.Hovered then return end
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( HoverMat )
- icon:DrawTexturedRect()
- end
- end
- if vip then
- local sign = MakeSign( "vip", icon )
- sign:SetPos( 64-16-6, 64-16-12 )
- end
- return icon
- end
- function zm.Shop()
- local EntitiesMain = vgui.Create("DPanel")
- function EntitiesMain.Paint() end
- EntitiesMain:SetDrawBackground(false)
- EntitiesMain:SetSize( zm.content_w, zm.content_h )
- local InfoPanel = vgui.Create( "DPanel", EntitiesMain )
- InfoPanel:SetSize( zm.content_w, 60 )
- InfoPanel:SetBackgroundColor( Color( 255, 255, 255, 15 ) )
- InfoPanel.name = vgui.Create( "DLabel", InfoPanel )
- InfoPanel.name:SetFont( "Tre22" )
- InfoPanel.name:SetPos( 80, 5 )
- InfoPanel.name:SetColor( Color( 255, 255, 255, 255 ) )
- InfoPanel.price = vgui.Create( "DLabel", InfoPanel )
- InfoPanel.price:SetFont( "Tre22" )
- InfoPanel.price:SetPos( 80, 33 - 5 )
- InfoPanel.price:SetColor( Color( 175, 255, 175, 255 ) )
- function InfoPanel:SetItem( model, name, price, desc, img, salepct )
- if not model then
- if IsValid(self.icon) then self.icon:SetVisible( false ) end
- self.name:SetText( "Please select an item from below." )
- self.price:SetText( "Your money: " .. CUR .. (ZARP.formatNumber(LocalPlayer().DarkRPVars.money) ) )
- self.name:SizeToContents()
- self.price:SizeToContents()
- return
- end
- if img then
- self.icon = vgui.Create("DImage",self)
- self.icon:SetImage( img )
- else
- self.icon = vgui.Create("SpawnIcon", self)
- self.icon:SetModel( model )
- end
- self.icon:SetSize(64, 64)
- self.icon:SetPos(2,-2)
- self.icon:SetToolTip( desc or "" )
- self.name:SetText( "Press to buy: " .. name )
- if salepct then
- local pctoff = ((price / 100) * salepct)
- price = math.Round(price - pctoff)
- end
- self.price:SetText( "Price: $" .. string.Comma(price) )
- self.name:SizeToContents()
- self.price:SizeToContents()
- if salepct then
- InfoPanel.PaintOver = function(s,w,h)
- draw.WordBox( 8, s:GetWide() - 105, 10, string.format("SALE %i%% OFF",salepct), "Bebas24Font", Color(255,51,51), color_white )
- end
- else
- InfoPanel.PaintOver = nil
- end
- end
- InfoPanel:SetItem( false )
- local EntitiesPanel = vgui.Create("DPanelList", EntitiesMain)
- EntitiesPanel:SetSize(zm.content_w,zm.content_h-65)
- EntitiesPanel:SetPos( 0, 62 )
- EntitiesPanel:EnableVerticalScrollbar( true )
- EntitiesPanel:EnableHorizontal( false )
- function EntitiesMain:Update()
- EntitiesPanel:Update()
- end
- function EntitiesPanel:SetInfo( model, name, price, desc, img, salepct )
- InfoPanel:SetItem( model, name, price, desc, img, salepct )
- end
- function EntitiesPanel:Update()
- self:SetPadding( 5 )
- self:SetSpacing( 5 )
- self:Clear(true)
- local haswep = false
- local WepCat = vgui.Create("DCollapsibleCategory")
- WepCat:SetDrawBackground(true)
- WepCat:SetLabel("Weapons and Ammunition")
- local WepPanel = vgui.Create("DPanelList")
- WepPanel:SetSize(470, 100)
- WepPanel:SetAutoSize(true)
- WepPanel:SetSpacing(5)
- WepPanel:SetPadding(5)
- WepPanel:EnableHorizontal(true)
- WepPanel:EnableVerticalScrollbar(true)
- WepPanel:SetMouseInputEnabled( false )
- for k,v in pairs(CustomShipments) do
- if (v.seperate and (not GAMEMODE.Config.restrictbuypistol or
- (GAMEMODE.Config.restrictbuypistol and (not v.allowed[1] or table.HasValue(v.allowed, LocalPlayer():Team())))))
- and (not v.customCheck or v.customCheck and v.customCheck(LocalPlayer())) then
- haswep = true
- 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 ) )
- end
- end
- for k,v in pairs(GAMEMODE.AmmoTypes) do
- if not v.customCheck or v.customCheck(LocalPlayer()) then
- haswep = true
- 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 ))
- end
- end
- WepCat:SetContents(WepPanel)
- WepCat.OnMousePressed = function( self, code ) EntitiesPanel:OnMousePressed( code ) end
- WepCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
- WepPanel.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
- WepPanel.OnMouseWheeled = function( self, d ) self:GetParent():OnMouseWheeled( d ) end
- if haswep then
- self:AddItem(WepCat)
- else
- WepCat:Remove()
- end
- function WepCat:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 150, 150, 150, 255 ) )
- end
- WepCat.Header:SetFont( "Tre20" )
- WepCat.Header:SetColor( Color( 255,255,255,255 ) )
- local EntCat = vgui.Create("DCollapsibleCategory")
- EntCat:SetLabel("General Items")
- local EntPanel = vgui.Create("DPanelList")
- EntPanel:SetSize(470, 200)
- EntPanel:SetAutoSize(true)
- EntPanel:SetSpacing(5)
- EntPanel:SetPadding(5)
- EntPanel:EnableHorizontal(true)
- EntPanel:EnableVerticalScrollbar(true)
- for k,v in pairs(DarkRPEntities) do
- if not v.allowed and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
- local cmdname = string.gsub(v.ent, " ", "_")
- 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) ) )
- end
- end
- EntCat:SetContents(EntPanel)
- EntCat.OnMousePressed = function( self, code ) EntitiesPanel:OnMousePressed( code ) end
- EntCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
- EntPanel.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
- EntPanel.OnMouseWheeled = function( self, d ) self:GetParent():OnMouseWheeled( d ) end
- self:AddItem(EntCat)
- function EntCat:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 150, 150, 150, 255 ) )
- end
- EntCat.Header:SetFont( "Tre20" )
- EntCat.Header:SetColor( Color( 255,255,255,255 ) )
- EntCat.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
- EntCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
- local hasspecial = false
- local SpecialCat = vgui.Create("DCollapsibleCategory")
- SpecialCat:SetLabel(team.GetName( LocalPlayer():Team() ) .. " Items")
- local SpecialPanel = vgui.Create("DPanelList")
- SpecialPanel:SetSize(470, 200)
- SpecialPanel:SetAutoSize(true)
- SpecialPanel:SetSpacing(5)
- SpecialPanel:SetPadding(5)
- SpecialPanel:EnableHorizontal(true)
- SpecialPanel:EnableVerticalScrollbar(true)
- for k,v in pairs(DarkRPEntities) do
- if v.allowed and (type(v.allowed) == "table" and table.HasValue(v.allowed, LocalPlayer():Team()))
- and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
- local cmdname = string.gsub(v.ent, " ", "_")
- hasspecial = true
- 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) ) )
- end
- end
- if FoodItems and (GAMEMODE.Config.foodspawn or LocalPlayer():Team() == TEAM_COOK) and (GAMEMODE.Config.hungermod or LocalPlayer():Team() == TEAM_COOK) then
- for k,v in pairs(FoodItems) do
- hasspecial = true
- SpecialPanel:AddItem( zm.MakeShopItem(v.model, LANGUAGE.GetPhrase("buy_a",k,"a few bucks"), "/buyfood "..k, k, "???", self, (v.customCheck or v.CustomCheck) ))
- end
- end
- for k,v in pairs(CustomShipments) do
- if not v.noship and table.HasValue(v.allowed, LocalPlayer():Team())
- and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
- hasspecial = true
- 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 ))
- end
- end
- SpecialCat:SetContents(SpecialPanel)
- SpecialCat.OnMousePressed = function( self, code ) EntitiesPanel:OnMousePressed( code ) end
- SpecialCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
- SpecialPanel.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
- SpecialPanel.OnMouseWheeled = function( self, d ) self:GetParent():OnMouseWheeled( d ) end
- if hasspecial then
- self:AddItem(SpecialCat)
- else
- SpecialCat:Remove()
- end
- function SpecialCat:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), team.GetColor( LocalPlayer():Team() ) )
- end
- SpecialCat.Header:SetFont( "Tre20" )
- SpecialCat.Header:SetColor( Color( 255,255,255,255 ) )
- if #CustomVehicles <= 0 then return end
- local VehicleCat = vgui.Create("DCollapsibleCategory")
- VehicleCat:SetLabel("Chairs")
- local VehiclePanel = vgui.Create("DPanelList")
- VehiclePanel:SetSize(470, 200)
- VehiclePanel:SetAutoSize(true)
- VehiclePanel:SetSpacing(5)
- VehiclePanel:SetPadding(5)
- VehiclePanel:EnableHorizontal(true)
- VehiclePanel:EnableVerticalScrollbar(true)
- local founds = 0
- for k,v in pairs(CustomVehicles) do
- if not v.allowed or table.HasValue(v.allowed, LocalPlayer():Team()) then
- local Skin = (list.Get("Vehicles")[v.name] and list.Get("Vehicles")[v.name].KeyValues and list.Get("Vehicles")[v.name].KeyValues.Skin) or "0"
- 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) ) )
- founds = founds + 1
- end
- end
- function VehicleCat:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 200, 200, 200, 255 ) )
- end
- VehicleCat.Header:SetFont( "Trebuchet22" )
- VehicleCat.Header:SetColor( Color( 0,0,0,255 ) )
- VehicleCat.OnMousePressed = function( self, code ) EntitiesPanel:OnMousePressed( code ) end
- VehicleCat.OnMouseWheeled = function( self, d ) EntitiesPanel:OnMouseWheeled( d ) end
- VehiclePanel.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
- VehiclePanel.OnMouseWheeled = function( self, d ) self:GetParent():OnMouseWheeled( d ) end
- if founds ~= 0 then
- VehicleCat:SetContents(VehiclePanel)
- //VehicleCat:SetContents(rentbutton)
- //RentCat:SetContents(rentbutton)
- self:AddItem(VehicleCat)
- else
- VehiclePanel:Remove()
- VehicleCat:Remove()
- end
- end
- EntitiesPanel:Update()
- return EntitiesMain
- end
- //Jobs Tab
- local _jobslist
- local function AddJobIcon(vip,infoupdate, job, color,Model, name, description, Weapons, command, special, specialcommand)
- local btn = vgui.Create( "DButton" )
- btn:SetSize( 213, 68 )
- btn.bgcol = Color( color.r * 0.75, color.g * 0.75, color.b * 0.75, 255 )
- btn:SetText( "" )
- function btn:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.bgcol )
- end
- local label = vgui.Create( "DLabel", btn )
- if string.len( name ) > 18 then
- label:SetFont( "Default" )
- label:SetPos( 80, 27 )
- else
- label:SetFont( "Tre22" )
- label:SetPos( 80, 23 )
- end
- label:SetTextColor( Color( 255,255,255,255 ) )
- label:SetText( name)
- label:SizeToContents()
- label:SetMouseInputEnabled( false )
- local icon = vgui.Create("SpawnIcon", btn )
- local IconModel = Model
- if type(Model) == "table" then
- IconModel = Model[#Model]
- end
- icon:SetModel(IconModel)
- icon:SetSize(64, 64)
- icon:SetToolTip()
- icon:SetPos( 2, 2 )
- icon:SetMouseInputEnabled( false )
- local mod = (name == "Mod On Duty")
- local admin = (name == "Admin On Duty")
- if vip or mod or admin then
- local rank = "vip"
- if mod then rank = "moderator" elseif admin then rank = "admin" end
- local sign = MakeSign( rank, icon )
- sign:SetPos( -2, 64-16 )
- end
- btn.OnCursorEntered = function()
- model = IconModel
- infoupdate( job )
- btn.bgcol = Color( job.color.r + 30, job.color.g + 30, job.color.b + 30, 255 )
- end
- btn.OnCursorExited = function()
- infoupdate(false)
- btn.bgcol = Color( job.color.r, job.color.g, job.color.b, 255 )
- end
- btn.DoClick = function()
- local function DoChatCommand(frame)
- if special then
- local menu = DermaMenu()
- menu:AddOption("Vote", function() LocalPlayer():ConCommand("say "..command) if frame then frame:Close() end zm.Close() end)
- menu:AddOption("Do not vote", function() LocalPlayer():ConCommand("say " .. specialcommand) if frame then frame:Close() end zm.Close() end)
- menu:Open()
- else
- LocalPlayer():ConCommand("say " .. command)
- zm.Close()
- end
- end
- if type(Model) == "table" and #Model > 0 then
- --hordiv:GetParent():GetParent():Close()
- local frame = vgui.Create("DFrame")
- frame:SetTitle("Choose model")
- frame:SetVisible(true)
- frame:MakePopup()
- local levels = 1
- local IconsPerLevel = math.floor(ScrW()/64)
- while #Model * (64/levels) > ScrW() do
- levels = levels + 1
- end
- frame:SetSize(math.Min(#Model * 64, IconsPerLevel*64), math.Min(90+(64*(levels-1)), ScrH()))
- frame:Center()
- local CurLevel = 1
- for k,v in pairs(Model) do
- local icon = vgui.Create("SpawnIcon", frame)
- if (k-IconsPerLevel*(CurLevel-1)) > IconsPerLevel then
- CurLevel = CurLevel + 1
- end
- icon:SetPos((k-1-(CurLevel-1)*IconsPerLevel) * 64, 25+(64*(CurLevel-1)))
- icon:SetModel(v)
- icon:SetSize(64, 64)
- icon:SetToolTip()
- icon.DoClick = function()
- RunConsoleCommand("rp_playermodel", v)
- RunConsoleCommand("_rp_ChosenModel", v)
- DoChatCommand( frame )
- frame:Close()
- end
- end
- else
- DoChatCommand()
- end
- end
- function btn:OnMouseWheeled(d)
- _jobslist:OnMouseWheeled(d)
- end
- return btn
- end
- function zm.Jobs()
- local jobsmain = vgui.Create("DPanel")
- jobsmain:SetSize( zm.content_w, zm.content_h )
- function jobsmain:Paint() end
- local leftw = 425 - 15
- local jobslist
- local jobsinfoh
- local jobmodel
- function jobsmain:Update()
- if jobslist and jobslist:IsValid() then
- jobslist:Remove()
- end
- jobslist = vgui.Create("DPanelList", jobsmain)
- jobslist:SetSize( 465, zm.content_h)
- jobslist:EnableHorizontal( false )
- jobslist:EnableVerticalScrollbar( true )
- jobslist:SetPadding( 5 )
- jobslist:SetSpacing( 8 )
- jobslist:SetPos( 0, 0 )
- _jobslist = jobslist
- if jobsinfoh and jobsinfoh:IsValid() then
- jobsinfoh:Remove()
- end
- jobsinfoh = vgui.Create("DPanel", jobsmain)
- jobsinfoh:SetSize( leftw, 60 )
- jobsinfoh:SetPos( 475, 5 )
- jobsinfoh:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
- local jobsinfot = vgui.Create("DLabel", jobsinfoh)
- jobsinfot:SetFont( "Tre24" )
- jobsinfot:SetTextColor( Color( 255, 255, 255, 255 ) )
- jobsinfot:SetText( "" )
- jobsinfot:SetPos( 10, 15 )
- if jobsinfod and jobsinfod:IsValid() then
- jobsinfod:Remove()
- end
- jobsinfod = vgui.Create("DPanel", jobsmain)
- jobsinfod:SetSize( leftw, 450 )
- jobsinfod:SetPos( 475, 75 )
- jobsinfod:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
- local jobsinfodesc = vgui.Create("DTextEntry", jobsinfod)
- --jobsinfot:SetFont( "Tre24" )
- --jobsinfot:SetTextColor( Color( 255, 255, 255, 255 ) )
- jobsinfodesc:SetText( "" )
- jobsinfodesc:SetPos( 0, 0 )
- jobsinfodesc:SetSize( 340, 440 )
- jobsinfodesc:SetFont( "JobDesc" )
- --function jobsinfodesc:Paint() end
- jobsinfodesc:AllowInput( false )
- jobsinfodesc:SetMultiline( true )
- jobsinfodesc:SetDrawBackground( false )
- jobsinfodesc:SetDrawBorder( false )
- if jobmodel and jobmodel:IsValid() then
- jobmodel:Remove()
- end
- jobmodel = vgui.Create("DModelPanel", jobsmain )
- jobmodel:SetModel("")
- jobmodel:SetSize(75,250)
- jobmodel:SetAnimated(true)
- jobmodel:SetFOV(20)
- jobmodel:SetAnimSpeed(1)
- jobmodel:SetPos( 810, 60 )
- local function UpdateInfo( job )
- if not job then
- jobsinfoh:SetBackgroundColor( Color( 0,0,0,0 ) )
- jobsinfot:SetText( "<- Select a job from the left" )
- jobsinfot:SizeToContents()
- jobsinfod:SetBackgroundColor( Color( 0, 0, 0, 0 ) )
- jobsinfodesc:SetText("")
- jobsinfodesc:SetVisible( false )
- jobmodel:SetModel("")
- return
- end
- local desc = job.description
- if job.weapons and type( job.weapons ) == "table" and #job.weapons > 0 then
- desc = desc .. "\n\nSpecial Weapons:\n"
- for k, v in pairs( job.weapons ) do
- desc = desc .. v .. "\n"
- end
- end
- jobsinfoh:SetBackgroundColor( job.color )
- jobsinfot:SetText( "The " .. job.name )
- jobsinfot:SizeToContents()
- jobsinfod:SetBackgroundColor( Color( 200, 200, 200, 255 ) )
- jobsinfodesc:SetText( desc )
- jobsinfodesc:SetVisible( true )
- jobmodel:SetModel( model )
- end
- UpdateInfo( nil )
- for i, j in pairs( hTeamCats ) do
- local jobcat = vgui.Create("DCollapsibleCategory")
- jobcat:SetLabel( j )
- jobcat.bgcol = Color( 150, 150, 150, 255 )
- function jobcat:Paint()
- draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), self.bgcol )
- end
- jobcat.Header:SetFont( "Tre20" )
- jobcat.Header:SetColor( Color( 255, 255, 255, 255 ) )
- jobcat:SetMouseInputEnabled(true)
- function jobcat:OnMouseWheeled(d)
- jobslist:OnMouseWheeled(d)
- end
- function jobcat.Header:OnMouseWheeled(d)
- jobslist:OnMouseWheeled(d)
- end
- local jobcatlist = vgui.Create("DPanelList")
- jobcatlist:SetSize(470, 200)
- jobcatlist:SetAutoSize(true)
- jobcatlist:SetSpacing(5)
- jobcatlist:SetPadding(5)
- jobcatlist:EnableHorizontal(true)
- jobcatlist:EnableVerticalScrollbar(false)
- function jobcatlist:OnMouseWheeled(d)
- jobslist:OnMouseWheeled(d)
- end
- for k,v in ipairs(RPExtraTeams) do
- if LocalPlayer():Team() ~= k and v.cat == i then
- local nodude = true
- if v.admin == 1 and not LocalPlayer():IsAdmin() then
- nodude = false
- end
- if v.admin > 1 and not LocalPlayer():IsHeadAdmin() then
- nodude = false
- end
- //if v.customCheck and not v.customCheck(LocalPlayer()) then
- //nodude = false
- //end
- if (type(v.NeedToChangeFrom) == "number" and LocalPlayer():Team() ~= v.NeedToChangeFrom) or (type(v.NeedToChangeFrom) == "table" and not table.HasValue(v.NeedToChangeFrom, LocalPlayer():Team())) then
- nodude = false
- end
- if nodude then
- local weps = "no extra weapons"
- if #v.weapons > 0 then
- weps = table.concat(v.weapons, "\n")
- end
- if v.vote then
- local condition = ((v.admin == 0 and LocalPlayer():IsAdmin()) or (v.admin == 1 and LocalPlayer():IsHeadAdmin()) or LocalPlayer().DarkRPVars["Priv"..v.command])
- 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
- 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))
- else
- 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
- jobcatlist:AddItem(AddJobIcon((v.customCheck or v.CustomCheck),UpdateInfo, v, v.color,v.model, v.name, v.description, weps, "/"..v.command))
- end
- end
- end
- end
- jobcat:SetContents(jobcatlist)
- jobslist:AddItem( jobcat )
- end
- end
- jobsmain:Update()
- return jobsmain
- end
- function zm.SkillsTab()
- local w = 890
- local l = 520
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(l,w)
- BackGround.Paint = function()
- draw.RoundedBox(4,0,0,w,l,Color(55, 100, 5, 150))
- 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) )
- end
- local SkillList = vgui.Create("DScrollPanel", BackGround)
- SkillList:SetPos(0,54)
- SkillList:SetSize( w, 456 )
- SkillList:SetPadding(15)
- SkillList.Paint = function( self, w, h )
- draw.RoundedBox(4,0,0, w, h, Color(150,150,150,220))
- end
- function SkillList:LoadSkills()
- for k,v in SortedPairs( LocalPlayer().Skills ) do
- local sk = LDRP_SH.AllSkills[k]
- local nextlvl = sk.pricetbl[v.lvl+1]
- local SkillItem = vgui.Create("DPanel")
- SkillItem:SetSize(880,80)
- SkillItem.Paint = function()
- local cure = LocalPlayer().Skills[k]
- local nextlvl = LDRP_SH.AllSkills[k].pricetbl[cure.lvl + 1]
- draw.RoundedBox(4,0,0,880,80,Color(200,200,200,255))
- draw.RoundedBox(4,90,6,100,30,Color(150,150,150,255)) -- Title background
- draw.RoundedBox(4,90,43,658,30,Color(150,150,150,255)) -- Description background
- local need = LDRP_SH.AllSkills[k].exptbl[cure.lvl]
- draw.RoundedBox(4,198,6,658,30,Color(0,0,0,255)) -- EXP Background
- 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))
- 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) )
- local Txt = "Trebuchet24"
- if string.len(k) > 8 then Txt = "Trebuchet22" end
- draw.SimpleTextOutlined(k,Txt,100,20,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- draw.SimpleTextOutlined(sk.descrpt,"Trebuchet24",100,57,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- local SkillIcon = vgui.Create("SpawnIcon", SkillItem)
- SkillIcon:SetPos(8,4)
- SkillIcon:SetSize(70, 70)
- SkillIcon:SetModel(sk.mdl)
- SkillIcon:SetToolTip()
- function SkillIcon:PaintOver() return end
- if nextlvl then
- local SkillBuy = vgui.Create("DButton",SkillItem)
- SkillBuy:SetPos(754,43)
- SkillBuy:SetSize(100,30)
- SkillBuy:SetText("")
- SkillBuy.Paint = function()
- local cure = LocalPlayer().Skills[k]
- draw.RoundedBox(4,0,0,100,30,Color(150,150,150,255))
- 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) )
- local need = LDRP_SH.AllSkills[k].exptbl[cure.lvl]
- if cure.exp < need then
- draw.RoundedBox(4,0,0,100,30,Color(100,100,100,240))
- end
- end
- if sk.pricetbl[v.lvl+1] then
- SkillBuy:SetToolTip("Buy level " .. v.lvl+1 .. " for $" .. sk.pricetbl[v.lvl+1])
- else
- SkillBuy:SetToolTip("Your level is maxed out!")
- end
- local OldEnter = SkillBuy.OnCursorEntered
- SkillBuy.OnCursorEntered = function(s)
- SkillBuy.Paint = function()
- local cure = LocalPlayer().Skills[k]
- draw.RoundedBox(4,0,0,100,30,Color(225,225,225,255))
- 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) )
- local need = LDRP_SH.AllSkills[k].exptbl[cure.lvl]
- if cure.exp < need then
- draw.RoundedBox(4,0,0,100,30,Color(100,100,100,240))
- end
- end
- local mylvl = LocalPlayer().Skills[k].lvl
- if sk.pricetbl[mylvl+1] then
- SkillBuy:SetToolTip("Buy level " .. mylvl+1 .. " for $" .. sk.pricetbl[mylvl+1])
- else
- SkillBuy:SetToolTip("Your level is maxxed out!")
- end
- return OldEnter(s)
- end
- SkillBuy.OnCursorExited = function()
- SkillBuy.Paint = function()
- local cure = LocalPlayer().Skills[k]
- draw.RoundedBox(4,0,0,100,30,Color(150,150,150,255))
- 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) )
- local need = LDRP_SH.AllSkills[k].exptbl[cure.lvl]
- if cure.exp < need then
- draw.RoundedBox(4,0,0,100,30,Color(100,100,100,240))
- end
- end
- end
- SkillBuy.DoClick = function()
- local currentExp = LocalPlayer().Skills[k].exp
- if currentExp < sk.exptbl[v.lvl] then --v.exp contains old information, have to get it fresh from the skills table.
- LocalPlayer():ChatPrint("You need more experience!")
- chat.PlaySound()
- else
- RunConsoleCommand("_buysk",k)
- end
- end
- SkillBuy.Think = function(s)
- local cure = LocalPlayer().Skills[k]
- local nextlvl = LDRP_SH.AllSkills[k].pricetbl[cure.lvl + 1]
- if !nextlvl then s:Remove() end
- end
- end
- SkillList:AddItem(SkillItem)
- SkillItem:Dock( TOP )
- SkillItem:DockMargin( 4, 0, 0, 4 )
- end
- end
- function SkillList:Think()
- if LocalPlayer().Skills and table.Count(LocalPlayer().Skills) > 0 then
- SkillList:LoadSkills()
- SkillList.Think = nil
- end
- end
- return BackGround
- end
- function zm.BlueprintsTab()
- local w = 890
- local l = 520
- local BluePrintMat = Material("zarp/blueprint256.png")
- local GoldBluePrintMat = Material("zarp/blueprintgold256.png")
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(l,w)
- BackGround.Paint = function()
- draw.RoundedBox(4,0,0,w,l,Color(102,140,255, 150))
- 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) )
- end
- local BlueprintsList = vgui.Create("DScrollPanel", BackGround)
- BlueprintsList:SetPos(0,54)
- BlueprintsList:SetSize( w, 456 )
- BlueprintsList:SetPadding(15)
- function BlueprintsList:LoadBlueprints()
- for k,v in pairs(LDRP_SH.TableToNumericalKeys(LDRP_SH.Blueprints)) do
- local hasblueprint = LocalPlayer():HasItem(string.lower(v.name .. " blueprint"))
- local Blueprint = vgui.Create("DPanel")
- Blueprint:SetSize(880,80)
- Blueprint.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,880,80,Color(89,89,89))
- draw.RoundedBox(4,90,43,658,30,Color(255,255,255,50)) -- Description background
- draw.SimpleTextOutlined(v.name,"Trebuchet24",100,20,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- draw.SimpleTextOutlined(v.desc,"Trebuchet22",100,57,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- surface.SetMaterial(v.golden and GoldBluePrintMat or BluePrintMat)
- surface.SetDrawColor(255,255,255,hasblueprint and 255 or 100)
- surface.DrawTexturedRect( 8, 4, 70, 70 )
- if v.newblueprint then draw.WordBox( 4, w - 121, 5, "NEW BLUEPRINT", "Bebas24Font", Color(255,51,51), color_white ) end
- end
- if hasblueprint then
- local Icon = vgui.Create("ModelImage", Blueprint)
- Icon:SetPos(8,4)
- Icon:SetSize(70, 70)
- Icon:SetModel(v.model)
- end
- local SkillBuy = vgui.Create("DButton",Blueprint)
- SkillBuy:SetPos(754,43)
- SkillBuy:SetSize(100,30)
- SkillBuy:SetText("")
- SkillBuy.Paint = function()
- local cure = LocalPlayer().Skills[k]
- draw.RoundedBox(4,0,0,100,30,Color(150,150,150,255))
- 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) )
- if !hasblueprint then
- draw.RoundedBox(4,0,0,100,30,Color(100,100,100,240))
- end
- end
- SkillBuy.DoClick = function()
- if !hasblueprint then return end
- local multiuse = v.multiuse
- 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",
- function() RunConsoleCommand("_CraftBlueprintItem",v.key) end, "Cancel" )
- end
- if table.Count(v.results) < 1 then SkillBuy:SetVisible(false) end
- if hasblueprint then SkillBuy:SetTooltip("Cost: $" .. ZARP.formatNumber(v.price)) end
- BlueprintsList:AddItem(Blueprint)
- Blueprint:Dock( TOP )
- Blueprint:DockMargin( 4, 0, 0, 4 )
- end
- end
- BlueprintsList:LoadBlueprints()
- return BackGround
- end
- function zm.ShopListTab()
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(890,520)
- BackGround.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(255, 75, 15, 200))
- 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) )
- 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
- end
- local ScrollPanel = vgui.Create("DScrollPanel", BackGround)
- ScrollPanel:SetPos(0,54)
- ScrollPanel:SetSize(890,456)
- local ShopList = vgui.Create("DIconLayout", ScrollPanel)
- ShopList:SetSize(880,456)
- ShopList:SetPos(15,0)
- ShopList:SetSpaceX(5)
- ShopList:SetSpaceY(5)
- ShopList.NextUpdate = CurTime() + 5
- local function ShopInList(ply)
- for k,v in pairs(ShopList:GetChildren()) do
- if (v.ply == ply) then return v end
- end
- return false
- end
- function ShopList:Update()
- local shops = {}
- for k,v in pairs(player.GetAll()) do
- if v.DarkRPVars and v.DarkRPVars.IsShopOpen then
- table.insert(shops, {name = v.DarkRPVars.ShopName or v:Nick().."'s Shop", ply = v })
- end
- end
- if #shops < 1 then ShopList:Clear() msg = "There are currently no shops open on this server."
- else msg = nil end
- for k,v in SortedPairs(shops) do
- local HasShopPanel = ShopInList(v.ply)
- if HasShopPanel and not IsValid(v.ply) then
- HasShopPanel:Remove() continue
- elseif HasShopPanel then
- HasShopPanel.name = v.name continue
- else
- if not IsValid(v.ply) then continue end
- local ShopPanel = ShopList:Add("DButton")
- ShopPanel:SetText("")
- ShopPanel.ply = v.ply
- ShopPanel.name = v.name
- ShopPanel:SetSize((ShopList:GetWide() / 3) - 10,80)
- ShopPanel.Paint = function(s,w,h)
- 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))
- if s:IsHovered() then
- 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))
- end
- draw.SimpleTextOutlined(s.name,"Trebuchet22",36,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- 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) )
- end
- local Icon = vgui.Create("ModelImage", ShopPanel)
- Icon:SetPos(2,2)
- Icon:SetSize(32, 32)
- Icon:SetModel("models/props_c17/cashregister01a.mdl")
- //ShopList:AddItem(ShopPanel)
- //ShopPanel:Dock( TOP )
- //ShopPanel:DockMargin( 5, 5, 5, 5 )
- ShopPanel.DoClick = function()
- RunConsoleCommand("_sendshopdata",v.ply:UserID())
- //zm.Close()
- end
- end
- end
- end
- ShopList.Think = function(s)
- if CurTime() >= s.NextUpdate then
- s.NextUpdate = CurTime() + 5
- s:Update()
- end
- end
- ShopList:Update()
- return BackGround
- end
- function zm.AuctionHouseTab()
- local msg = ""
- local BackGround = vgui.Create("EditablePanel")
- BackGround:MakePopup()
- BackGround:SetSize(890,520)
- BackGround.Paint = function(s,w,h)
- //draw.RoundedBox(4,0,0,w,h,Color(255, 75, 15, 200))
- 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
- end
- BackGround.Think = function()
- if input.IsKeyDown(zm.key) then zm.Close() end
- end
- local TopBarLayout = vgui.Create( "DIconLayout", BackGround )
- TopBarLayout:SetSize(890,45)
- TopBarLayout.Paint = function(s,w,h)
- draw.RoundedBox( 4, 0, 0, w, h, Color( 128,0,0,200 ))
- end
- //TopBarLayout:SetSpaceY(2)
- TopBarLayout:SetSpaceX(-2)
- local AuctionTabs = {}
- local function ChangeAuctionTab(tab)
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- msg = nil
- BackGround.CurrentTab = AuctionTabs[tab].func()
- for k,v in pairs(AuctionTabs) do
- v.button.IsSelected = false
- end
- AuctionTabs[tab].button.IsSelected = true
- end
- //Tab buttons
- local AuctionHouseBtn = vgui.Create("DButton", TopBarLayout)
- AuctionHouseBtn:SetText("")
- AuctionHouseBtn:SetSize(200,45)
- AuctionHouseBtn.Paint = function(s,w,h)
- draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
- if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
- surface.SetFont("Trebuchet24")
- local tw,th = surface.GetTextSize("Auction House")
- 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) )
- end
- AuctionHouseBtn.DoClick = function() ChangeAuctionTab(1) end
- local MyListingsBtn = vgui.Create("DButton", TopBarLayout)
- MyListingsBtn:SetText("")
- MyListingsBtn:SetSize(200,45)
- MyListingsBtn.Paint = function(s,w,h)
- draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
- if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
- surface.SetFont("Trebuchet24")
- local tw,th = surface.GetTextSize("My Listings")
- 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) )
- end
- MyListingsBtn.DoClick = function() ChangeAuctionTab(2) end
- local MyBidsBtn = vgui.Create("DButton", TopBarLayout)
- MyBidsBtn:SetText("")
- MyBidsBtn:SetSize(200,45)
- MyBidsBtn.Paint = function(s,w,h)
- draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
- if (s:IsHovered() or s.IsSelected) then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
- surface.SetFont("Trebuchet24")
- local tw,th = surface.GetTextSize("My Bids")
- 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) )
- end
- MyBidsBtn.DoClick = function() ChangeAuctionTab(3) end
- local SearchBtn = vgui.Create("DButton", TopBarLayout)
- SearchBtn:SetText("")
- SearchBtn:SetSize(200,45)
- SearchBtn.Paint = function(s,w,h)
- draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(89,89,89))
- if s:IsHovered() then draw.RoundedBox( 4, 3, 3, w - 6, h - 6, Color(255,255,255,30)) end
- surface.SetFont("Trebuchet24")
- local tw,th = surface.GetTextSize("Search")
- 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) )
- end
- SearchBtn.DoClick = function()
- Derma_StringRequest("Search Auction House","Enter an item name to search for (e.g. Gluon Gun or weapon_gluongun)","",
- 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")
- end
- local function AddAuctionInfo(pnl, text, icon, textcolor, steamid, wide, parentaction)
- if not pnl then return end
- local infopanel = vgui.Create("DButton",pnl)
- infopanel:SetDrawBackground(false)
- infopanel:SetText("")
- if icon then
- local img = vgui.Create("DImage", infopanel)
- img:SetImage(icon)
- img:SetSize(20,20)
- img:SetPos(2,2)
- elseif steamid then
- local avatar = vgui.Create("AvatarImage",infopanel)
- local btn = vgui.Create("DButton",avatar)
- btn.DoClick = function()
- gui.OpenURL(string.format("http://steamcommunity.com/profiles/%s",steamid))
- end
- btn:SetSize(20,20)
- btn:SetDrawBorder( false )
- btn:SetDrawBackground( false )
- btn:SetKeyboardInputEnabled( false )
- btn:SetText( "" )
- avatar:SetPos(2,2)
- avatar:SetSize(20,20)
- avatar:SetSteamID(steamid, 32)
- end
- local lbl = vgui.Create("DLabel",infopanel)
- lbl:SetFont("Tre22")
- if textcolor then lbl:SetColor(textcolor) end
- lbl:SetPos((icon or steamid) and 25 or 2,0)
- lbl:SetText(text or "")
- lbl:SizeToContents()
- if wide then lbl:SetWide(wide) end
- if parentaction then
- infopanel.DoClick = function() pnl:DoClick() end
- else
- infopanel:SetCursor("arrow")
- end
- infopanel:SetSize(25 + lbl:GetWide(), 24)
- return infopanel
- end
- local function CreateTimeLeftString(timeleft)
- local TimeLeftStr
- if (timeleft < 60) then
- TimeLeftStr = string.format("%i second(s)",math.max(timeleft,0))
- elseif (timeleft < 3600) then
- TimeLeftStr = string.format("%i minute(s)",math.Round(timeleft / 60))
- elseif (timeleft < 86400) then
- TimeLeftStr = string.format("%i hour(s)",math.Round(timeleft / 3600))
- else
- TimeLeftStr = string.format("%i day(s)",math.Round(timeleft / 86400))
- end
- return TimeLeftStr
- end
- local function CreateTimeAgoString(timeago)
- local TimeAgoStr
- if (timeago > 86400) then
- TimeAgoStr = string.format("%i day(s)",math.Round(timeago / 86400))
- elseif (timeago > 3600) then
- TimeAgoStr = string.format("%i hours(s)",math.Round(timeago / 3600))
- elseif (timeago > 60) then
- TimeAgoStr = string.format("%i minutes(s)",math.Round(timeago / 60))
- else
- TimeAgoStr = string.format("%i seconds(s)",math.max(timeago,1))
- end
- return TimeAgoStr
- end
- local function AuctionListingTab(id)
- local function PopulateListing(len)
- msg = nil
- local listing = net.ReadTable()
- local bidhistory = net.ReadTable()
- if not listing or (table.Count(listing) <= 1) then msg = "Invalid Auction ID" return end
- if not listing.Owner or not listing.TimeLeft or not listing.LastBid then return end
- local ItemTbl = LDRP_SH.AllItems[listing.Item]
- if !ItemTbl then return end
- local Name = ItemTbl.nicename or listing.Item
- Name = LDRP_SH.NicerWepNames[Name] or Name
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- local ListPanel = vgui.Create("DPanel", BackGround)
- ListPanel:SetPos(0,50)
- ListPanel:SetSize(890,540)
- ListPanel.Paint = function()
- draw.RoundedBox( 4, 0, 2, 890, 180, Color( 64,64,64 )) --Item details
- draw.RoundedBox( 4, 0, 185, 890, 40, Color( 64,64,64 )) --Place bid strip
- //draw.RoundedBox( 4, 0, 228, 890, 320, Color( 128,0,0,150 )) --Bid history
- draw.SimpleTextOutlined(Name,"Trebuchet24",3,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- 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) )
- end
- BackGround.CurrentTab = ListPanel
- local ItemIcon = CreateIcon(ListPanel,ItemTbl.mdl,150,150,function() end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,listing.Item)
- ItemIcon:SetPos(3,28)
- local ListingInfoLayout = vgui.Create("DListLayout",ListPanel)
- ListingInfoLayout:SetPos(158,28)
- ListingInfoLayout:SetSize(732, 152)
- AddAuctionInfo(ListingInfoLayout,string.format("Owner: %s", listing.Owner), nil, color_white, listing.SteamID)
- AddAuctionInfo(ListingInfoLayout,string.format("Description: %s",ItemTbl.descr or "N/A"), "icon16/tag_blue.png",color_white,nil,710)
- AddAuctionInfo(ListingInfoLayout,string.format("Time Left: %s",CreateTimeLeftString(listing.TimeLeft)), "icon16/clock.png",color_white)
- AddAuctionInfo(ListingInfoLayout,string.format("Last Bid $%s",string.Comma(listing.LastBid)), "icon16/money.png",color_white)
- AddAuctionInfo(ListingInfoLayout,string.format("Current Price: $%s",string.Comma(listing.LastBid + listing.Increment)), "icon16/money_add.png",color_white)
- AddAuctionInfo(ListingInfoLayout,string.format("Item Weight: %s",ItemTbl.weight or 0), "icon16/box.png",color_white)
- //Place bid strip
- local PlaceBidLbl = vgui.Create("DLabel",ListPanel)
- PlaceBidLbl:SetPos(3, 193)
- PlaceBidLbl:SetFont("Tre22")
- PlaceBidLbl:SetColor(color_white)
- PlaceBidLbl:SetText("Bid Amount ($):")
- PlaceBidLbl:SizeToContents()
- local BidAmount = vgui.Create("DNumberWang",ListPanel)
- BidAmount:SetPos(6 + PlaceBidLbl:GetWide(), 188)
- BidAmount:SetSize(192,32)
- BidAmount:SetFont("Tre22")
- BidAmount:SetText(listing.LastBid + listing.Increment)
- BidAmount:SetMinMax((listing.LastBid + listing.Increment),2000000000)
- local PlaceBidBtn = vgui.Create("DButton",ListPanel)
- PlaceBidBtn:SetPos(3 + (BidAmount:GetPos() + BidAmount:GetWide()), 188)
- PlaceBidBtn:SetSize(100,32)
- PlaceBidBtn:SetText("")
- PlaceBidBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color( 128,0,0,200 ))
- surface.DrawRect( 0,0,w,h )
- if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
- 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) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- PlaceBidBtn.DoClick = function(s)
- if PlaceBidBtn.NextPress and (CurTime() < PlaceBidBtn.NextPress) then return end
- PlaceBidBtn.NextPress = (CurTime() + 2)
- if (BidAmount:GetValue() < BidAmount:GetMin()) then
- Derma_Message(string.format("You must enter a bid of at least $%s or more.",string.Comma(BidAmount:GetMin())),"Auction Error")
- elseif (BidAmount:GetValue() > BidAmount:GetMax()) then
- Derma_Message(string.format("You cannot bid more than %s.",string.Comma(BidAmount:GetMax())),"Auction Error")
- else
- s.PermaDisabled = true
- s:SetDisabled(true)
- RunConsoleCommand("_auctionBid", id, BidAmount:GetValue())
- end
- end
- PlaceBidBtn.Think = function(s)
- if s.PermaDisabled then return end
- if LocalPlayer().DarkRPVars.money < BidAmount:GetValue() then
- PlaceBidBtn:SetTooltip("You cannot afford this bid amount.")
- PlaceBidBtn:SetDisabled(true)
- else PlaceBidBtn:SetTooltip(nil) PlaceBidBtn:SetDisabled(false) end
- end
- if (LocalPlayer():SteamID64() == listing.SteamID) then
- PlaceBidBtn.PermaDisabled = true PlaceBidBtn:SetTooltip("You cannot bid on your own items.") PlaceBidBtn:SetDisabled(true)
- elseif bidhistory and bidhistory[1] and (LocalPlayer():SteamID64() == bidhistory[1].SteamID) then
- PlaceBidBtn.PermaDisabled = true PlaceBidBtn:SetTooltip("You cannot bid twice in a row.") PlaceBidBtn:SetDisabled(true)
- elseif (listing.TimeLeft <= 0) then
- PlaceBidBtn.PermaDisabled = true PlaceBidBtn:SetTooltip("This listing has now closed.") PlaceBidBtn:SetDisabled(true)
- end
- //Bid history
- local BidderHeader = AddAuctionInfo(ListPanel, "Bidder", "icon16/user.png", color_white)
- BidderHeader:SetPos(-3, 251)
- local AmountHeader = AddAuctionInfo(ListPanel, "Amount", "icon16/money.png", color_white)
- AmountHeader:SetPos(200, 251)
- local TimeHeader = AddAuctionInfo(ListPanel, "Time", "icon16/clock.png", color_white)
- TimeHeader:SetPos(335, 251)
- local BidsPnl = vgui.Create("DScrollPanel", ListPanel)
- BidsPnl:SetPos(-3,274)
- BidsPnl:SetSize(520,198)
- BidsPnl:SetPadding(15)
- local oddrow = true
- for k,v in pairs(bidhistory) do
- if not v.Name or not v.Amount or not v.TimeAgo then continue end
- local Bid = vgui.Create("DPanel")
- Bid:SetSize(500, 24)
- Bid.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,s.OddRow and Color(89,89,89) or Color(255,255,255,0))
- end
- Bid.OddRow = oddrow
- local Bidder = AddAuctionInfo(Bid, v.Name, nil, color_white, v.SteamID, 170)
- Bidder:SetPos(2, 0)
- local Amount = AddAuctionInfo(Bid, string.format("$%s",string.Comma(v.Amount)), nil, color_white, nil, 130)
- Amount:SetPos(197, 2)
- local Amount = AddAuctionInfo(Bid, string.format("%s ago",CreateTimeAgoString(v.TimeAgo)), nil, color_white, nil, 150)
- Amount:SetPos(332, 2)
- BidsPnl:AddItem(Bid)
- Bid:Dock( TOP )
- Bid:DockMargin( 4, 0, 0, 4 )
- oddrow = !oddrow
- end
- if #bidhistory <= 0 then
- local Bid = vgui.Create("DPanel")
- Bid:SetSize(500, 24)
- Bid.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- end
- local Notice = AddAuctionInfo(Bid, "No bid yet on this item.", nil, color_white, nil, 300)
- Notice:SetPos(2, 0)
- BidsPnl:AddItem(Bid)
- Bid:Dock( TOP )
- Bid:DockMargin( 4, 0, 0, 4 )
- end
- end
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- msg = "Retreiving listing..."
- RunConsoleCommand("_requestAuctionListing", id)
- net.Receive("Auction_Listing", function(len)
- if IsValid(BackGround) then PopulateListing(len) end
- end)
- end
- local function AuctionHouseTab(listings)
- local function PopulateListings(len, searchlistings)
- msg = nil
- local listings = len and net.ReadTable()
- local page = len and net.ReadUInt(16)
- local totallistings = searchlistings and #searchlistings or net.ReadUInt(16)
- local totalpages = math.ceil(totallistings / 20)
- if not listings then return end
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- local ListPanel = vgui.Create("DPanel", BackGround)
- ListPanel:SetDrawBackground(false)
- ListPanel:SetPos(0,50)
- ListPanel:SetSize(890,540)
- local ItemHeader = AddAuctionInfo(ListPanel, "Item", "zarp/zarp-auctionhouseicon.png", color_white)
- ItemHeader:SetPos(3, 0)
- local ItemOwner = AddAuctionInfo(ListPanel, "Owner", "icon16/user_gray.png", color_white)
- ItemOwner:SetPos(208, 0)
- local TimeLeft = AddAuctionInfo(ListPanel, "Time Left", "icon16/clock.png", color_white)
- TimeLeft:SetPos(363, 0)
- local LastBid = AddAuctionInfo(ListPanel, "Last Bid", "icon16/money.png", color_white)
- LastBid:SetPos(468, 0)
- local CurrentPrice = AddAuctionInfo(ListPanel, "Current Price", "icon16/money_add.png", color_white)
- CurrentPrice:SetPos(603, 0)
- local CurrentPrice = AddAuctionInfo(ListPanel, "Last Bidder", "icon16/user.png", color_white)
- CurrentPrice:SetPos(738, 0)
- BackGround.CurrentTab = ListPanel
- local ListingsPnl = vgui.Create("DScrollPanel", ListPanel)
- ListingsPnl:SetPos(0,25)
- ListingsPnl:SetSize(890,420)
- ListingsPnl:SetPadding(15)
- for k,v in pairs(searchlistings or listings) do
- if not v.Owner or not v.TimeLeft or not v.LastBid then continue end
- local ItemTbl = LDRP_SH.AllItems[v.Item]
- if !ItemTbl then continue end
- local Name = ItemTbl.nicename or v.item
- Name = LDRP_SH.NicerWepNames[Name] or Name
- local Listing = vgui.Create("DButton")
- Listing:SetSize(880,50)
- Listing:SetText("")
- Listing.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- if (s:IsHovered() or s:IsChildHovered(1)) then draw.RoundedBox( 4, 0, 0, w, h, Color(255,255,255,30)) end
- //draw.RoundedBox(4,72,35,w - 77,30,Color(255,255,255,50)) -- Description background
- //draw.SimpleTextOutlined(Name,"Trebuchet24",72,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- local ItemIcon = CreateIcon(Listing,ItemTbl.mdl,46,46,function() Listing:DoClick() end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,v.Item)
- ItemIcon:SetPos(2,2)
- -- local InfoLayout = vgui.Create("DIconLayout",Listing)
- -- InfoLayout:SetPos(77,38)
- -- InfoLayout:SetSize(700, 24)
- local ItemName = AddAuctionInfo(Listing, Name, nil, color_white, nil, 150, true)
- ItemName:SetPos(50, 12)
- local Owner = AddAuctionInfo(Listing, v.Owner, nil, color_white, nil, 150, true)
- Owner:SetPos(205, 12)
- local TimeLeft = AddAuctionInfo(Listing, CreateTimeLeftString(v.TimeLeft), nil, color_white, nil, 100, true)
- TimeLeft:SetPos(360, 12)
- local LastBid = AddAuctionInfo(Listing, string.format("$%s",string.Comma(v.LastBid)), nil, color_white, nil, 130, true)
- LastBid:SetPos(465, 12)
- local CurrentPrice = AddAuctionInfo(Listing, string.format("$%s",string.Comma(v.LastBid + v.Increment)), nil, color_white, nil, 130, true)
- CurrentPrice:SetPos(600, 12)
- local LastBidder = AddAuctionInfo(Listing, v.LastBidder or "Nobody", nil, color_white, nil, 130, true)
- LastBidder:SetPos(735, 12)
- //AddAuctionInfo(InfoLayout,string.format("Owner: %s", v.OwnerName),"icon16/user_gray.png",color_white)
- //AddAuctionInfo(InfoLayout,string.format("Time Left: %s", TimeLeftStr),"icon16/clock.png",color_white)
- //AddAuctionInfo(InfoLayout,string.format("Last Bid $%s", string.Comma(v.LastBid)),"icon16/money.png",color_white)
- //AddAuctionInfo(InfoLayout,string.format("Current Price: %s", string.Comma(v.LastBid + v.Increment)),"icon16/money_add.png",color_white)
- //AddAuctionInfo(InfoLayout,string.format("Last Bidder: %s", v.LastBidder),"icon16/user.png",color_white)
- Listing.DoClick = function()
- AuctionListingTab(v.ID)
- end
- ListingsPnl:AddItem(Listing)
- Listing:Dock( TOP )
- Listing:DockMargin( 4, 0, 0, 4 )
- end
- //Paging panel
- local function ChangePage(page)
- BackGround.CurrentTab:Remove()
- msg = "Retreiving listings..."
- RunConsoleCommand("_requestAuctionListings", tostring(page))
- end
- local PagingLbl = vgui.Create("DLabel",ListPanel)
- PagingLbl:SetFont("Trebuchet22")
- if searchlistings or (page == 0) then
- page = 1
- PagingLbl:SetText(string.format("%i search results (Showing first 20 matches.)",searchlistings and #searchlistings or #listings))
- else
- PagingLbl:SetText(string.format("Page %s of %s (%s total listing(s))",page,totalpages,totallistings))
- end
- PagingLbl:SizeToContents()
- PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
- //Back
- local BackBtn = vgui.Create("DButton",ListPanel)
- BackBtn:SetPos(PagingLbl:GetPos() - 35,450)
- BackBtn:SetSize(30,20)
- BackBtn:SetText("")
- BackBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined("<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- BackBtn.DoClick = function()
- ChangePage(page - 1)
- end
- if (page == 1) then BackBtn:SetDisabled(true) end
- local BackAllBtn = vgui.Create("DButton",ListPanel)
- BackAllBtn:SetPos(PagingLbl:GetPos() - 70,450)
- BackAllBtn:SetSize(30,20)
- BackAllBtn:SetText("")
- BackAllBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined("<<","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- BackAllBtn.DoClick = function()
- ChangePage(1)
- end
- if (page == 1) then BackAllBtn:SetDisabled(true) end
- //Forward
- local ForwardBtn = vgui.Create("DButton",ListPanel)
- ForwardBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 5,450)
- ForwardBtn:SetSize(30,20)
- ForwardBtn:SetText("")
- ForwardBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined(">","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ForwardBtn.DoClick = function()
- ChangePage(page + 1)
- end
- if (page == totalpages) then ForwardBtn:SetDisabled(true) end
- local ForwardAllBtn = vgui.Create("DButton",ListPanel)
- ForwardAllBtn:SetPos(PagingLbl:GetPos() + PagingLbl:GetWide() + 40,450)
- ForwardAllBtn:SetSize(30,20)
- ForwardAllBtn:SetText("")
- ForwardAllBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(150,150,150,255))
- surface.DrawRect( 0,0,w,h )
- draw.SimpleTextOutlined(">>","Trebuchet22",12,10,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- ForwardAllBtn.DoClick = function()
- ChangePage(totalpages)
- end
- if (page == totalpages) then ForwardAllBtn:SetDisabled(true) end
- end
- if listings then PopulateListings(nil, listings) return end
- msg = "Retreiving listings..."
- RunConsoleCommand("_requestAuctionListings", 1)
- net.Receive("Auction_Listings", function(len)
- if IsValid(BackGround) then PopulateListings(len) end
- end)
- end
- local function BidsTab()
- local function PopulateBids(len)
- msg = nil
- local bids = net.ReadTable()
- local page = net.ReadUInt(16)
- if (page == 0) then AuctionHouseTab(bids) return end
- if not bids then return end
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- local ListPanel = vgui.Create("DPanel", BackGround)
- ListPanel:SetDrawBackground(false)
- ListPanel:SetPos(0,50)
- ListPanel:SetSize(890,540)
- local ItemHeader = AddAuctionInfo(ListPanel, "Item", "zarp/zarp-auctionhouseicon.png", color_white)
- ItemHeader:SetPos(3, 0)
- local ItemOwner = AddAuctionInfo(ListPanel, "Owner", "icon16/user_gray.png", color_white)
- ItemOwner:SetPos(208, 0)
- local TimeLeft = AddAuctionInfo(ListPanel, "Time Left", "icon16/clock.png", color_white)
- TimeLeft:SetPos(363, 0)
- local LastBid = AddAuctionInfo(ListPanel, "My Last Bid", "icon16/money.png", color_white)
- LastBid:SetPos(468 ,0)
- BackGround.CurrentTab = ListPanel
- local ListingsPnl = vgui.Create("DScrollPanel", ListPanel)
- ListingsPnl:SetPos(0,25)
- ListingsPnl:SetSize(890,420)
- ListingsPnl:SetPadding(15)
- local function AddBids()
- ListingsPnl:Clear()
- for k,v in pairs(bids) do
- if not v.Item or not v.Owner or not v.TimeLeft or not v.Amount then continue end
- local ItemTbl = LDRP_SH.AllItems[v.Item]
- if !ItemTbl then continue end
- local Name = ItemTbl.nicename or v.item
- Name = LDRP_SH.NicerWepNames[Name] or Name
- local Bid = vgui.Create("DButton")
- Bid:SetSize(880,50)
- Bid:SetText("")
- Bid.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- if (s:IsHovered() or s:IsChildHovered(1)) then draw.RoundedBox( 4, 0, 0, w, h, Color(255,255,255,30)) end
- //draw.RoundedBox(4,72,35,w - 77,30,Color(255,255,255,50)) -- Description background
- //draw.SimpleTextOutlined(Name,"Trebuchet24",72,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- local ItemIcon = CreateIcon(Bid,ItemTbl.mdl,46,46,function() AuctionListingTab(v.ID) end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,v.Item)
- ItemIcon:SetPos(2,2)
- -- local InfoLayout = vgui.Create("DIconLayout",Listing)
- -- InfoLayout:SetPos(77,38)
- -- InfoLayout:SetSize(700, 24)
- local ItemName = AddAuctionInfo(Bid, Name, nil, color_white, nil, 150, true)
- ItemName:SetPos(50, 12)
- local Owner = AddAuctionInfo(Bid, v.Owner, nil, color_white, nil, 150, true)
- Owner:SetPos(205, 12)
- if (v.Status == 1) then
- local TimeLeft = AddAuctionInfo(Bid, (v.TimeLeft <= 0) and "Processing" or CreateTimeLeftString(v.TimeLeft), nil, color_white, nil, 100, true)
- TimeLeft:SetPos(360, 12)
- elseif (v.Status == 2) then
- local ClaimBtn = vgui.Create("DButton",Bid)
- ClaimBtn:SetPos(360,12)
- ClaimBtn:SetSize(100,25)
- ClaimBtn:SetText("")
- ClaimBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
- if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
- draw.SimpleTextOutlined("Claim Item","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- ClaimBtn.DoClick = function() RunConsoleCommand("_bidAction", "claim", v.ID) table.remove(bids, k) AddBids(bids) end
- elseif (v.Status == 3) then
- local ReclaimBtn = vgui.Create("DButton",Bid)
- ReclaimBtn:SetPos(360,12)
- ReclaimBtn:SetSize(100,25)
- ReclaimBtn:SetText("")
- ReclaimBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
- if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
- 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) )
- end
- ReclaimBtn.DoClick = function() RunConsoleCommand("_bidAction", "reclaim", v.ID) table.remove(bids, k) AddBids(bids) end
- end
- local LastBid = AddAuctionInfo(Bid, string.format("$%s",string.Comma(v.Amount)), nil, color_white, nil, 130, true)
- LastBid:SetPos(465, 12)
- ListingsPnl:AddItem(Bid)
- Bid:Dock( TOP )
- Bid:DockMargin( 4, 0, 0, 4 )
- end
- end
- AddBids(bids)
- local PagingLbl = vgui.Create("DLabel",ListPanel)
- PagingLbl:SetFont("Trebuchet22")
- PagingLbl:SetText(string.format("%i Bids Listed (20 Oldest shown only)",#bids))
- PagingLbl:SizeToContents()
- PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
- end
- msg = "Retreiving bids..."
- RunConsoleCommand("_requestMyBids", 1)
- net.Receive("Auction_Listings", function(len)
- if IsValid(BackGround) then PopulateBids(len) end
- end)
- end
- local function ListingsTab()
- local function PopulateListings(len)
- msg = nil
- local listings = net.ReadTable()
- local page = net.ReadUInt(16)
- if (page == 0) then AuctionHouseTab(listings) return end
- if not listings then return end
- if BackGround.CurrentTab then BackGround.CurrentTab:Remove() end
- local ListPanel = vgui.Create("DPanel", BackGround)
- ListPanel:SetDrawBackground(false)
- ListPanel:SetPos(0,50)
- ListPanel:SetSize(890,540)
- local ItemHeader = AddAuctionInfo(ListPanel, "Item", "zarp/zarp-auctionhouseicon.png", color_white)
- ItemHeader:SetPos(3, 0)
- local ItemOwner = AddAuctionInfo(ListPanel, "Owner", "icon16/user_gray.png", color_white)
- ItemOwner:SetPos(208, 0)
- local TimeLeft = AddAuctionInfo(ListPanel, "Time Left", "icon16/clock.png", color_white)
- TimeLeft:SetPos(363, 0)
- local LastBid = AddAuctionInfo(ListPanel, "Last Bid", "icon16/money.png", color_white)
- LastBid:SetPos(468, 0)
- local CurrentPrice = AddAuctionInfo(ListPanel, "Current Price", "icon16/money_add.png", color_white)
- CurrentPrice:SetPos(603, 0)
- local CurrentPrice = AddAuctionInfo(ListPanel, "Last Bidder", "icon16/user.png", color_white)
- CurrentPrice:SetPos(738, 0)
- BackGround.CurrentTab = ListPanel
- local ListingsPnl = vgui.Create("DScrollPanel", ListPanel)
- ListingsPnl:SetPos(0,25)
- ListingsPnl:SetSize(890,420)
- ListingsPnl:SetPadding(15)
- local function AddListings(listings)
- ListingsPnl:Clear()
- for k,v in pairs(listings) do
- if not v.Item or not v.LastBid then continue end
- local ItemTbl = LDRP_SH.AllItems[v.Item]
- if !ItemTbl then continue end
- local Name = ItemTbl.nicename or v.item
- Name = LDRP_SH.NicerWepNames[Name] or Name
- local Listing = vgui.Create("DPanel")
- Listing:SetSize(880,50)
- Listing:SetText("")
- Listing.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- if (s:IsHovered() or s:IsChildHovered(1)) then draw.RoundedBox( 4, 0, 0, w, h, Color(255,255,255,30)) end
- //draw.RoundedBox(4,72,35,w - 77,30,Color(255,255,255,50)) -- Description background
- //draw.SimpleTextOutlined(Name,"Trebuchet24",72,15,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- local ItemIcon = CreateIcon(Listing,ItemTbl.mdl,46,46,function() AuctionListingTab(v.ID) end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,v.Item)
- ItemIcon:SetPos(2,2)
- local ItemName = AddAuctionInfo(Listing, Name, nil, color_white, nil, 150)
- ItemName:SetPos(50, 12)
- local Owner = AddAuctionInfo(Listing, LocalPlayer():Nick(), nil, color_white, nil, 150)
- Owner:SetPos(205, 12)
- if (tonumber(v.Processed) == 0) then
- local TimeLeft = AddAuctionInfo(Listing,(v.TimeLeft <= 0) and tonumber(v.Processed) == 0 and "Processing" or CreateTimeLeftString(v.TimeLeft), nil, color_white, nil, 100)
- TimeLeft:SetPos(360, 12)
- elseif (tonumber(v.Processed) == 1) then
- local ClaimBtn = vgui.Create("DButton",Listing)
- ClaimBtn:SetPos(360,12)
- ClaimBtn:SetSize(100,25)
- ClaimBtn:SetText("")
- ClaimBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
- if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
- draw.SimpleTextOutlined("Claim Funds","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- ClaimBtn.DoClick = function() RunConsoleCommand("_listingAction", "claim", v.ID) table.remove(listings, k) AddListings(listings) end
- elseif (tonumber(v.Processed) == 2) then
- local ReclaimBtn = vgui.Create("DButton",Listing)
- ReclaimBtn:SetPos(360,12)
- ReclaimBtn:SetSize(100,25)
- ReclaimBtn:SetText("")
- ReclaimBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(150,150,150,255))
- if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30)) end
- draw.SimpleTextOutlined("Re-claim","Trebuchet18",50,12,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- ReclaimBtn.DoClick = function() RunConsoleCommand("_listingAction", "reclaim", v.ID) table.remove(listings, k) AddListings(listings) end
- end
- local LastBid = AddAuctionInfo(Listing, string.format("$%s",string.Comma(v.LastBid)), nil, color_white, nil, 130)
- LastBid:SetPos(465, 12)
- local CurrentPrice = AddAuctionInfo(Listing, string.format("$%s",string.Comma(v.LastBid + v.Increment)), nil, color_white, nil, 130)
- CurrentPrice:SetPos(600, 12)
- local LastBidder = AddAuctionInfo(Listing, v.LastBidder or "Nobody", nil, color_white, nil, 130)
- LastBidder:SetPos(735, 12)
- ListingsPnl:AddItem(Listing)
- Listing:Dock( TOP )
- Listing:DockMargin( 4, 0, 0, 4 )
- end
- local PagingLbl = vgui.Create("DLabel",ListPanel)
- PagingLbl:SetFont("Trebuchet22")
- PagingLbl:SetText(string.format("%s total listings.",#listings))
- PagingLbl:SizeToContents()
- PagingLbl:SetPos((890/2) - (PagingLbl:GetWide() / 2), 450)
- end
- AddListings(listings)
- end
- msg = "Retreiving listings..."
- RunConsoleCommand("_requestMyListings", 1)
- net.Receive("Auction_Listings", function(len)
- if IsValid(BackGround) then PopulateListings(len) end
- end)
- end
- table.insert(AuctionTabs, {func = AuctionHouseTab, button = AuctionHouseBtn })
- table.insert(AuctionTabs, {func = ListingsTab, button = MyListingsBtn })
- table.insert(AuctionTabs, {func = BidsTab, button = MyBidsBtn })
- ChangeAuctionTab(1)
- return BackGround
- end
- function zm.HitListTab()
- local w = 890
- local l = 520
- local hits = {}
- for k,v in pairs(player.GetAll()) do
- if v:GetNWInt("HBounty") > 0 then
- table.insert(hits, {ply = v, bounty = v:GetNWInt("HBounty")})
- end
- end
- table.SortByMember(hits, "bounty")
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(l,w)
- BackGround.Paint = function()
- draw.RoundedBox(4,0,0,w,l,Color(186,85,211, 50))
- 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) )
- 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
- end
- local HitList = vgui.Create("DScrollPanel", BackGround)
- HitList:SetPos(0,54)
- HitList:SetSize( w, 456 )
- HitList:SetPadding(15)
- function HitList:LoadHits()
- for k,v in SortedPairs(hits) do
- local HitPanel = vgui.Create("DPanel")
- HitPanel:SetSize(880,80)
- HitPanel.Paint = function()
- draw.RoundedBox(4,0,0,880,80,Color(89,89,89))
- draw.RoundedBox(4,90,43,785,30,Color(255,255,255,50)) -- Description background
- 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) )
- 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) )
- end
- local Icon = vgui.Create("ModelImage", HitPanel)
- Icon:SetPos(8,4)
- Icon:SetSize(70, 70)
- Icon:SetModel(v.ply:GetModel())
- HitList:AddItem(HitPanel)
- HitPanel:Dock( TOP )
- HitPanel:DockMargin( 4, 0, 0, 4 )
- end
- end
- HitList:LoadHits()
- return BackGround
- end
- function zm.UpgradesTab()
- local w = 890
- local l = 520
- local hassuperuranium = LocalPlayer():HasItem("supercharged uranium")
- local NukeMat = Material("vgui/entities/m9k_davy_crockett")
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(l,w)
- BackGround.Paint = function()
- draw.RoundedBox(4,0,0,w,l,Color( 112, 158, 63, 255 ))
- -- draw.RoundedBox(0,0,l*.01,w,l*.085,Color(250,250,250,220))
- 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) )
- if hassuperuranium then
- draw.RoundedBox(4,8,460,w-16,38,Color(0,204,0))
- 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) )
- else
- draw.RoundedBox(4,8,460,w-16,38,Color(89,89,89))
- 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) )
- end
- end
- local UpgradesList = vgui.Create("DHorizontalScroller", BackGround)
- UpgradesList:SetOverlap( -5 )
- UpgradesList:SetPos(5,54)
- UpgradesList:SetSize( w, 400 )
- UpgradesList.Paint = function() end
- //Load all upgrades onto list panel
- for k,v in pairs(LDRP_SH.TableToNumericalKeys(LDRP_SH.CharacterUpgrades)) do
- //local hasupgrade = LocalPlayer():HasItem(string.lower(k.." Upgrade"))
- local DescMarkup = markup.Parse(string.format("<font=Tre22><colour=255, 255, 255, 255>%s</colour></font>",v.desc),210)
- local UpgradePanel = vgui.Create("DPanel")
- UpgradePanel:SetSize(235,400)
- UpgradePanel:SetPos(8 + ((k-1) * 220),5)
- UpgradePanel.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- surface.SetFont("Trebuchet24")
- local tw,th = surface.GetTextSize(v.name)
- 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) )
- DescMarkup:Draw( 20, 195)
- if v.salepct then
- surface.SetFont("Bebas24Font")
- local tw,th = surface.GetTextSize(string.format(v.salepct > 0 and "SALE %i%% OFF" or "NEW UPGRADE",v.salepct))
- tw = (tw + 8)
- 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 )
- end
- end
- local Icon = vgui.Create("DImage", UpgradePanel)
- Icon:SetPos((UpgradePanel:GetWide() / 2) - 75,5)
- Icon:SetSize(150,150)
- Icon:SetImage(v.icon)
- Icon.Shine = vgui.Create("DImage", Icon)
- Icon.Shine:SetImage("fadmin/shine.png")
- Icon.Shine:SetTall(Icon:GetTall())
- Icon.Shine.NextShine = CurTime()
- Icon.Shine.Think = function()
- if CurTime() >= Icon.Shine.NextShine then
- Icon.Shine.NextShine = CurTime() + 4
- Icon.Shine:SetPos(-70,1)
- Icon.Shine.ShineAcross = -70
- end
- if Icon.Shine.ShineAcross < Icon:GetWide() then
- Icon.Shine.ShineAcross = math.Approach( Icon.Shine.ShineAcross, Icon:GetWide(), FrameTime() * 200 )
- Icon.Shine:SetPos(Icon.Shine.ShineAcross, 1)
- else
- Icon.Shine:SetPos(-70,1)
- end
- end
- local price
- if v.salepct then
- local pctoff = ((v.price / 100) * v.salepct)
- price = math.Round(v.price - pctoff)
- else
- price = v.price
- end
- local PurchaseBtn = MakeNiceButton()
- PurchaseBtn:SetParent(UpgradePanel)
- PurchaseBtn:SetText(string.format("Craft $%s",ZARP.formatNumber(price)))
- PurchaseBtn.DoClick = function()
- zm.OpenHiddenTab(zm.UpgradesTab())
- end
- PurchaseBtn:SetPos( ((UpgradePanel:GetWide() / 2) - 100), 350 )
- PurchaseBtn:SetSize( 200, 40 )
- PurchaseBtn:SetImage( "icon16/cart.png" )
- PurchaseBtn.DoClick = function()
- if (LocalPlayer():getDarkRPVar("money") < price) or !hassuperuranium then return end
- 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",
- function() RunConsoleCommand("_CraftUpgrade",k) zm.OpenHiddenTab(zm.InventoryTab()) end, "Cancel", function() end)
- end
- if (LocalPlayer():getDarkRPVar("money") < price) or !hassuperuranium then PurchaseBtn:SetCursor("no") end
- UpgradesList:AddPanel(UpgradePanel)
- end
- return BackGround
- end
- function zm.DailyObjectivesTab()
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(890,520)
- BackGround.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(66,161,255))
- draw.SimpleTextOutlined("Daily Objectives","ZMenuHeader",8,25,Color(255,255,255,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- //Objectives bar bg
- draw.RoundedBox(4,5,43,w - 10,150,Color(0,0,0,200))
- end
- BackGround.PaintOver = function(s,w,h)
- 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)
- end
- //Objective blocks
- local ObjectivesLayout = vgui.Create("DListLayout",BackGround)
- ObjectivesLayout:SetPos(5,43)
- ObjectivesLayout:SetSize(BackGround:GetWide() - 10, 120)
- local objectivescomplete = 0
- for k,v in pairs(ZARP.Objectives or {}) do
- local Objective = ObjectivesLayout:Add("DPanel")
- Objective:SetTall(42)
- Objective:DockMargin( 0, 5, 0, 0 )
- Objective.Paint = function(s,w,h)
- draw.RoundedBox( 4, 5, 3, (h - 3), (h - 3), color_white )
- 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))
- if v > 0 then
- local pct = math.floor((100 / ZARP.DailyObjectives[k].amount)*v)
- 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)
- else
- 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)
- end
- if v >= ZARP.DailyObjectives[k].amount then
- draw.SimpleText("✔","ZMenuHeader",8,1,Color(0,194,97))
- end
- //Diamond reward
- surface.SetFont("Trebuchet24")
- local text = "+$"..string.Comma(ZARP.DailyObjectives[k].reward)
- local tw,th = surface.GetTextSize(text)
- draw.RoundedBox( 4, (w - 5) - (tw + 41), 3, 5 + (tw + 36), (h - 3), Color(0,0,0,150) )
- surface.SetDrawColor(color_white)
- surface.SetMaterial(ZARP.DiamondMaterial)
- surface.DrawTexturedRect( ((w - 5) - (tw + 41)) + 3, 3, (h - 6), (h - 6) )
- 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))
- end
- if v >= ZARP.DailyObjectives[k].amount then
- objectivescomplete = (objectivescomplete+1)
- end
- end
- //Daily objectives target bar
- local TargetBar = vgui.Create("DPanel",BackGround)
- TargetBar:SetPos(5,205)
- TargetBar:SetSize(BackGround:GetWide() - 10,50)
- TargetBar.Paint = function(s,w,h)
- //Daily objectives target bar upper
- draw.RoundedBoxEx( 4, 0, 0, w, 10, Color(0,84,168), true, true, false, false )
- //lower
- draw.RoundedBoxEx( 4, 0, 10, w, h - 10, Color(0,97,194), false, false, true, true )
- end
- TargetBar.PaintOver = function(s,w,h)
- //Day markers
- surface.SetDrawColor(color_white)
- //1 day
- surface.DrawRect( 125 - (5 / 2), 0, 5, h )
- //3 days
- surface.DrawRect( 375 - (5 / 2), 0, 5, h )
- //7 days
- surface.DrawRect( TargetBar:GetWide() - (125 / 3), 0, 5, h )
- end
- TargetBar.ProgressBar = vgui.Create("DPanel",TargetBar)
- TargetBar.ProgressBar:SetPos(0,TargetBar:GetTall() / 4)
- TargetBar.ProgressBar:SetSize(5,TargetBar:GetTall() / 2)
- TargetBar.ProgressBar.Paint = function(s,w,h)
- //upper
- draw.RoundedBoxEx( 4, 0, 0, w, 10, Color(0,168,84), true, true, false, false )
- //lower
- draw.RoundedBoxEx( 4, 0, 10, w, h - 10, Color(0,194,97), false, false, true, true )
- end
- //Day
- local day = ((ZARP.ObjectivesDay or 1) - 1)
- local pixels = (TargetBar:GetWide() / 7)
- local pixelsacross = (day * pixels)
- pixelsacross = pixelsacross + ((pixels / ZARP.DOConfig.MaxObjectives) * objectivescomplete)
- //Progress animate
- TargetBar.ProgressBar:SizeTo( pixelsacross < 5 and 5 or pixelsacross, TargetBar:GetTall() / 2, 1, 0, 1, function() end)
- TargetBar.Shine = vgui.Create("DImage", TargetBar)
- TargetBar.Shine:SetImage("fadmin/shine.png")
- TargetBar.Shine:SetTall(TargetBar:GetTall())
- TargetBar.Shine.NextShine = CurTime()
- TargetBar.Shine.Think = function()
- if CurTime() >= TargetBar.Shine.NextShine then
- TargetBar.Shine.NextShine = CurTime() + 20
- TargetBar.Shine:SetPos(-70,1)
- TargetBar.Shine.ShineAcross = -70
- end
- if TargetBar.Shine.ShineAcross < TargetBar:GetWide() then
- TargetBar.Shine.ShineAcross = math.Approach( TargetBar.Shine.ShineAcross, TargetBar:GetWide(), FrameTime() * 300 )
- TargetBar.Shine:SetPos(TargetBar.Shine.ShineAcross, 1)
- else
- TargetBar.Shine:SetPos(-70,1)
- end
- end
- local wide = ((BackGround:GetWide() - 20) / 3)
- local blocknum = 1
- for k,v in pairs(ZARP.DOConfig.DayRewards) do
- local Block = vgui.Create("DPanel",BackGround)
- Block:SetPos(5 * blocknum + ((blocknum - 1)) * wide, 265)
- Block:SetSize(wide,235)
- Block.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(0,0,0,200))
- //Title
- 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) )
- end
- local RewardLayout = vgui.Create("DListLayout",Block)
- RewardLayout:SetPos(4,25)
- RewardLayout:SetSize(wide - 8, 125)
- for k,v in pairs(v[2]) do
- local Reward = RewardLayout:Add("DPanel")
- Reward:SetPos(25, 2)
- Reward:SetTall((k == 1) and 80 or 40)
- Reward:DockMargin( 0, 3, 0, 0 )
- Reward.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(0,0,0,200))
- surface.SetDrawColor(color_white)
- surface.SetMaterial(v[2])
- surface.DrawTexturedRect( 0,0, h, h )
- 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) )
- end
- end
- blocknum = (blocknum + 1)
- end
- return BackGround
- end
- function CasePopUp(title, message, model, color, key, redeemplatform, gamelink, fireworks)
- local WaitTime = 0
- local WaitForFade = 0
- local FadePanel = vgui.Create("DPanel")
- FadePanel:SetPos(0,0)
- FadePanel:SetSize(ScrW(), ScrH())
- FadePanel.Paint = function()
- if WaitForFade < 240 then
- if (CurTime() >= WaitTime) then
- WaitForFade = WaitForFade + 1
- WaitTime = CurTime() + 0.005
- end
- end
- draw.RoundedBox(0,0,0,ScrW(), ScrH(), Color(0,0,0,WaitForFade))
- end
- local main = vgui.Create("DFrame")
- main:SetSize(450, key and 275 or 250)
- main:Center()
- main:ShowCloseButton(false)
- main:MakePopup()
- main:SetTitle(title)
- main.Paint = function(s,w,h)
- draw.RoundedBox(4, 0, 0, w, h, color)
- draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(55, 100, 5, 100))
- draw.RoundedBox(4, 1, 1, w - 2, 20, Color(10, 30, 10, 150))
- if key then
- draw.DrawText(message, "Tre22", (w/2), 25, Color(255,255,255,255),TEXT_ALIGN_CENTER)
- draw.DrawText("You can activate this key on "..(redeemplatform or "Steam"), "Tre22", (w/2), 43, Color(255,255,255,255),TEXT_ALIGN_CENTER)
- draw.DrawText(key, "Tre22", (w/2), 61, Color(255,255,255,255),TEXT_ALIGN_CENTER)
- 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)
- else
- draw.DrawText(message, "ScoreboardSubtitle", (w/2), 30, Color(255,255,255,255),TEXT_ALIGN_CENTER)
- end
- end
- if model:EndsWith(".png") then
- local icon = vgui.Create("DImage", main)
- icon:SetPos(key and main:GetWide() / 2 -113 or main:GetWide() / 2 -64, key and 85 or 65)
- if key then icon:SetSize(108,108) else icon:SetSize(128, 128) end
- icon:SetImage(model)
- else
- local icon = vgui.Create("DModelPanel", main)
- icon:SetPos(main:GetWide() / 2 -64, 65)
- icon:SetSize(128, 128)
- icon:SetModel(model)
- local PrevMins, PrevMaxs = icon.Entity:GetRenderBounds()
- icon:SetCamPos((PrevMins:Distance(PrevMaxs)*Vector(0.75, 0.75, 0.5)))
- icon:SetLookAt((PrevMaxs + PrevMins)/2)
- icon:SetFOV(50)
- end
- local ContinueBtn = vgui.Create("DButton",main)
- ContinueBtn:SetPos(key and 20 or main:GetWide() / 2 - 100,main:GetTall() - 45)
- ContinueBtn:SetSize(200,40)
- ContinueBtn:SetText("")
- ContinueBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,100)) end
- draw.SimpleTextOutlined("Continue","Trebuchet22",100,20,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- ContinueBtn.DoClick = function()
- main:Close()
- if zm.IsOpen() then zm.OpenHiddenTab(zm.InventoryTab()) end
- end
- if key then
- local KeyBtn = vgui.Create("DButton",main)
- KeyBtn:SetPos(225,main:GetTall() - 45)
- KeyBtn:SetSize(200,40)
- KeyBtn:SetText("")
- KeyBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,100)) end
- 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) )
- end
- KeyBtn.DoClick = function()
- KeyBtn.Copied = true
- SetClipboardText( key )
- end
- local LinkBtn = vgui.Create("DButton",main)
- LinkBtn:SetPos(225,main:GetTall() - 156)
- LinkBtn:SetSize(200,40)
- LinkBtn:SetText("")
- LinkBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- if s:IsHovered() then draw.RoundedBox(4,0,0,w,h,Color(255,255,255,100)) end
- draw.SimpleTextOutlined("View Game","Trebuchet22",100,20,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- LinkBtn.DoClick = function()
- if tonumber(gamelink) then gui.OpenURL(string.format("http://store.steampowered.com/app/%s/",gamelink))
- else gui.OpenURL(gamelink) end
- end
- RunConsoleCommand("jpeg")
- end
- //Fireworks effect
- if fireworks then
- local FireworkMat = Material("effects/yellowflare")
- for i=1,100,1 do
- local Sprite = CreateSprite(FireworkMat)
- Sprite:SetParent(FadePanel)
- Sprite:SetColor(Color(math.random(0, 255), math.random(0, 255), math.random(0, 255)))
- local size = math.random(10,50)
- Sprite:SetSize(size,size)
- local w = (ScrW() / 2)
- local h = (ScrH() / 2)
- Sprite:SetPos(w,h)
- Sprite:ColorTo(Color(math.random(0, 255), math.random(0, 255), math.random(0, 255)),2,0)
- Sprite:SetDrawOnTop(true)
- Sprite:MoveTo( w - (math.random(-100,100)), h + (math.random(-100,100)), math.random(1,1.5), 0, 1, function()
- if not IsValid(Sprite) then return end
- Sprite:ColorTo(Color(255,255,255,0),1,0, function()
- if IsValid(Sprite) then Sprite:Remove() Sprite = nil end
- end)
- end)
- end
- sound.PlayFile( "sound/zarp/eggprize.mp3", "", function() end )
- end
- function main:Close()
- self:Remove()
- FadePanel:Remove()
- end
- end
- function zm.OpenCase(title,color,items,result,key,redeemplatform,gamelink,blueprintcase)
- local w = 890
- local l = 520
- local GenCorpLogo
- local MagikLogo
- local AnimationFinished
- if title == "GenCorp Case" then GenCorpLogo = Material("zarp/gencorp-logo-full.png","smooth noclamp")
- elseif title == "Magik Box" then MagikLogo = Material("zarp/magik-logofull.png","smooth noclamp") end
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(l,w)
- BackGround.Paint = function()
- draw.RoundedBox(4,0,0,w,l,color)
- -- draw.RoundedBox(0,0,l*.01,w,l*.085,Color(250,250,250,220))
- 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) )
- //Opening case bg
- draw.RoundedBox(4,20,274,w - 40,40,Color(89,89,89,AnimationFinished and 255 or 185 + math.sin(RealTime() * 2.5) * 100))
- 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) )
- if GenCorpLogo then
- surface.SetDrawColor(color_white)
- surface.SetMaterial( GenCorpLogo )
- surface.DrawTexturedRect( (BackGround:GetWide() / 2) - (511 / 2), 330, 511, 121 )
- elseif MagikLogo then
- surface.SetDrawColor(color_white)
- surface.SetMaterial( MagikLogo )
- surface.DrawTexturedRect( (BackGround:GetWide() / 2) - (469 / 2), 330, 469, 149 )
- end
- end
- BackGround.OnRemove = function()
- ZARP.SetNewItemLogSuppressed(false)
- end
- local BlueprintsList = vgui.Create("DPanel", BackGround)
- BlueprintsList:SetPos(0,54)
- BlueprintsList:SetSize( w, 210 )
- BlueprintsList.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(89,89,89))
- end
- BlueprintsList.PaintOver = function(s,w,h)
- surface.SetDrawColor(Color(255,214,51))
- surface.DrawRect( (s:GetWide() / 2) - 2.5, 0, 5, s:GetTall() )
- end
- local BW,BH = 200,200
- local function StartCaseOpen(result,endat, name, item, color,key,redeemplatform)
- if not IsValid(BlueprintsList) then return end
- local speed = 7.5 // 5
- local moveamount = endat - (BlueprintsList:GetWide() / 2) + math.random(0,BW - 5)
- local movedamount = 0
- local pixelsmoved = 0
- BlueprintsList.Think = function()
- if (moveamount - movedamount) <= 2000 then //1000
- speed = math.Approach(speed,0.1,FrameTime() * 1.417) //1.27
- end
- for k,v in pairs(BlueprintsList:GetChildren()) do
- if not v.NewX then v.NewX = v:GetPos() end
- v.NewX = math.Approach(v.NewX,-BW,FrameTime() * 100 * speed)
- if v.NewX <= -BW then v:Remove() continue end
- v:SetPos(v.NewX,5)
- end
- pixelsmoved = math.Approach(pixelsmoved,50,FrameTime() * 100 * speed)
- if pixelsmoved >= 50 then
- pixelsmoved = 0
- surface.PlaySound("darkrp/tick.wav")
- end
- movedamount = math.Approach(movedamount,moveamount,FrameTime() * 100 * speed)
- if movedamount >= moveamount then BlueprintsList.Think = nil
- timer.Simple(0.1, function()
- surface.PlaySound("darkrp/levelup3.wav")
- AnimationFinished = true
- ZARP.SetNewItemLogSuppressed(false)
- //Steam Games
- if key then CasePopUp("Congratulations!", "You are the winner of: " .. name, item.icon,color,key,redeemplatform,gamelink,true)
- elseif name:StartWith("$") then CasePopUp("Your Cash Prize!", "You've won a total of " .. name, item.model,color)
- elseif blueprintcase then CasePopUp("Blueprint Unlocked!", "You have unlocked a " .. name .. " Blueprint", item.model,color)
- else CasePopUp("Item Unlocked!", "You have unlocked a " .. name, item.model,color) end
- end)
- end
- end
- end
- //Golden blueprints
- if blueprintcase then
- local iswinner = false
- for k,v in pairs(items) do
- if (v.golden) and (k == result) then iswinner = true continue
- elseif (v.golden) then items[k] = nil end
- end
- if not iswinner then
- for k,v in RandomPairs(LDRP_SH.Blueprints) do if v.golden then items[v.key] = v break end end
- end
- end
- //Load all blueprints onto list panel
- local num = 0
- local endat = 0
- local hasgoldenplueprint
- for i=1,4,1 do
- for k,v in RandomPairs(items) do
- local Blueprint = vgui.Create("DPanel", BlueprintsList)
- Blueprint:SetSize(BW,BH)
- Blueprint:SetPos(5 + (num * 205),5)
- Blueprint.Font = "Trebuchet24"
- if (#v.name > 30) then Blueprint.Font ="Trebuchet18"
- elseif (#v.name > 25) then Blueprint.Font ="Trebuchet20"
- elseif (#v.name > 20) then Blueprint.Font ="Trebuchet22" end
- Blueprint.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(255,255,255,30))
- surface.SetFont(s.Font)
- local w,h = surface.GetTextSize(v.name)
- 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) )
- end
- local Icon = vgui.Create("DImage", Blueprint)
- Icon:SetPos(25,5)
- Icon:SetSize(150,150)
- Icon:SetImage(v.icon)
- if i==3 and (k == result) then endat = 5 + (num * 205) end
- num = (num + 1)
- end
- end
- timer.Simple(0, function()
- surface.PlaySound("doors/vent_open2.wav")
- StartCaseOpen(result,endat,items[result].name,items[result],color,key,redeemplatform)
- end)
- return BackGround
- end
- function zm.IncomingCase(l)
- local casetype = net.ReadUInt(6)
- local result = net.ReadUInt(6)
- if !zm.IsOpen() then zm.Open() end
- if casetype == 1 then
- zm.OpenHiddenTab(zm.OpenCase("Blueprints Case",Color(102,140,255, 150),LDRP_SH.TableToNumericalKeys(LDRP_SH.Blueprints),result,nil,nil,nil,true))
- elseif casetype == 2 then
- zm.OpenHiddenTab(zm.OpenCase("Weapons Case",Color(255,121,77, 150),LDRP_SH.TableToNumericalKeys(LDRP_SH.WeaponsCase),result))
- elseif casetype == 3 then
- zm.OpenHiddenTab(zm.OpenCase("Rares Case",Color(230,115,0),LDRP_SH.TableToNumericalKeys(LDRP_SH.RaresCase),result))
- elseif casetype == 4 then
- zm.OpenHiddenTab(zm.OpenCase("Cash Case",Color(0,158,0),LDRP_SH.TableToNumericalKeys(LDRP_SH.CashCasePrizes),result))
- elseif casetype == 5 then
- zm.OpenHiddenTab(zm.OpenCase("GenCorp Case",Color(66,161,255),LDRP_SH.TableToNumericalKeys(LDRP_SH.GenCorpCase),result))
- elseif casetype == 6 then
- zm.OpenHiddenTab(zm.OpenCase("Magik Box",Color(112,48,160),LDRP_SH.TableToNumericalKeys(LDRP_SH.MagikBoxCase),result))
- end
- end
- net.Receive("OpenCase",zm.IncomingCase)
- function zm.OpenSteamCase(l)
- local result = net.ReadUInt(4)
- local key = net.ReadString()
- local redeemplatform = net.ReadString()
- local gamelink = net.ReadString()
- local games = net.ReadTable()
- local items = {}
- for k,v in ipairs(games) do
- table.insert(items, {name = v, icon = "zarp/steamgame256.png"})
- end
- zm.OpenHiddenTab(zm.OpenCase("Steam Game Case",Color(66,161,255),items,result,key,redeemplatform,gamelink))
- end
- net.Receive("OpenSteamCase",zm.OpenSteamCase)
- local AdventSoundEnabled = true
- function zm.ZARPAdventCalendarTab()
- local CalendarBG = Material("zarp/adventcalendar16-bg.jpg","noclamp smooth")
- local CalendarLogo = Material("zarp/zarpadvent-logo.png","noclamp smooth")
- local AdventSticker = Material("zarp/adventcalendar-sticker.png","noclamp smooth")
- local LightBulbSprite = Material("zarp/advent-lightsprite.png","noclamp smooth")
- local SoundIcon = Material("zarp/slots-summer-soundicon.png","noclamp smooth")
- local SoundMutedIcon = Material("zarp/slots-summer-soundmutedicon.png","noclamp smooth")
- local LightSprite = Material("effects/yellowflare")
- local HasSeenIntro = tobool(cookie.GetString("ZARPAdvent16Intro","false"))
- local ClientData = {}
- for k,v in pairs(string.Explode(";",cookie.GetString("ZARPAdvent16",""))) do
- table.insert(ClientData,tonumber(v))
- end
- 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)},
- {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)}}
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(890,520)
- BackGround.Paint = function(s,w,h)
- surface.SetMaterial(CalendarBG)
- surface.SetDrawColor(color_white)
- surface.DrawTexturedRect( 0,0,w,h )
- //Calendar logo
- if HasSeenIntro then
- surface.SetMaterial(CalendarLogo)
- surface.SetDrawColor(color_white)
- surface.DrawTexturedRect( w - 357,h - 136,302,91 )
- end
- end
- BackGround.PaintOver = function(s,w,h)
- //Light sprites bottom
- for k,v in pairs(LightSprites) do
- surface.SetMaterial(LightBulbSprite)
- surface.SetDrawColor(color_white)
- surface.DrawTexturedRectRotated( v[1],v[2],34,84,v[3] )
- end
- end
- BackGround.OnRemove = function(s,w,h)
- for k,v in pairs(s.Sprites) do
- v:Remove()
- end
- if IsValid(AdventCalendarLoop) then AdventCalendarLoop:Stop() AdventCalendarLoop = nil end
- end
- //Advent play sound
- local function AdventPlaySound(soundfile, vol, loop, pitch, ambienceloop, inplaceloop)
- if not AdventSoundEnabled then return end
- if pitch then sound.Play( soundfile, LocalPlayer():GetPos(), 75, pitch, (vol / 100) ) return end
- sound.PlayFile(soundfile,loop and "noblock" or "", function(chan)
- if IsValid(chan) then
- if loop then
- AdventCalendarLoop = chan
- AdventCalendarLoop:EnableLooping(true)
- end
- chan:SetVolume(vol or 50)
- end
- end)
- end
- AdventPlaySound("sound/darkrp/christmas_loop.mp3", 0.5, true)
- //Create animated light sprites
- BackGround.Sprites = {}
- local function CreateLightSprite(x,y,color)
- local Sprite = CreateSprite(LightSprite)
- Sprite:SetParent(BackGround)
- Sprite:SetColor(color)
- Sprite:SetDrawOnTop(true)
- Sprite:SetSize(150,150)
- Sprite:SetPos(x,y)
- local delay = math.random(1.5,3.5)
- local maxsize = math.random(300,350)
- function Sprite:GlowEffect()
- Sprite:SizeTo( Sprite:GetSize() <= 150 and maxsize or 150, Sprite:GetSize() <= 150 and maxsize or 150, delay, 0, -1, function() Sprite:GlowEffect() end)
- end
- Sprite:GlowEffect()
- //Sprite:SetDrawOnTop(true)
- table.insert(BackGround.Sprites, Sprite)
- end
- for k,v in pairs(LightSprites) do
- CreateLightSprite(v[1],v[2],v[4])
- end
- local date = os.date("!*t",os.time())
- //local date = {month = 12, day = 8}
- local function HasDayPassed(day)
- if (date.month != 12) then return true
- elseif (date.day > day) then return true
- else return false end
- end
- local AdventList = vgui.Create( "DIconLayout",BackGround)
- AdventList:SetSize( 850,490 )
- AdventList:SetPos(45,30)
- AdventList:SetSpaceY(5)
- AdventList:SetSpaceX(5)
- for k,v in pairs(ZARP.AdventCalendar) do
- local AdventDoor = AdventList:Add("DButton")
- AdventDoor:SetSize(110,110)
- AdventDoor.StickerColor = 255
- //AdventDoor:SizeTo( 110, 110, (0.1 * k), 0, 1, function() end )
- AdventDoor:SetText("")
- AdventDoor.Paint = function(s,w,h)
- if !HasSeenIntro then return end
- surface.SetMaterial(v[6] or AdventSticker)
- //surface.SetDrawColor(s:GetDisabled() and Color(128,128,128,200) or color_white)
- if s.DayDone then
- surface.SetDrawColor(Color(77,77,77,200))
- else
- surface.SetDrawColor(Color(255,v[6] and 255 or s.StickerColor,v[6] and 255 or s.StickerColor))
- end
- s.ImageSize = math.Approach(s.ImageSize or 0, w, FrameTime() * 150)
- s.ImagePos = math.Approach(s.ImagePos or 55, 0, FrameTime() * 75)
- 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 )
- if s:IsHovered() then
- s.StickerColor = math.Approach(s.StickerColor, 255, FrameTime() * 400)
- else
- s.StickerColor = math.Approach(s.StickerColor, 51, FrameTime() * 400)
- end
- //surface.SetDrawColor(Color(255,255,255,50))
- //surface.DrawRect( 0,0,w,h )
- if (s.ImageSize >= w) then
- s.TextAlpha = math.Approach(s.TextAlpha or 0, 255, FrameTime() * 300)
- 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) )
- end
- end
- if table.HasValue(ClientData,v[1]) or HasDayPassed(v[1]) then
- AdventDoor:SetCursor("no")
- AdventDoor:SetDisabled(true)
- AdventDoor.DayDone = true
- end
- AdventDoor.DoClick = function()
- if date.day != v[1] then return end
- AdventPlaySound("sound/darkrp/advent_open.wav", 100)
- RunConsoleCommand("_ZARPAdventCalendar", v[1])
- end
- 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
- end
- //Advent calendar intro
- if !HasSeenIntro then
- 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)
- local AdventIntro = vgui.Create("DPanel",BackGround)
- AdventIntro:SetSize(890,520)
- AdventIntro:SetDrawOnTop(true)
- AdventIntro.Paint = function(s,w,h)
- surface.SetDrawColor(Color(77,77,77,240))
- surface.DrawRect(0,0,w,h)
- //Draw logo
- surface.SetMaterial(CalendarLogo)
- surface.SetDrawColor(color_white)
- surface.DrawTexturedRect( (w / 2) - 225,20,450,136)
- if MarkupText then MarkupText:Draw((w / 2) - 300, 161) end
- end
- local IntroConfirmBtn = vgui.Create("DButton",AdventIntro)
- IntroConfirmBtn:SetPos((AdventIntro:GetWide() / 2) - 175, 181 + MarkupText:GetHeight())
- IntroConfirmBtn:SetSize(350,64)
- IntroConfirmBtn:SetText("")
- IntroConfirmBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color( 204,0,0,255 ))
- surface.DrawRect( 0,0,w,h )
- if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
- 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) )
- end
- IntroConfirmBtn.DoClick = function()
- AdventIntro:Remove()
- cookie.Set( "ZARPAdvent16Intro","true")
- HasSeenIntro = true
- end
- end
- local SoundBtn = vgui.Create("DButton",BackGround)
- SoundBtn:SetSize(40,40)
- SoundBtn:SetText("")
- SoundBtn:SetPos(BackGround:GetWide() - 100, BackGround:GetTall() - 45)
- SoundBtn.Paint = function(s,w,h)
- surface.SetMaterial(AdventSoundEnabled and SoundIcon or SoundMutedIcon)
- surface.SetDrawColor(color_white)
- if s:IsDown() then surface.DrawTexturedRect( 2,2,w-4,h-4 )
- else surface.DrawTexturedRect( 0,0,w,h ) end
- end
- SoundBtn.DoClick = function()
- AdventSoundEnabled = !AdventSoundEnabled
- print(AdventSoundEnabled)
- if !AdventSoundEnabled and IsValid(AdventCalendarLoop) then AdventCalendarLoop:Pause()
- elseif IsValid(AdventCalendarLoop) then AdventCalendarLoop:Play() AdventCalendarLoop:SetVolume(0.4) end
- if AdventSoundEnabled and not IsValid(AdventCalendarLoop) then
- AdventPlaySound("sound/darkrp/christmas_loop.mp3", 0.5, false, nil, true)
- end
- end
- return BackGround
- end
- function zm.AdventCalendarOpened(len)
- local day = net.ReadUInt(8)
- if not day then return end
- local adventreward
- for k,v in pairs(ZARP.AdventCalendar) do
- if v[1] == day then adventreward = k end
- end
- cookie.Set("ZARPAdvent16",string.format("%s;%i",cookie.GetString("ZARPAdvent16",""),day))
- local daystring = string.format("ZARP Advent Calendar - December %i%s",day,ZARP.AdventCalendar[adventreward][5])
- 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)
- surface.PlaySound("darkrp/santa1.mp3")
- end
- net.Receive("AdventCalendar",zm.AdventCalendarOpened)
- local LDRP = {}
- function LDRP.OpenItemOptions(item)
- if LocalPlayer().Inventory[item] then
- local WepNames = LDRP_SH.NicerWepNames
- local OptionsMenu = vgui.Create("DFrame")
- OptionsMenu:SetPos(-200, ScrH()*.5-80)
- OptionsMenu:MakePopup()
- OptionsMenu:SetSize(200, 284)
- OptionsMenu:MoveTo(ScrW()*.5-100,ScrH()*.5-80,.3)
- local Tbl = LDRP_SH.AllItems[item]
- OptionsMenu.Paint = function(s,w,h)
- draw.RoundedBox(6,0,0,w,h,Color(50,50,50,180))
- local name = WepNames[Tbl.nicename] or Tbl.nicename
- 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) )
- end
- OptionsMenu:SetTitle("")
- OptionsMenu.MakeClose = function()
- OptionsMenu:MoveTo(ScrW(),ScrH()*.5-80,.3)
- timer.Simple(.3,function()
- if OptionsMenu:IsValid() then OptionsMenu:Close() end
- end)
- end
- local counter
- local UseButton = vgui.Create("DButton",OptionsMenu)
- UseButton:SetPos(4,30)
- UseButton:SetSize(192,32)
- UseButton:SetText(Tbl.usename or "Use")
- if Tbl.cuse then
- UseButton.DoClick = function()
- if counter:GetValue() != 1 then
- local name = WepNames[Tbl.nicename] or Tbl.nicename
- Derma_Query("Are you sure you want to use "..(counter and math.Round(counter:GetValue()) or "").." ".. name.."(s)", "Confirm Usage" , "Yes", function()
- RunConsoleCommand("_inven","use",item, counter:GetValue()) OptionsMenu.MakeClose() end, "No", function() OptionsMenu.MakeClose() end)
- return
- end
- if (Tbl.usename == "Open Case") then ZARP.SetNewItemLogSuppressed(true) end
- RunConsoleCommand("_inven","use",item, counter:GetValue())
- OptionsMenu.MakeClose()
- end
- else
- UseButton:SetDisabled(true)
- end
- local DropButton = vgui.Create("DButton",OptionsMenu)
- DropButton:SetPos(4,66)
- DropButton:SetSize(192,32)
- DropButton:SetText("Drop")
- DropButton.DoClick = function()
- if (item == "nuclear equipment") and ZARP.NukeConfig then
- local notenoughplayers,notenoughcops
- local numcops = 0
- for k,v in pairs(player.GetAll()) do if v:IsCP() then numcops = (numcops + 1) end end
- if (#player.GetAll() < ZARP.NukeConfig.MinPlayers) then notenoughplayers = true
- elseif (numcops < ZARP.NukeConfig.MinCops) then notenoughcops = true end
- if notenoughplayers or notenoughcops then
- 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()
- RunConsoleCommand("_inven","drop",item)
- OptionsMenu.MakeClose()
- end, "Cancel", function() OptionsMenu.MakeClose() end)
- else
- RunConsoleCommand("_inven","drop",item)
- OptionsMenu.MakeClose()
- end
- else
- RunConsoleCommand("_inven","drop",item)
- OptionsMenu.MakeClose()
- end
- end
- if Tbl.nodrop then DropButton:SetDisabled(true) end
- //Convert to gems
- local gemsvalue = ZARP.GetItemGemValue(item)
- local GemsButton = vgui.Create("DButton",OptionsMenu)
- GemsButton:SetPos(4,102)
- GemsButton:SetSize(192,32)
- GemsButton:SetText(string.format("Convert to Gems (%s Gems)",ZARP.formatNumber(gemsvalue or 0)))
- GemsButton.DoClick = function()
- local am = IsValid(counter) and counter:GetValue() or 1
- 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()
- RunConsoleCommand("_inven","gems",item,am) if IsValid(OptionsMenu) then OptionsMenu.MakeClose() end end, "Cancel", function() if IsValid(OptionsMenu) then OptionsMenu.MakeClose() end end)
- end
- if not gemsvalue then GemsButton:SetDisabled(true) end
- //Auction item
- local AuctionButton = vgui.Create("DButton",OptionsMenu)
- AuctionButton:SetPos(4,138)
- AuctionButton:SetSize(192,32)
- AuctionButton:SetText("Auction Item")
- AuctionButton.DoClick = function()
- OptionsMenu.MakeClose()
- local name = WepNames[Tbl.nicename] or Tbl.nicename
- local AuctionFrame = vgui.Create("DFrame")
- AuctionFrame:SetSize(200,223)
- AuctionFrame:Center()
- AuctionFrame:MakePopup()
- AuctionFrame:SetTitle("")
- AuctionFrame.Paint = function(s,w,h)
- draw.RoundedBox(6,0,0,w,h,Color(50,50,50,180))
- draw.SimpleTextOutlined(name,"Trebuchet20",100,14,Color(255,255,255,200),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- end
- local StartLbl = vgui.Create("DLabel",AuctionFrame)
- StartLbl:SetPos(4,27)
- StartLbl:SetText("Start Price ($):")
- StartLbl:SizeToContents()
- local StartPrice = vgui.Create("DNumberWang",AuctionFrame)
- StartPrice:SetPos(4,30 + StartLbl:GetTall())
- StartPrice:SetSize(192,32)
- StartPrice:SetText(10000)
- StartPrice:SetMinMax(10000,1000000000)
- local MinIncrLbl = vgui.Create("DLabel",AuctionFrame)
- MinIncrLbl:SetPos(4,80)
- MinIncrLbl:SetText("Minimum Increment ($):")
- MinIncrLbl:SizeToContents()
- local MinIncr = vgui.Create("DNumberWang",AuctionFrame)
- MinIncr:SetPos(4,84 + MinIncrLbl:GetTall())
- MinIncr:SetSize(192,32)
- MinIncr:SetText(1000)
- MinIncr:SetMinMax(1000,1000000)
- local LengthLbl = vgui.Create("DLabel",AuctionFrame)
- LengthLbl:SetPos(4,133)
- LengthLbl:SetText("Auction Length:")
- LengthLbl:SizeToContents()
- local Length = vgui.Create("DComboBox",AuctionFrame)
- Length:SetPos(4,137 + MinIncrLbl:GetTall())
- Length:SetSize(192,32)
- for k,v in pairs(LDRP_SH.AuctionLengths) do
- Length:AddChoice(v[1],k,k==1)
- end
- local Submit = vgui.Create("DButton",AuctionFrame)
- Submit:SetPos(4,186)
- Submit:SetSize(192,32)
- Submit:SetText("Auction Item")
- Submit.DoClick = function(s)
- if (StartPrice:GetValue() > StartPrice:GetMax()) or (StartPrice:GetValue() < StartPrice:GetMin()) then
- Derma_Message(string.format("Auction Start Price must be between: ($%i-$%i)",StartPrice:GetMin(),StartPrice:GetMax()),"Auction Error")
- elseif (MinIncr:GetValue() > MinIncr:GetMax()) or (MinIncr:GetValue() < MinIncr:GetMin()) then
- Derma_Message(string.format("Minimum Increment must be between: ($%i-$%i)",MinIncr:GetMin(),MinIncr:GetMax()),"Auction Error")
- else
- RunConsoleCommand("_listauctionitem",item,StartPrice:GetValue(),MinIncr:GetValue(),Length:GetSelectedID())
- AuctionFrame:Close()
- //zm.Close()
- end
- end
- end
- if table.HasValue(LDRP_SH.AuctionItemBlacklist, item) then AuctionButton:SetDisabled(true) end
- local BankButton = vgui.Create("DButton",OptionsMenu)
- BankButton:SetPos(4,174)
- BankButton:SetSize(192,32)
- BankButton:SetText("Bank Item ")
- BankButton.DoClick = function()
- ZARP.ShopItemOptions(item,"bank","Put in bank") OptionsMenu.MakeClose()
- end
- local SendToButton = vgui.Create("DButton",OptionsMenu)
- SendToButton:SetPos(4,210)
- SendToButton:SetSize(192,32)
- SendToButton:SetText("Gift Item to Player")
- SendToButton.DoClick = function()
- local name = WepNames[Tbl.nicename] or Tbl.nicename
- local playermenu = DermaMenu(SendToButton)
- for k,v in pairs(player.GetAll()) do
- if (v != LocalPlayer()) then playermenu:AddOption(v:Nick(), function()
- 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()
- RunConsoleCommand("_inven", "gift",item, counter:GetValue(), v:UserID()) OptionsMenu.MakeClose() end, "Cancel", function() OptionsMenu.MakeClose() end)
- end) end
- end
- playermenu:Open()
- end
- local RemoveButton = vgui.Create("DButton",OptionsMenu)
- RemoveButton:SetPos(4,246)
- RemoveButton:SetSize(192,32)
- RemoveButton:SetText("Remove")
- RemoveButton.DoClick = function()
- local name = WepNames[Tbl.nicename] or Tbl.nicename
- Derma_Query("Are you sure you want to remove "..(counter and math.Round(counter:GetValue()) or "").." ".. name.. "(s) " .."?", "Confirm Action" , "Yes", function()
- RunConsoleCommand("_inven", "delete",item, counter:GetValue()) OptionsMenu.MakeClose() end, "Cancel", function() OptionsMenu.MakeClose() end)
- end
- counter = vgui.Create("DNumSlider",OptionsMenu)
- counter:SetPos(4,275)
- counter:SetWidth(180)
- counter:SizeToContents()
- counter:SetText("How Many?")
- counter:SetMax(LocalPlayer().Inventory[item])
- counter:SetMin(1)
- counter:SetMax(LocalPlayer().Inventory[item])
- counter:SetDecimals(0)
- counter:SetValue(1)
- counter:SetVisible(false)
- if Tbl.multiuse then OptionsMenu:SetSize(200, OptionsMenu:GetTall() + 27) counter:SetVisible(true)
- if gemsvalue then
- counter.OnValueChanged = function(s,num)
- local num = math.Round(num)
- GemsButton:SetText(string.format("Convert to Gems (%s Gems)",ZARP.formatNumber((gemsvalue or 0) * num)))
- end
- end
- end
- end
- end
- function zm.InventoryTab()
- local WepNames = LDRP_SH.NicerWepNames
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetPos(4,4)
- BackGround:SetSize(890,520)
- BackGround.Paint = function(s,w,h)
- local InvWeight = 0
- for k,v in pairs(LocalPlayer().Inventory or {}) do
- if v >= 1 then
- InvWeight = InvWeight+(LDRP_SH.AllItems[k].weight*v)
- end
- end
- draw.RoundedBox(6,0,0,w,h,Color(55, 100, 5, 150))
- -- draw.RoundedBox(0,0,l*.01,w,l*.085,Color(250,250,250,220))
- 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) )
- 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) )
- end
- local ItemList = vgui.Create("DPanelList",BackGround)
- ItemList:SetPos(4,56)
- ItemList:SetSize(880,436)
- ItemList:SetPadding(4)
- ItemList:SetSpacing(4)
- ItemList:EnableVerticalScrollbar(true)
- ItemList:EnableHorizontal(true)
- ItemList.Paint = function()
- draw.RoundedBox(6,0,0,880,436,Color(250,250,250,220))
- end
- local CurIcons = {}
- 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
- for k,v in pairs(LocalPlayer().Inventory or {}) do
- local Check = CurIcons[k]
- if Check then
- if Check.am != v or v <= 0 then
- local ItemTbl = LDRP_SH.AllItems[k]
- if !ItemTbl then continue end
- if v <= 0 then
- ItemList:RemoveItem(Check.vgui)
- CurIcons[k] = nil
- else
- Check.vgui:SetToolTip(ItemTbl.nicename .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
- CurIcons[k].am = v
- end
- end
- elseif v > 0 then
- local ItemTbl = LDRP_SH.AllItems[k]
- if !ItemTbl then continue end
- local ItemIcon = CreateIcon(ItemList,ItemTbl.mdl,78,78,function() LDRP.OpenItemOptions(k) end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,k)
- CurIcons[k] = {["vgui"] = ItemIcon,["am"] = v}
- local Namez = WepNames[ItemTbl.nicename] or ItemTbl.nicename
- ItemIcon:SetToolTip(Namez .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
- ItemList:AddItem(ItemIcon)
- end
- end
- end
- //New items panel
- local NewItemsLog = vgui.Create("DPanel",BackGround)
- NewItemsLog:SetPos(0,BackGround:GetTall() - 108)
- NewItemsLog:SetSize(BackGround:GetWide(),108)
- NewItemsLog.Paint = function(s,w,h)
- draw.RoundedBox(6,0,0,w,h,Color(55, 100, 5,225))
- 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) )
- end
- local CurItemsLog = {}
- local NewItemLogList = vgui.Create( "DHorizontalScroller",NewItemsLog )
- NewItemLogList:SetOverlap(-3)
- NewItemLogList:SetSize(567,78)
- NewItemLogList:SetPos(5,25)
- NewItemLogList.Think = function(s,w,h)
- for k,v in pairs(LocalPlayer().NewItemsLog) do
- if !CurItemsLog[k] then
- local ItemTbl = LDRP_SH.AllItems[k]
- if !ItemTbl then continue end
- local ItemIcon = CreateIcon(NewItemLogList,ItemTbl.mdl,78,78,function() end,nil,nil,ItemTbl.clr,ItemTbl.mat,ItemTbl.blueprint,k)
- ItemIcon.ID = k
- ItemIcon.ItemAmount = v
- local Namez = WepNames[ItemTbl.nicename] or ItemTbl.nicename
- ItemIcon:SetToolTip(Namez .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
- CurItemsLog[k] = ItemIcon
- NewItemLogList:AddPanel(ItemIcon)
- end
- end
- for k,v in pairs(CurItemsLog) do
- if !LocalPlayer().NewItemsLog[v.ID] then
- table.RemoveByValue(NewItemLogList.Panels, v)
- CurItemsLog[k] = nil
- v:Remove()
- v = nil
- NewItemLogList:InvalidateLayout(true)
- continue
- else
- v.ItemAmount = LocalPlayer().NewItemsLog[v.ID]
- end
- end
- end
- local ConfirmLogBtn = vgui.Create("DButton",NewItemsLog)
- ConfirmLogBtn:SetPos(610, 48)
- ConfirmLogBtn:SetSize(250,32)
- ConfirmLogBtn:SetText("")
- ConfirmLogBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(0,179,45))
- 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 )
- 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
- 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) )
- end
- ConfirmLogBtn.DoClick = function()
- LocalPlayer().NewItemsLog = {}
- NewItemsLog:SetVisible(false)
- end
- NewItemsLog:SetVisible(false)
- BackGround.Think = function()
- ItemList:Update()
- if ZARP.GetNumberNewItemsInLog() >= 1 and !NewItemsLog:IsVisible() then
- NewItemsLog:SetVisible(true)
- end
- end
- return BackGround
- end
- function zm.PremiumTab()
- local EntitiesPanel = vgui.Create("DPanelList")
- EntitiesPanel:EnableVerticalScrollbar( true )
- EntitiesPanel:SetSpacing(10)
- function EntitiesPanel:Update()
- self:Clear(true)
- local BuyTitle = vgui.Create("DPanel")
- BuyTitle:SetSize(0,43)
- BuyTitle.Paint = function()
- draw.RoundedBox(4,0,0, BuyTitle:GetWide() - 8, BuyTitle:GetTall(), Color(30,30,30,150))
- 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))
- end
- local BuyPanel = vgui.Create("DPanel")
- BuyPanel:SetSize(0,60)
- BuyPanel.Paint = function()
- draw.RoundedBox(4,0,0, BuyPanel:GetWide() - 8, BuyPanel:GetTall(), Color(55, 100, 5,150))
- 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))
- draw.SimpleTextOutlined(vipmenutext1, "KonthHUD2", 10 , 30, Color(73, 180, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color(0,0,0,255))
- end
- EntitiesPanel:AddItem( BuyTitle )
- EntitiesPanel:AddItem( BuyPanel )
- local prodname
- local price
- local duration
- local textColor
- local material
- local clickurl
- material = Material ("vip-iconzarp.png")
- if not (LocalPlayer():IsZarpVIP()) then
- prodname = "Zarp VIP"
- duration = "Permanent"
- price = " $19.95"
- clickurl = "http://zarpgaming.com/index.php/zarp-vip"
- vipmenutext = "Upgrade to ZARP VIP today!"
- vipmenutext1 = "Help support our servers plus get instant access to loads of extra features and and benefits."
- textColor = Color(255, 209, 72, 255)
- else
- prodname = "Zarp VIP (Purchased)"
- duration = "Permanent"
- price = "Paid for"
- clickurl = "http://zarpgaming.com/index.php/zarp-vip"
- vipmenutext = "ZARP VIP is active!"
- vipmenutext1 = "If you need help or support please contact an admin or post in the forum for the speediest reply."
- textColor = Color(0,255,0,255)
- end
- local BuyButton = vgui.Create( "DButton" )
- BuyButton:SetSize( 250, 80 )
- BuyButton:SetText("")
- BuyButton.Paint = function(s)
- draw.RoundedBox(4,0,0, BuyButton:GetWide() - 8, BuyButton:GetTall(), Color(13, 120, 185, 100))
- draw.RoundedBox(4,2,2, BuyButton:GetWide() - 8 - 4, BuyButton:GetTall() / 2, Color(13, 120, 185, 100))
- draw.SimpleTextOutlined("ZarpGaming - "..prodname , "KonthHUD2", (BuyButton:GetWide() - 8) / 2, 15, textColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
- 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))
- 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))
- surface.SetDrawColor(255, 255, 255, 700)
- surface.SetMaterial( material )
- surface.DrawTexturedRect( 16, 8, 24, 24 )
- if s:IsHovered() then
- draw.RoundedBox(4,0,0, BuyButton:GetWide() - 8, BuyButton:GetTall(), Color(0, 0, 0, 75))
- end
- end
- BuyButton.DoClick = function()
- gui.OpenURL(clickurl)
- end
- EntitiesPanel:AddItem( BuyButton )
- local purchased = LocalPlayer().DarkRPVars.PurchasedBoosters or 0
- local claimed = LocalPlayer().DarkRPVars.Boosters or 0
- local BoosterBtn = vgui.Create( "DButton" )
- BoosterBtn:SetSize( 250, 80 )
- BoosterBtn:SetText("")
- BoosterBtn.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0, w - 8, h, Color(0,230,57))
- draw.RoundedBox(4,2,2, w - 8 - 4, h / 2, Color(0,204,51))
- draw.SimpleTextOutlined("ZarpGaming - Booster Pack" , "KonthHUD2", (w - 8) / 2, 15, textColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
- if purchased >= 1 then
- 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))
- if purchased > claimed then
- 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))
- else
- 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))
- end
- else
- 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))
- 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))
- end
- surface.SetDrawColor(255, 255, 255, 700)
- surface.SetMaterial( material )
- surface.DrawTexturedRect( 16, 8, 24, 24 )
- if s:IsHovered() then
- draw.RoundedBox(4,0,0, w - 8, h, Color(0, 0, 0, 75))
- end
- end
- if (claimed == purchased) then
- BoosterBtn.DoClick = function() gui.OpenURL("http://zarpgaming.com/index.php/zarp-vip/booster-pack") end
- else
- BoosterBtn.DoClick = function() RunConsoleCommand("_ClaimBoosterPacks") zm.Close() end
- end
- EntitiesPanel:AddItem( BoosterBtn )
- end
- EntitiesPanel:Update()
- return EntitiesPanel
- end
- function zm.VaultTab()
- if not ZARP.VaultConfig or not ZARP.VaultConfig.Positions[string.lower(game.GetMap())] then return end
- local w = 890
- local l = 520
- local vaultdata = ZARP.VaultConfig.Positions[string.lower(game.GetMap())]
- local entsfound = ents.FindInBox(vaultdata.vaultmin, vaultdata.vaultmax)
- local isinvault = LocalPlayer():GetActiveWeapon() and table.HasValue(entsfound,LocalPlayer():GetActiveWeapon())
- if LocalPlayer():IsCP() then isinvault = false end
- local BackGround = vgui.Create("DPanel",F4Menu)
- BackGround:SetSize(l,w)
- BackGround.Paint = function()
- draw.RoundedBox(4,0,0,w,l,Color(13, 120, 185, 100))
- 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) )
- end
- local BankList = vgui.Create("DScrollPanel", BackGround)
- BankList:SetPos(0,54)
- BankList:SetSize( w, 456 )
- BankList:SetPadding(15)
- function BankList:Update()
- self:Clear(true)
- local BuyPanel = vgui.Create("DPanel")
- BuyPanel:SetSize(0,100)
- BuyPanel.Paint = function()
- draw.RoundedBox(4,0,0, BuyPanel:GetWide() - 8, BuyPanel:GetTall(), Color(255,255,255,30))
- 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))
- 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))
- 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))
- end
- BuyPanel:Dock( TOP )
- BuyPanel:DockMargin( 8, 0, 0, 4 )
- BankList:AddItem( BuyPanel )
- local VaultLogo = Material("zarp/vault32.png","noclamp smooth")
- local BuyButton = vgui.Create( "DButton" )
- BuyButton:SetSize( 250, 80 )
- BuyButton:SetText("")
- BuyButton.Paint = function()
- draw.RoundedBox(4,0,0, BuyButton:GetWide() - 8, BuyButton:GetTall(), Color(89,89,89))
- draw.RoundedBox(4,2,2, BuyButton:GetWide() - 8 - 4, BuyButton:GetTall() / 2, Color(128,128,128))
- 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))
- 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))
- 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))
- surface.SetDrawColor(255, 255, 255, 255)
- surface.SetMaterial( VaultLogo )
- surface.DrawTexturedRect( 16, 8, 24, 24 )
- end
- if !isinvault then BuyButton:SetCursor("no") end
- BuyButton.DoClick = function()
- if isinvault then RunConsoleCommand("_StartVaultRobbery") end
- end
- local PlayersLbl = vgui.Create("DLabel")
- PlayersLbl:SetSize(0,100)
- PlayersLbl:SetFont("KonthHUD2")
- if isinvault then
- local playerstext
- local numinvault = 0
- for k,v in pairs(ents.FindInBox(vaultdata.vaultmin,vaultdata.vaultmax)) do
- if v:IsPlayer() and v:Alive() then
- numinvault = (numinvault) + 1
- if not playerstext then playerstext = "Players: " .. v:Nick()
- else playerstext = playerstext .. "," .. v:Nick() end
- end
- end
- if numinvault >= 1 then
- PlayersLbl:SetText(string.format("You and %i other(s) are inside the vault.",
- numinvault))
- PlayersLbl:SetTooltip(playerstext)
- else
- PlayersLbl:SetText("You are the only one inside the vault.")
- end
- else PlayersLbl:SetVisible(false) end
- PlayersLbl.Paint = function()
- draw.RoundedBox(4,0,0, BuyButton:GetWide() - 8, BuyButton:GetTall(), Color(255,255,255,30))
- end
- PlayersLbl:SizeToContents()
- BuyButton:Dock( TOP )
- BuyButton:DockMargin( 8, 0, 0, 4 )
- BankList:AddItem( BuyButton )
- PlayersLbl:Dock( TOP )
- PlayersLbl:DockMargin( 8, 0, 0, 4 )
- BankList:AddItem( PlayersLbl )
- local vaultent = ents.FindByClass("zarp_vault")[1]
- if vaultent then
- local VaultLbl = vgui.Create("DLabel")
- surface.SetFont("ZMenuHeader")
- local cashtext = string.format("Cash: $%s",ZARP.formatNumber(vaultent:GetNWInt("cash")))
- local casestext = string.format("Cases: %s",ZARP.formatNumber(vaultent:GetNWInt("cases")))
- local w,h = surface.GetTextSize(cashtext)
- local cw,ch = surface.GetTextSize(casestext)
- VaultLbl:SetText("")
- VaultLbl:SetSize(cw + w, h)
- VaultLbl.Paint = function(s)
- local start = (s:GetWide() / 2) - ((w + cw) / 2)
- draw.WordBox( 0, start, 0, cashtext, "ZMenuHeader", Color(0,204,0,50), color_white )
- draw.WordBox( 0, start + w, 0, casestext, "ZMenuHeader", Color(102,140,255, 150,50), color_white )
- end
- VaultLbl:Dock( TOP )
- VaultLbl:DockMargin( 8, 0, 0, 4 )
- BankList:AddItem( VaultLbl )
- end
- end
- BankList:Update()
- return BackGround
- end
- function zm.BankTab()
- local BackGround = vgui.Create("EditablePanel")
- BackGround:MakePopup()
- BackGround:SetSize(890,520)
- BackGround.Paint = function(s,w,h)
- //draw.RoundedBox(4,0,0,w,h,Color(66,161,255))
- //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) )
- end
- BackGround.Think = function()
- if input.IsKeyDown(zm.key) then zm.Close() end
- end
- local welcometext
- local dayhour = os.date("*t",os.time()).hour
- if dayhour >= 6 and dayhour <= 11 then welcometext = "Good morning, %s."
- elseif dayhour >= 12 and dayhour <= 17 then welcometext = "Good afternoon, %s."
- else welcometext = "Good evening, %s." end
- welcometext = string.format(welcometext, LocalPlayer():Nick())
- local BankPanel = vgui.Create("DPanel",BackGround)
- BankPanel:SetSize(443,520)
- BankPanel.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(204,0,0,100))
- 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) )
- //draw.SimpleTextOutlined(welcometext, "KonthHUD2", w / 2 , 55, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color(0,0,0,255))
- end
- //Account area panel
- local BankLogo = Material("zarp/bank-logo.png","smooth noclamp")
- local AccountPanel = vgui.Create("DPanel",BankPanel)
- AccountPanel:SetPos(2,40)
- AccountPanel:SetSize(439,150)
- AccountPanel.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
- surface.SetDrawColor(255, 255, 255, 255)
- surface.SetMaterial( BankLogo )
- surface.DrawTexturedRect( 5, 17.5, 115, 115 )
- end
- local AccountDetailsPanel = vgui.Create("DPanel",AccountPanel)
- AccountDetailsPanel:SetPos(123, 18)
- AccountDetailsPanel:SetSize(AccountPanel:GetWide() - 126, 132)
- AccountDetailsPanel.Paint = function(s,w,h)
- draw.SimpleTextOutlined(welcometext, "Tre20", w / 2 , -3, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0,0,0,255))
- 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) )
- 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))
- draw.RoundedBox( 0, 15, 47, (w - 30), 30, Color(89,89,89,150) )
- 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))
- 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))
- 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))
- end
- local DepositPanel = vgui.Create("DPanel",BankPanel)
- DepositPanel:SetPos(2,193)
- DepositPanel:SetSize(439,40)
- DepositPanel.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
- end
- local DepositLbl = vgui.Create("DLabel",DepositPanel)
- DepositLbl:SetPos(3, 9)
- DepositLbl:SetFont("Tre22")
- DepositLbl:SetColor(color_white)
- DepositLbl:SetText("Deposit Funds ($):")
- DepositLbl:SizeToContents()
- local DepositAmount = vgui.Create("DNumberWang",DepositPanel)
- DepositAmount:SetPos(160, 4)
- DepositAmount:SetSize(140,32)
- DepositAmount:SetFont("Tre22")
- DepositAmount:SetText(1000)
- DepositAmount:SetMinMax(1,LocalPlayer().DarkRPVars.money)
- local DepositBtn = vgui.Create("DButton",DepositPanel)
- DepositBtn:SetPos(303, 4)
- DepositBtn:SetSize(100,32)
- DepositBtn:SetText("")
- DepositBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(179,0,0))
- surface.DrawRect( 0,0,w,h )
- if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
- draw.SimpleTextOutlined("Deposit","Tre22",50,16,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- DepositBtn.Think = function()
- if (LocalPlayer().DarkRPVars.money < DepositAmount:GetValue()) then DepositBtn:SetDisabled(true) DepositBtn:SetToolTip("You can not afford that.")
- else DepositBtn:SetDisabled(false) DepositBtn:SetToolTip(nil) end
- end
- DepositBtn.DoClick = function()
- RunConsoleCommand("_bnk","money",-DepositAmount:GetValue())
- end
- local WithdrawPanel = vgui.Create("DPanel",BankPanel)
- WithdrawPanel:SetPos(2,236)
- WithdrawPanel:SetSize(439,40)
- WithdrawPanel.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
- end
- local WithdrawLbl = vgui.Create("DLabel",WithdrawPanel)
- WithdrawLbl:SetPos(3, 9)
- WithdrawLbl:SetFont("Tre22")
- WithdrawLbl:SetColor(color_white)
- WithdrawLbl:SetText("Withdraw Funds ($):")
- WithdrawLbl:SizeToContents()
- local WithdrawAmount = vgui.Create("DNumberWang",WithdrawPanel)
- WithdrawAmount:SetPos(160, 4)
- WithdrawAmount:SetSize(140,32)
- WithdrawAmount:SetFont("Tre22")
- WithdrawAmount:SetText(1000)
- WithdrawAmount:SetMinMax(1,LocalPlayer().Bank["curcash"] or 0)
- local WithdrawBtn = vgui.Create("DButton",WithdrawPanel)
- WithdrawBtn:SetPos(303, 4)
- WithdrawBtn:SetSize(100,32)
- WithdrawBtn:SetText("")
- WithdrawBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(179,0,0))
- surface.DrawRect( 0,0,w,h )
- if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
- draw.SimpleTextOutlined("Withdraw","Tre22",50,16,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER, 2, Color(0,0,0,200) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- WithdrawBtn.Think = function()
- 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.")
- elseif ((LocalPlayer().Bank["curcash"] or 0) < WithdrawAmount:GetValue()) then WithdrawBtn:SetDisabled(true) WithdrawBtn:SetToolTip("Your available balance is not enough.")
- else WithdrawBtn:SetDisabled(false) WithdrawBtn:SetToolTip(nil) end
- end
- WithdrawBtn.DoClick = function()
- RunConsoleCommand("_bnk","money",WithdrawAmount:GetValue())
- end
- 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)
- local UpgradePanel = vgui.Create("DPanel",BankPanel)
- UpgradePanel:SetPos(2,279)
- UpgradePanel:SetSize(439,163)
- UpgradePanel.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
- draw.SimpleTextOutlined("Upgrade Your Account", "KonthHUD2", w / 2 , 3, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0,0,0,255))
- upgradetext:Draw(20, 25)
- end
- local BalanceLbl = vgui.Create("DLabel",UpgradePanel)
- BalanceLbl:SetPos(3, 65)
- BalanceLbl:SetFont("Tre22")
- BalanceLbl:SetColor(color_white)
- BalanceLbl.Think = function(s)
- s:SetText(string.format("Current Balance: $%s",string.Comma(LocalPlayer().Bank["curcash"] or 0)))
- s:SizeToContents()
- end
- local UpgradeLbl = vgui.Create("DLabel",UpgradePanel)
- UpgradeLbl:SetPos(3, 95)
- UpgradeLbl:SetFont("Tre22")
- UpgradeLbl:SetColor(color_white)
- UpgradeLbl:SetText("New Account:")
- UpgradeLbl:SizeToContents()
- local AccountsList = vgui.Create("DComboBox",UpgradePanel)
- AccountsList:SetPos(120,91)
- AccountsList:SetSize(315,32)
- AccountsList:SetValue("Select One")
- AccountsList:SetSortItems(false)
- for k,v in pairs(LDRP_SH.TableToNumericalKeys(LDRP_SH.BankAccounts)) do
- AccountsList:AddChoice(string.format("%s (min: $%s)",v.type,string.Comma(v.min)),v.name)
- end
- local AdditionalDepositLbl = vgui.Create("DLabel",UpgradePanel)
- AdditionalDepositLbl:SetPos(3, 130)
- AdditionalDepositLbl:SetFont("Tre22")
- AdditionalDepositLbl:SetColor(color_white)
- AdditionalDepositLbl:SetText("Deposit ($):")
- AdditionalDepositLbl:SizeToContents()
- local AdditionalDepositAmount = vgui.Create("DNumberWang",UpgradePanel)
- AdditionalDepositAmount:SetPos(120, 126)
- AdditionalDepositAmount:SetSize(140,32)
- AdditionalDepositAmount:SetFont("Tre22")
- AdditionalDepositAmount:SetText(1000)
- AdditionalDepositAmount:SetMinMax(1000,LocalPlayer().DarkRPVars.money)
- AdditionalDepositAmount:SetFont("Tre22")
- local UpgradeBtn = vgui.Create("DButton",UpgradePanel)
- UpgradeBtn:SetPos(123 + AdditionalDepositAmount:GetWide(), 126)
- UpgradeBtn:SetSize(150,32)
- UpgradeBtn:SetText("")
- UpgradeBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(179,0,0))
- surface.DrawRect( 0,0,w,h )
- if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
- 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) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- UpgradeBtn.Think = function()
- local selected,id = AccountsList:GetSelected()
- if not selected then UpgradeBtn:SetDisabled(true) UpgradeBtn:SetToolTip("You must select an account type.")
- 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.")
- 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)))
- else UpgradeBtn:SetDisabled(false) UpgradeBtn:SetToolTip(nil) end
- end
- UpgradeBtn.DoClick = function()
- local selected,id = AccountsList:GetSelected()
- RunConsoleCommand("_bnk","upgrade",AdditionalDepositAmount:GetValue(),id)
- AccountsList.selected = nil
- AccountsList:SetValue("Select One")
- end
- local InterestPanel = vgui.Create("DPanel",BankPanel)
- InterestPanel:SetPos(2,445)
- InterestPanel:SetSize(439,40)
- InterestPanel.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(255,255,255,50))
- end
- local InterestLbl = vgui.Create("DLabel",InterestPanel)
- InterestLbl:SetPos(3, 9)
- InterestLbl:SetFont("Tre22")
- InterestLbl:SetColor(color_white)
- InterestLbl:SetText("Daily Interest:")
- InterestLbl:SizeToContents()
- local InterestBtn = vgui.Create("DButton",InterestPanel)
- InterestBtn:SetPos(145, 4)
- InterestBtn:SetSize(AccountDetailsPanel:GetWide() - 30,32)
- InterestBtn:SetText("")
- InterestBtn.Paint = function(s,w,h)
- surface.SetDrawColor(Color(179,0,0))
- surface.DrawRect( 0,0,w,h )
- if s:IsHovered() then surface.SetDrawColor(Color(255,255,255,30)) surface.DrawRect( 0,0,w,h ) end
- 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
- 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) )
- if s:GetDisabled() then
- surface.SetDrawColor(Color(100,100,100,240))
- surface.DrawRect( 0,0,w,h )
- end
- end
- InterestBtn.Think = function()
- 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
- if (dailyinterest <= 0) then InterestBtn:SetDisabled(true) InterestBtn:SetToolTip("You have no interest to collect.")
- elseif (LocalPlayer():getDarkRPVar("NextInterest") or 0) > ZARP.UTCTime() then InterestBtn:SetDisabled(true) InterestBtn:SetToolTip("You can collect your interest again tomorrow.")
- else InterestBtn:SetDisabled(false) InterestBtn:SetToolTip(nil) end
- end
- InterestBtn.DoClick = function()
- RunConsoleCommand("_bnk","interest",1)
- end
- 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)
- local SafetyDepositPanel = vgui.Create("DPanel",BackGround)
- SafetyDepositPanel:SetPos(447,0)
- SafetyDepositPanel:SetSize(443,520)
- SafetyDepositPanel.Paint = function(s,w,h)
- draw.RoundedBox(4,0,0,w,h,Color(66,161,255,100))
- 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) )
- //safetydeposittext:Draw(15, 40)
- //Bank weight
- local BankWeight = 0
- for k,v in pairs(LocalPlayer().Bank) do
- if k == "curcash" then continue end
- if v and v >= 1 then
- BankWeight = BankWeight+(LDRP_SH.AllItems[k].weight*v)
- end
- end
- 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) )
- end
- local WepNames = LDRP_SH.NicerWepNames
- local BankItemsList = vgui.Create("DPanelList",SafetyDepositPanel)
- BankItemsList:SetPos(3, 40)
- BankItemsList:SetSize(437,447)
- BankItemsList:SetPadding(10)
- BankItemsList:SetSpacing(5)
- BankItemsList:EnableVerticalScrollbar(true)
- BankItemsList:EnableHorizontal(true)
- BankItemsList.Paint = function(s)
- local x, y = s:GetWide() - 1, s:GetTall() - 1
- surface.SetDrawColor( 0, 0, 0, 255)
- surface.DrawLine( 0, 0, x, 0 )
- surface.DrawLine( 0, 0, 0, y )
- surface.DrawLine( x, 0, x, y + 1 )
- surface.DrawLine( 0, y, x, y )
- draw.RoundedBox(0, 1, 1, s:GetWide() - 2, s:GetTall() - 2, Color(30, 30, 30, 200))
- end
- local CurIcons = {}
- function BankItemsList:Think()
- for k,v in pairs(LocalPlayer().Bank) do
- if k == "curcash" then continue end
- local Check = CurIcons[k]
- if Check then
- if Check.am != v or v <= 0 then
- local ItemTbl = LDRP_SH.AllItems[k]
- if !ItemTbl then continue end
- if v <= 0 then
- BankItemsList:RemoveItem(Check.vgui)
- CurIcons[k] = nil
- else
- local Namez = WepNames[ItemTbl.nicename] or ItemTbl.nicename
- Check.vgui:SetToolTip(Namez .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
- CurIcons[k].am = v
- end
- end
- elseif v > 0 then
- local ItemTbl = LDRP_SH.AllItems[k]
- if !ItemTbl then continue end
- 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)
- CurIcons[k] = {["vgui"] = ItemIcon,["am"] = v}
- local Namez = WepNames[ItemTbl.nicename] or ItemTbl.nicename
- ItemIcon:SetToolTip(Namez .. "\n" .. ItemTbl.descr .. "\nAmount: " .. v .. "\nWeight: " .. ItemTbl.weight)
- BankItemsList:AddItem(ItemIcon)
- end
- end
- end
- return BackGround
- end
- local NiceNames = LDRP_SH.NicerWepNames
- function zm.CraftingTab()
- local CraftingList = vgui.Create("DPanelList")
- CraftingList:EnableVerticalScrollbar(true)
- CraftingList:SetPadding(4)
- CraftingList:SetSpacing(4)
- local IcoSize = 64
- local RW,RH = 900,70
- local Selected
- for k,v in pairs(LDRP_SH.TableToNumericalKeys(LDRP_SH.CraftItems)) do
- local Recipe = vgui.Create("DPanel")
- Recipe:SetSize(RW,RH)
- local Str
- local num = 0
- for c,b in pairs(v.recipe) do
- num = num+1
- if Str then
- Str = Str .. ", " .. b .. " " .. (NiceNames[c] or c)
- else
- Str = b .. " " .. (NiceNames[c] or c)
- end
- end
- Recipe.Paint = function(s)
- draw.RoundedBox( 0, 0, 0, Recipe:GetWide() , RH, v.specialcolor or Color(150, 150, 150, 100))
- 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) )
- 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) )
- 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) )
- local x, y = s:GetWide() - 1, s:GetTall() - 1
- surface.SetDrawColor( 0, 0, 0, 255)
- surface.DrawLine( 0, 0, x, 0 )
- surface.DrawLine( 0, 0, 0, y )
- surface.DrawLine( x, 0, x, y + 1 )
- surface.DrawLine( 0, y, x, y )
- if v.specialcolor then
- draw.WordBox( 6, s:GetWide() - 110, 15, "LIMITED TIME", "Bebas24Font", Color(51,102,255), color_white )
- end
- end
- local Icon
- if v.icon then
- Icon = vgui.Create("SpawnIcon",Recipe)
- Icon:SetModel(v.icon)
- else
- Icon = vgui.Create("DImageButton",Recipe)
- Icon:SetImage(v.imageicon)
- end
- Icon:SetPos(4,4)
- Icon:SetSize(IcoSize, IcoSize)
- Icon.OnCursorEntered = function() return false end
- Icon:SetToolTip()
- Icon.OnMousePressed = function() return false end
- local InvisButton = vgui.Create("DButton",Recipe)
- InvisButton:SetSize(RW,RH)
- InvisButton:SetDrawBackground(false)
- InvisButton.DoClick = function()
- local least
- if LocalPlayer().Inventory then
- for k,v in pairs(v.recipe) do
- local cancraft = (LocalPlayer().Inventory[k] or 0) / v
- if not least then least = cancraft end
- if cancraft < least then least = cancraft end
- end
- end
- Selected = v.name
- local CraftMenu = DermaMenu(InvisButton)
- CraftMenu:AddOption( "Craft 1", function() RunConsoleCommand("__crft",Selected) end )
- if least >= 5 then CraftMenu:AddOption( "Craft 5", function() RunConsoleCommand("__crft",Selected,5) end) end
- if least >= 10 then CraftMenu:AddOption( "Craft 10", function() RunConsoleCommand("__crft",Selected,10) end) end
- if least >= 25 then CraftMenu:AddOption( "Craft 25", function() RunConsoleCommand("__crft",Selected,25) end) end
- if least >= 50 then CraftMenu:AddOption( "Craft 50", function() RunConsoleCommand("__crft",Selected,50) end) end
- CraftMenu:AddOption( "Cancel", function() end )
- CraftMenu:Open()
- end
- InvisButton.OnCursorEntered = function()
- Hovered = v.name
- end
- InvisButton.OnCursorExited = function()
- Hovered = nil
- end
- InvisButton:SetText("")
- CraftingList:AddItem(Recipe)
- end
- return CraftingList
- end
- -- Category configuration
- zm.categories =
- {
- {
- title = "ACTIONS",
- color = Color( 30, 30, 30, 250 ),
- icon = "icon16/star.png",
- func = zm.Actions
- },
- {
- title = "JOBS",
- color = Color( 30, 30, 30, 250 ),
- icon = "icon16/user_suit.png",
- func = zm.Jobs
- },
- {
- title = "SHOP",
- color = Color( 30, 30, 30, 250 ),
- icon = "icon16/cart.png",
- func = zm.Shop
- },
- {
- title = "SKILLS",
- color = Color( 30, 30, 30, 250 ),
- icon = "icon16/chart_bar.png",
- func = zm.SkillsTab
- },
- {
- title = "Crafting",
- color = Color( 30, 30, 30, 250 ),
- icon = "icon16/bricks.png",
- func = zm.CraftingTab
- },
- {
- title = "Gangs",
- color = Color( 30, 30, 30, 250 ),
- icon = "icon16/user_gray.png",
- func = zm.GangsTab
- },
- {
- title = "Inventory",
- color = Color( 30, 30, 30, 250 ),
- icon = "icon16/box.png",
- func = zm.InventoryTab,
- inventory = true
- },
- {
- title = "DONATE",
- color = Color( 30, 30, 30, 250 ),
- icon = "icon16/award_star_silver_2.png",
- func = zm.PremiumTab
- }
- }
- concommand.Add( "+zarp_rpmenu", zm.Open )
- concommand.Add( "-zarp_rpmenu", zm.Close )
Add Comment
Please, Sign In to add comment