if SERVER then AddCSLuaFile() return end local F4Menu local CUR = 1 local VoteVGUI = {} local QuestionVGUI = {} local PanelNum = 0 local LetterWritePanel local function MsgDoVote(msg) local _, chatY = chat.GetChatBoxPos() local question = msg:ReadString() local voteid = msg:ReadShort() local timeleft = msg:ReadFloat() if timeleft == 0 then timeleft = 100 end local OldTime = CurTime() if not IsValid(LocalPlayer()) then return end -- Sent right before player initialisation LocalPlayer():EmitSound("Town.d1_town_02_elevbell1", 100, 100) local panel = vgui.Create("DFrame") panel:SetPos(3 + PanelNum, chatY - 145) panel:SetTitle("Vote") panel:SetSize(160, 140) panel:SetSizable(false) panel.btnClose:SetVisible(false) panel:SetDraggable(false) panel.Paint = function() draw.RoundedBox( 14, 0, 0, panel:GetWide(), panel:GetTall(), Color( 0, 0, 0, 160 ) ) end function panel:Close() PanelNum = PanelNum - 140 VoteVGUI[voteid .. "vote"] = nil local num = 0 for k,v in SortedPairs(VoteVGUI) do v:SetPos(num, ScrH() / 2 - 50) num = num + 140 end for k,v in SortedPairs(QuestionVGUI) do v:SetPos(num, ScrH() / 2 - 50) num = num + 300 end self:Remove() end function panel:Think() self:SetTitle("Time: ".. tostring(math.Clamp(math.ceil(timeleft - (CurTime() - OldTime)), 0, 9999))) if timeleft - (CurTime() - OldTime) <= 0 then panel:Close() end end panel:SetKeyboardInputEnabled(false) panel:SetMouseInputEnabled(true) panel:SetVisible(true) for i = 22, string.len(question), 22 do if not string.find(string.sub(question, i - 20, i), "\n", 1, true) then question = string.sub(question, 1, i) .. "\n".. string.sub(question, i + 1, string.len(question)) end end local label = vgui.Create("DLabel") label:SetParent(panel) label:SetPos(5, 25) label:SetText(question) label:SizeToContents() label:SetVisible(true) local nextHeight = label:GetTall() > 78 and label:GetTall() - 78 or 0 // make panel taller for divider and buttons panel:SetTall(panel:GetTall() + nextHeight) local divider = vgui.Create("Divider") divider:SetParent(panel) divider:SetPos(2, panel:GetTall() - 30) divider:SetSize(180, 2) divider:SetVisible(true) local ybutton = vgui.Create("Button") ybutton:SetParent(panel) ybutton:SetPos(10, panel:GetTall() - 25) ybutton:SetSize(40, 20) ybutton:SetCommand("!") ybutton:SetText("Yes") ybutton:SetTextColor(Color(255,255,255)) ybutton:SetFont("BankFont") ybutton:SetVisible(true) ybutton.Paint = function() draw.RoundedBox( 0, 0, 0, 190, 40, Color( 0, 0, 0, 255 )) draw.RoundedBox( 0, 2, 2, 184, 34, Color( 0, 190, 0, 200 )) end ybutton.DoClick = function() LocalPlayer():ConCommand("vote " .. voteid .. " yea\n") panel:Close() end local nbutton = vgui.Create("Button") nbutton:SetParent(panel) nbutton:SetPos(70, panel:GetTall() - 25) nbutton:SetSize(40, 20) nbutton:SetCommand("!") nbutton:SetText("No") nbutton:SetTextColor(Color(255,255,255)) nbutton:SetFont("BankFont") nbutton:SetVisible(true) nbutton.Paint = function() draw.RoundedBox( 0, 0, 0, 190, 40, Color( 0, 0, 0, 255 )) draw.RoundedBox( 0, 2, 2, 186, 36, Color( 200, 0, 0, 200 )) end nbutton.DoClick = function() LocalPlayer():ConCommand("vote " .. voteid .. " nay\n") panel:Close() end PanelNum = PanelNum + 140 VoteVGUI[voteid .. "vote"] = panel panel:SetSkin(GAMEMODE.Config.DarkRPSkin) end usermessage.Hook("DoVote", MsgDoVote) local function KillVoteVGUI(msg) local id = msg:ReadShort() if VoteVGUI[id .. "vote"] and VoteVGUI[id .. "vote"]:IsValid() then VoteVGUI[id.."vote"]:Close() end end usermessage.Hook("KillVoteVGUI", KillVoteVGUI) local function MsgDoQuestion(msg) local question = msg:ReadString() local quesid = msg:ReadString() local timeleft = msg:ReadFloat() if timeleft == 0 then timeleft = 100 end local OldTime = CurTime() LocalPlayer():EmitSound("Town.d1_town_02_elevbell1", 100, 100) local panel = vgui.Create("DFrame") panel:SetPos(3 + PanelNum, ScrH() / 2 - 50)--Times 140 because if the quesion is the second screen, the first screen is always a vote screen. panel:SetSize(300, 140) panel:SetSizable(false) panel.btnClose:SetVisible(false) panel:SetKeyboardInputEnabled(false) panel:SetMouseInputEnabled(true) panel:SetVisible(true) function panel:Close() PanelNum = PanelNum - 300 QuestionVGUI[quesid .. "ques"] = nil local num = 0 for k,v in SortedPairs(VoteVGUI) do v:SetPos(num, ScrH() / 2 - 50) num = num + 140 end for k,v in SortedPairs(QuestionVGUI) do v:SetPos(num, ScrH() / 2 - 50) num = num + 300 end self:Remove() end function panel:Think() self:SetTitle("Time: ".. tostring(math.Clamp(math.ceil(timeleft - (CurTime() - OldTime)), 0, 9999))) if timeleft - (CurTime() - OldTime) <= 0 then panel:Close() end end local label = vgui.Create("DLabel") label:SetParent(panel) label:SetPos(5, 30) label:SetSize(380, 40) label:SetText(question) label:SetVisible(true) local divider = vgui.Create("Divider") divider:SetParent(panel) divider:SetPos(2, 80) divider:SetSize(380, 2) divider:SetVisible(true) local ybutton = vgui.Create("DButton") ybutton:SetParent(panel) ybutton:SetPos(105, 100) ybutton:SetSize(40, 20) ybutton:SetText("Yes") ybutton:SetVisible(true) ybutton.DoClick = function() LocalPlayer():ConCommand("ans " .. quesid .. " 1\n") panel:Close() end local nbutton = vgui.Create("DButton") nbutton:SetParent(panel) nbutton:SetPos(155, 100) nbutton:SetSize(40, 20) nbutton:SetText("No") nbutton:SetVisible(true) nbutton.DoClick = function() LocalPlayer():ConCommand("ans " .. quesid .. " 2\n") panel:Close() end PanelNum = PanelNum + 300 QuestionVGUI[quesid .. "ques"] = panel panel:SetSkin(GAMEMODE.Config.DarkRPSkin) end usermessage.Hook("DoQuestion", MsgDoQuestion) local function KillQuestionVGUI(msg) local id = msg:ReadString() if QuestionVGUI[id .. "ques"] and QuestionVGUI[id .. "ques"]:IsValid() then QuestionVGUI[id .. "ques"]:Close() end end usermessage.Hook("KillQuestionVGUI", KillQuestionVGUI) local function DoVoteAnswerQuestion(ply, cmd, args) if not args[1] then return end local vote = 0 if tonumber(args[1]) == 1 or string.lower(args[1]) == "yes" or string.lower(args[1]) == "true" then vote = 1 end for k,v in pairs(VoteVGUI) do if ValidPanel(v) then local ID = string.sub(k, 1, -5) VoteVGUI[k]:Close() RunConsoleCommand("vote", ID, vote) return end end for k,v in pairs(QuestionVGUI) do if ValidPanel(v) then local ID = string.sub(k, 1, -5) QuestionVGUI[k]:Close() RunConsoleCommand("ans", ID, vote) return end end end concommand.Add("rp_vote", DoVoteAnswerQuestion) local function DoLetter(msg) LetterWritePanel = vgui.Create("Frame") LetterWritePanel:SetPos(ScrW() / 2 - 75, ScrH() / 2 - 100) LetterWritePanel:SetSize(150, 200) LetterWritePanel:SetMouseInputEnabled(true) LetterWritePanel:SetKeyboardInputEnabled(true) LetterWritePanel:SetVisible(true) end usermessage.Hook("DoLetter", DoLetter) //Modify this local Colors = { //Main menu F4MenuBackground = Color(0,0,0,255), F4MenuBorder = Color(200,0,0,0), LogoCardBackground = Color(200,0,0,0), LogoCardTop = Color(255,255,255), LogoCardBottom = Color(255,255,255), CanvasBackground = Color(140,0,0,150), //Actions tab ButtonBackground = Color(155,155,155,255), ButtonText = Color(255,255,255,255), CategoryBackground = Color(0,0,0,0), //Jobs tab JobOutlineHover = Color(255,255,255), JobOutlinePressed = Color(10,10,255), //Shop tab ShopItemBackground = Color(201,201,201,255), ShopDescriptionBackground = Color(0,0,0,200), //Shared between tabs TabActive = Color(100,100,100,245), TabInactive = Color(100,100,100,255), TabTitleFront = Color(255,255,255,255), TabTitleShadow = Color(0,0,0,0), } local Texts = { //Menu LogoCardTop = ' MTG', LogoCardBottom = '', //Tab titles ActionsTabTitle = 'Commands', JobsTabTitle = 'Jobs', ShopTabTitle = 'Shop', DonateTabTitle = 'In-Game Store', ForumTabTitle = 'Forum', CloseTab = 'Close', AdminTab = 'Admin', //Some localizations DescriptionTitle = 'Description:', WeaponsNone = "This job has no weapons.", WeaponsSpecial = "Weapons:", CurrentTeam = 'Current: ', //Some system settings - no modifications needed, really TabTitleFont = 'F4TabTitle', ButtonFont = 'DermaDefaultBold', DarkRPCommand = 'say', } local Materials = { GradientNormal = Material('gui/gradient'), GradientUp = Material('gui/gradient_up'), GradientDown = Material('gui/gradient_down'), GradientCenter = Material('gui/center_gradient'), ActionsButton = Material('icon16/star.png'), JobsButton = Material('icon16/user_suit.png'), ShopButton = Material('icon16/cart.png'), ForumButton = Material('icon16/group.png'), DonateButton = Material('icon16/award_star_gold_3.png'), AdminButton = Material('gui/silkicons/shield'), CloseButton = Material('icon16/delete.png'), } //Command workaround local function RunCmd(...) local arg = {...} if Texts.DarkRPCommand:lower():find('say') then arg = table.concat(arg,' ') else arg = table.concat(arg,'" "') end RunConsoleCommand(Texts.DarkRPCommand,arg) end //This is what creates the layout local function CreateMenu() if F4Menu and IsValid(F4Menu) then F4Menu:Remove() end local LogoCard,Canvas,TopBar local ActionsButton,ActionsTab local JobsButton,JobsTab local ShopButton,ShopTab --local AdminButton,AdminTab local DonateButton,DonateTab F4Menu = vgui.Create('DFrame') F4Menu:SetSize(1000,600) F4Menu:Center() F4Menu:MakePopup() F4Menu:ShowCloseButton(true) F4Menu.btnMaxim:SetVisible( false ) F4Menu.btnMinim:SetVisible( false ) F4Menu:SetDeleteOnClose(false) F4Menu:ParentToHUD() F4Menu:SetDraggable(false) F4Menu:SetSizable(false) F4Menu:SetTitle('') F4Menu.Tabs = {} function F4Menu:OpenTab(Button) if Button == nil then if self.OpenedTab and self.OpenedTab:IsValid() then Button = self.OpenedTab else Button = table.GetFirstKey(self.Tabs) end end if self.Tabs[Button] and IsValid(self.Tabs[Button]) then self.OpenedTab = Button for k,v in pairs(self.Tabs) do k.Toggled = false v:SetVisible(false) end self.Tabs[Button]:SetVisible(true) self.Tabs[Button]:Refresh() Button.Toggled = true end end function F4Menu:Paint(w,h) surface.SetDrawColor(Colors.F4MenuBackground) surface.DrawRect(1,0,w,h) surface.SetDrawColor(Colors.F4MenuBorder) surface.DrawOutlinedRect(4,0,w,h) draw.RoundedBox(4, 148, 12, 146,41, Color(190, 0,0, 250)) draw.RoundedBox(4, 317, 12, 146,41, Color(190, 0,0, 250)) draw.RoundedBox(4, 485, 12, 146,41, Color(190, 0,0, 250)) end LogoCard = vgui.Create('DPanel',F4Menu) LogoCard:SetPos(5,5) LogoCard:SetSize(185,70) function LogoCard:Paint(w,h) draw.RoundedBox(4,0,0,w,h,Colors.LogoCardBackground) draw.SimpleText(Texts.LogoCardTop,'DermaLarge',5,5,Colors.LogoCardTop) draw.SimpleText(Texts.LogoCardBottom,'ChatFont',5,35,Colors.LogoCardBottom) end F4Menu.LogoCard = LogoCard Canvas = vgui.Create('DPanel',F4Menu) Canvas:SetPos(10,LogoCard.y+LogoCard:GetTall()-8) Canvas:SetSize(F4Menu:GetWide()-20,F4Menu:GetTall()-75) function Canvas:Paint(w,h) draw.RoundedBox(0,0,0,w,h,Colors.CanvasBackground) end F4Menu.Canvas = Canvas end //Options stuff local function CreateButton(w,text,icon,doclick) text = tostring(text) w = tonumber(w) or 2 icon = icon and Material(icon) or false doclick = doclick or function()end w = w*470 + (w-1)*5 local button = vgui.Create('DButton') button:SetSize(w,25) button.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Colors.ButtonBackground) draw.RoundedBox(4,0,0,w,h,Colors.ButtonBackground) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawOutlinedRect( 0, 0, 945, 25 ) if icon then surface.SetDrawColor(Color(255,255,255,255)) surface.SetMaterial(icon) surface.DrawTexturedRect(12,h/2-8,16,16) draw.SimpleText(text,Texts.ButtonFont,12+w/2,h/2,Colors.ButtonText,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) else draw.SimpleText(text,Texts.ButtonFont,w/2,h/2,Colors.ButtonText,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) end return true end button.DoClick = doclick return button end local function GetOptions(type,col) type = tostring(type) col = col or Color(0,0,0,0) local Actions = vgui.Create("DPanelList") Actions:SetAutoSize(true) Actions:SetPadding(10) Actions:SetSpacing(5) Actions:EnableHorizontal(true) local Category = vgui.Create("DCollapsibleCategory") Category:SetLabel(type) Category:SetContents(Actions) Category.Paint = function(self,w,h) draw.RoundedBox(0,0,0,w,h,col) draw.RoundedBox(0,10,0,140,25,Color(150,150,150,250)) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawOutlinedRect( 10, 0, 140, 25 ) end if type == 'general' then Category:SetLabel(' General') Actions:AddItem(CreateButton(2, "Give Money", 'icon16/money_dollar.png', function() Derma_StringRequest("Amount of money", "How much money do you want to give?", "", function(a) RunCmd("/give", tostring(a)) end) end)) Actions:AddItem(CreateButton(2, "Drop Money", 'icon16/money.png', function() Derma_StringRequest("Amount of money", "How much money do you want to drop?", "", function(a) RunCmd("/dropmoney", tostring(a)) end) end)) Actions:AddItem(CreateButton(2, string.format("Buy Health $"..tostring(GAMEMODE.Config.healthcost)), 'icon16/heart.png', function() RunCmd("/buyhealth") end)) Actions:AddItem(CreateButton(2, "Drop Weapon", 'icon16/box.png', function() RunCmd("/drop") end)) elseif type == 'roleplay' then Category:SetLabel(' Roleplay actions') Actions:AddItem(CreateButton(2, 'Custom Job Title', 'icon16/vcard_edit.png', function() Derma_StringRequest("Job title", "What do you want to change your job title to?", LocalPlayer().DarkRPVars.job or "", function(a) RunCmd("/job", tostring(a)) end) end)) Actions:AddItem(CreateButton(2, 'Change Name', 'icon16/vcard_edit.png', function() Derma_StringRequest("Roleplay name", "What do you want to change your roleplay name to?", LocalPlayer():Name() or "", function(a) RunCmd("/rpname", tostring(a)) end) end)) Actions:AddItem(CreateButton(2, 'Demote A Player', 'icon16/user_delete.png', function() local menu = DermaMenu() for _,ply in pairs(player.GetAll()) do if ply ~= LocalPlayer() then menu:AddOption(ply:Nick(), function() Derma_StringRequest("Demote reason", "Why would you demote "..ply:Nick().."?", nil,function(a)RunCmd("/demote", tostring(ply:UserID()).." ".. a)end, function() end ) end) end end menu:Open() end)) Actions:AddItem(CreateButton(2, 'Sell All Doors', 'icon16/book_delete.png', function() RunCmd("/unownalldoors") end)) elseif type == 'police' then Category:SetLabel(' Police') Actions:AddItem(CreateButton(2, 'Request Warrant', 'icon16/script_error.png', function() local menu = DermaMenu() for _,ply in pairs(player.GetAll()) do if ply ~= LocalPlayer() then menu:AddOption(ply:Nick(), function() Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil,function(a)RunCmd("/warrant", tostring(ply:UserID()).." ".. a)end, function() end ) end) end end menu:Open() end)) Actions:AddItem(CreateButton(2, 'Make Wanted', 'icon16/group_error.png', function() local menu = DermaMenu() for _,ply in pairs(player.GetAll()) do if ply ~= LocalPlayer() then menu:AddOption(ply:Nick(), function() Derma_StringRequest("Warrant", "Why would you make "..ply:Nick().." wanted?", nil,function(a)RunCmd("/wanted", tostring(ply:UserID()).." ".. a)end, function() end ) end) end end menu:Open() end)) Actions:AddItem(CreateButton(2, 'Remove Wanted', 'icon16/group_add.png', function() local menu = DermaMenu() for _,ply in pairs(player.GetAll()) do if ply ~= LocalPlayer() then menu:AddOption(ply:Nick(), function() RunCmd("/unwanted", tostring(ply:UserID())) end) end end menu:Open() end)) if LocalPlayer():Team() == TEAM_CHIEF or LocalPlayer():IsAdmin() then Actions:AddItem(CreateButton(2, 'Set Jail Position', 'icon16/accept.png', function() RunCmd("/setjailpos") end)) Actions:AddItem(CreateButton(2, 'Add Jail Position', 'icon16/add.png', function() RunCmd("/addjailpos") end)) end elseif type == 'mayor' then Category:SetLabel(' Mayor') Actions:AddItem(CreateButton(2, 'Initiate lockdown', 'icon16/bell_add.png', function() RunCmd("/lockdown") end)) Actions:AddItem(CreateButton(2, 'Stop Lockdown', 'icon16/bell_delete.png', function() RunCmd("/unlockdown") end)) Actions:AddItem(CreateButton(2, 'Initiate Lottery', 'icon16/money.png', function() RunCmd("/lottery") end)) Actions:AddItem(CreateButton(2, 'Place Law Board', 'icon16/application.png', function() RunCmd("/placelaws") end)) Actions:AddItem(CreateButton(2, 'Add Law', 'icon16/application_add.png', function() Derma_StringRequest("Add a law", "Type the law you would like to add here.", "", function(law) RunCmd("/addlaw ", law) end) end)) Actions:AddItem(CreateButton(2, 'Remove Law', 'icon16/application_delete.png', function() Derma_StringRequest("Remove a law", "Enter the number of the law you would like to remove here.", "", function(num) RunCmd("/removelaw", num) end) end)) Actions:AddItem(CreateButton(2, 'Grant Gun license', 'icon16/application.png', function() LocalPlayer():ConCommand("darkrp /givelicense") end)) elseif type == 'mobboss' then local Team = LocalPlayer():Team() Category:SetLabel(' Mob boss') Actions:AddItem(CreateButton(2, 'Set Agenda', 'icon16/application_view_detail.png', function() Derma_StringRequest("Set agenda", "What text would you like to change agenda to?", LocalPlayer().DarkRPVars.agenda or "", function(a) RunCmd("/agenda", tostring(a)) end) end)) end return Category end //Stuff related to teams local function GetDescription(team) local Team = RPExtraTeams[team] if !Team then return false end local description = Texts.DescriptionTitle description = description.."\n"..Team.description description = description.."\n\n" local weps = "" if #Team.weapons > 0 then weps = Texts.WeaponsSpecial for k,v in pairs(Team.weapons) do local class = weapons.Get(v) if class then weps = weps.."\n "..(class.PrintName or v) end end else weps = Texts.WeaponsNone end description = description..weps return description end local function GetDisplayTeam(team) local Team = RPExtraTeams[team] if !Team then return false end Team = table.Copy(Team) if LocalPlayer():Team() == team then Team.name = Texts.CurrentTeam..Team.name end Team.desc_full = GetDescription(team) if type(Team.model) == "table" then Team.model = table.Random(Team.model) end Team.team = team return Team end //Tabs stuff local function AddActionsTab() local ActionList local ActionsButton = vgui.Create('DButton',F4Menu) ActionsButton:SetPos(151,F4Menu.Canvas.y-52) ActionsButton:SetSize(140,35) ActionsButton.Icon = Materials.ActionsButton ActionsButton.Text = Texts.ActionsTabTitle ActionsButton.DoClick = function(self) F4Menu:OpenTab(self) end ActionsButton.Paint = function(self,w,h) if self.Toggled then ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabActive,true,true) else ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabInactive,true,true) end surface.SetDrawColor(Color(255,255,255,255)) surface.SetMaterial(self.Icon) surface.DrawTexturedRect(12,ry+rh/2-8,16,16) draw.SimpleText(self.Text,Texts.TabTitleFont,40+3,ry+rh/2+3,Colors.TabTitleShadow,nil,TEXT_ALIGN_CENTER) draw.SimpleText(self.Text,Texts.TabTitleFont,40,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER) return true end local ActionsTab = vgui.Create('DPanel',F4Menu.Canvas) ActionsTab:SetSize(F4Menu.Canvas:GetSize()) ActionsTab.Paint = function()end ActionsTab.Refresh = function(self) ActionList:Clear() ActionList:AddItem(GetOptions('general')) ActionList:AddItem(GetOptions('roleplay')) local team = LocalPlayer():Team() if team == TEAM_MAYOR then ActionList:AddItem(GetOptions('mayor')) ActionList:AddItem(GetOptions('police')) elseif table.HasValue({TEAM_SECRETS, TEAM_CHIEF, TEAM_POLICE, TEAM_MAYOR, TEAM_SWAT, TEAM_SPEC, TEAM_CHIEFPLUS, TEAM_SWATPLUS, TEAM_POLICEPLUS},LocalPlayer():Team()) then ActionList:AddItem(GetOptions('police')) elseif team == TEAM_MOB or team == TEAM_BDL then ActionList:AddItem(GetOptions('mobboss')) end end ActionList = vgui.Create('DPanelList',ActionsTab) ActionList:SetPos(5,5) ActionList:SetSize(ActionsTab:GetWide()-10,ActionsTab:GetTall()-10) ActionList:EnableVerticalScrollbar(true) ActionList:SetSpacing(5) F4Menu.Tabs[ActionsButton] = ActionsTab F4Menu:OpenTab(ActionsButton) return ActionsButton end local function AddJobsTab() local JobList,JobPreview,JobsTab,JobsButton JobsButton = vgui.Create('DButton',F4Menu) JobsButton:SetPos(320,F4Menu.Canvas.y-52) JobsButton:SetSize(140,35) JobsButton.Icon = Materials.JobsButton JobsButton.Text = Texts.JobsTabTitle JobsButton.DoClick = function(self) F4Menu:OpenTab(self) end JobsButton.Paint = function(self,w,h) local ry,rh if self.Toggled then ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabActive,true,true) else ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabInactive,true,true) end surface.SetDrawColor(Color(255,255,255,255)) surface.SetMaterial(self.Icon) surface.DrawTexturedRect(12,ry+rh/2-8,16,16) draw.SimpleText(self.Text,Texts.TabTitleFont,55+3,ry+rh/2+3,Colors.TabTitleShadow,nil,TEXT_ALIGN_CENTER) draw.SimpleText(self.Text,Texts.TabTitleFont,55,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER) return true end local PAINT_JOB = function(self,w,h) draw.RoundedBox(4,0,0,w,h,self.m_colText) if self.Hovered then draw.RoundedBox(4,4,4,w-8,h-8,!self.Depressed and Colors.JobOutlineHover or Colors.JobOutlinePressed) draw.RoundedBox(4,6,6,w-12,h-12,self.m_colText) end draw.SimpleText(self:GetText(),Texts.TabTitleFont,70,h/2,nil,nil,TEXT_ALIGN_CENTER) return true end local DOCLICK_JOB = function(self,x,y) local Team = JobPreview.Team local Model = RPExtraTeams[Team.team] Model = Model.model local function DoChatCommand(frame) if Team.vote then local menu = DermaMenu() menu:AddOption("Vote", function() RunCmd("/vote"..Team.command) frame:Close() end) menu:AddOption("Do not vote", function() RunCmd("/"..Team.command) frame:Close() end) menu:Open() else RunCmd("/"..Team.command) frame:Close() end end if type(Model) == "table" and #Model > 0 then F4Menu:Close() local frame = vgui.Create("DFrame") frame:SetTitle("Choose a model") frame:SetVisible(true) frame:MakePopup() frame:ShowCloseButton(false) frame.Paint = function() draw.RoundedBox( 8, 0, 0, frame:GetWide(), frame:GetTall(), Color( 0, 0, 0, 200 ) ) end 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) end end else DoChatCommand(F4Menu) end end JobsTab = vgui.Create('DPanel',F4Menu.Canvas) JobsTab:SetSize(F4Menu.Canvas:GetSize()) JobsTab.Paint = function()end JobsTab.Refresh = function(self) local ply = LocalPlayer() local pt = ply:Team() local width = (JobList:GetWide()-25)/2 JobList:Clear() JobPreview.Team = GetDisplayTeam(LocalPlayer():Team()) JobPreview:Refresh() for k,v in pairs(RPExtraTeams) do local show = true if pt == k then show = false elseif v.admin == 1 and not ply:IsAdmin() then show = false end if v.admin > 1 and not ply:IsSuperAdmin() then show = false end if v.customCheck and not v.customCheck(ply) then show = false end if (type(v.NeedToChangeFrom) == "number" and pt ~= v.NeedToChangeFrom) or (type(v.NeedToChangeFrom) == "table" and not table.HasValue(v.NeedToChangeFrom, pt)) then show = false end if show then local model = v.model if type(model) == "table" then model = table.Random(model) end local button = vgui.Create('DButton') button:SetSize(width,66) button:SetColor(team.GetColor(k)) button:SetText(v.name) button.Paint = PAINT_JOB button.DoClick = DOCLICK_JOB button.OnCursorEntered = function(self) JobPreview.Team = GetDisplayTeam(self.Team) JobPreview:Refresh() end button:SetTooltip('Press to join job') local icon = vgui.Create('SpawnIcon',button) icon:SetSize(64,64) icon:SetPos(1,1) icon:SetModel(model) icon:SetMouseInputEnabled(false) icon.PaintOver = function()end icon.DoClick = function()end button.Team = k JobList:AddItem(button) end end end JobList = vgui.Create('DPanelList',JobsTab) JobList:SetPos(5,5) JobList:SetSize((JobsTab:GetWide()-15)*.6,JobsTab:GetTall()-10) JobList:EnableHorizontal(true) JobList:EnableVerticalScrollbar(true) JobList:SetSpacing(10) JobPreview = vgui.Create('DPanelList',JobsTab) JobPreview:SetPos(5+JobList:GetWide(),5) JobPreview:SetSize((JobsTab:GetWide()-5)*.4,JobsTab:GetTall()-10) JobPreview.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Color(120,120,120,45)) if self.Team then draw.RoundedBox(4,0,0,w,50,self.Team.color) draw.SimpleText(self.Team.name,Texts.TabTitleFont,w/2,20,nil,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) draw.RoundedBox(4,0,40,w,h-40,Color(220,220,220)) end end JobPreview.Refresh = function(self) local enabled = tobool(self.Team) self.Description:SetVisible(enabled) if enabled then self.Description:SetText(self.Team.desc_full) end end JobPreview.Description = vgui.Create('DTextEntry',JobPreview) JobPreview.Description:SetPos(5,45) JobPreview.Description:SetSize(JobPreview:GetWide()-10,JobPreview:GetTall()-50) JobPreview.Description:SetMultiline(true) JobPreview.Description:SetEditable(false) JobPreview.Description:SetDrawBackground(false) F4Menu.Tabs[JobsButton] = JobsTab return JobsButton end local function AddShopTab() local ItemList local ShopButton = vgui.Create('DButton',F4Menu) ShopButton:SetPos(488,F4Menu.Canvas.y-52) ShopButton:SetSize(140,35) ShopButton.Icon = Materials.ShopButton ShopButton.Text = Texts.ShopTabTitle ShopButton.DoClick = function(self) F4Menu:OpenTab(self) end ShopButton.Paint = function(self,w,h) local ry,rh if self.Toggled then ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabActive,true,true) else ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabInactive,true,true) end surface.SetDrawColor(Color(255,255,255,255)) surface.SetMaterial(self.Icon) surface.DrawTexturedRect(12,ry+rh/2-8,16,16) draw.SimpleText(self.Text,Texts.TabTitleFont,55+3,ry+rh/2+3,Colors.TabTitleShadow,nil,TEXT_ALIGN_CENTER) draw.SimpleText(self.Text,Texts.TabTitleFont,55,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER) return true end local ShopTab = vgui.Create('DPanel',F4Menu.Canvas) ShopTab:SetSize(F4Menu.Canvas:GetSize()) ShopTab.Paint = function()end ShopTab.Refresh = function() ItemList:Clear() if #CustomShipments > 0 then local WepCat = vgui.Create("DCollapsibleCategory") WepCat.Paint = function(self,w,h) draw.RoundedBox(0,5,-5,140,25,Color(150,150,150,250)) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawOutlinedRect( 5, -5, 140, 25 ) draw.RoundedBox(4,0,0,w,h,Colors.CategoryBackground) end WepCat:SetLabel(" Weapons") local WepPanel = vgui.Create("DPanelList") WepPanel:SetSize(470, 100) WepPanel:SetAutoSize(true) WepPanel:EnableHorizontal(true) WepPanel:SetPadding(5) WepPanel:SetSpacing(5) local function AddWepIcon(Model, description, command) local button = vgui.Create("DButton") button:SetSize(100,80) button.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Colors.ButtonBackground) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawOutlinedRect( 0, 0, 100,80 ) return true end button.DoClick = function() RunCmd(command) end button:SetToolTip(description) local icon = vgui.Create("SpawnIcon",button) icon:InvalidateLayout( true ) icon:SetModel(Model) icon:SetSize(64, 64) icon:SetPos(8,8) icon:SetMouseInputEnabled(false) WepPanel:AddItem(button) end local shown = 0 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 AddWepIcon(v.model, DarkRP.getPhrase("buy_a", "a "..v.name, GAMEMODE.Config.currency..(v.pricesep or "")), "/buy "..v.name) shown = shown + 1 end end for k,v in pairs(GAMEMODE.AmmoTypes) do if not v.customCheck or v.customCheck(LocalPlayer()) then AddWepIcon(v.model, DarkRP.getPhrase("buy_a", v.name, GAMEMODE.Config.currency .. v.price), "/buyammo " .. v.ammoType) shown = shown + 1 end end if shown > 0 then WepCat:SetContents(WepPanel) ItemList:AddItem(WepCat) else WepPanel:Remove() WepCat:Remove() end end if #DarkRPEntities > 0 then local EntCat = vgui.Create("DCollapsibleCategory") EntCat.Paint = function(self,w,h) draw.RoundedBox(0,5,-5,100,25,Color(150,150,150,250)) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawOutlinedRect( 5, -5, 100, 25 ) draw.RoundedBox(4,0,0,w,h,Colors.CategoryBackground) end EntCat:SetLabel(" Entities") local EntPanel = vgui.Create("DPanelList") EntPanel:SetSize(470, 200) EntPanel:SetAutoSize(true) EntPanel:EnableHorizontal(true) EntPanel:SetPadding(5) EntPanel:SetSpacing(5) local function AddEntIcon(Model, description, command) local button = vgui.Create("DButton") button:SetSize(100,80) button.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Colors.ButtonBackground) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawOutlinedRect( 0, 0, 100,80 ) return true end button.DoClick = function() RunCmd(command) end button:SetToolTip(description) local icon = vgui.Create("SpawnIcon",button) icon:InvalidateLayout( true ) icon:SetModel(Model) icon:SetSize(64, 64) icon:SetPos(8,8) icon:SetMouseInputEnabled(false) icon.DoClick = function() LocalPlayer():ConCommand("darkrp "..command) end EntPanel:AddItem(button) end local shown = 0 for k,v in pairs(DarkRPEntities) do if not v.allowed or (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, " ", "_") AddEntIcon(v.model, "Buy a " .. v.name .." " .. GAMEMODE.Config.currency .. v.price, v.cmd) shown = shown + 1 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 AddEntIcon(v.model, k .. ": " .. CUR .. "15", "/buyfood "..k) shown = shown + 1 end end for k,v in pairs(CustomShipments) do if not GAMEMODE:CustomObjFitsMap(v) then continue end if not v.noship and table.HasValue(v.allowed, LocalPlayer():Team()) and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then AddEntIcon(v.model, DarkRP.getPhrase("buy_a", "a "..v.name .." shipment", GAMEMODE.Config.currency .. tostring(v.price)), "/buyshipment "..v.name) shown = shown + 1 end end if shown > 0 then EntCat:SetContents(EntPanel) ItemList:AddItem(EntCat) else EntPanel:Remove() EntCat:Remove() end end if #CustomVehicles > 0 then local VehCat = vgui.Create("DCollapsibleCategory") VehCat.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Colors.CategoryBackground) end VehCat:SetLabel("Vehicles") local VehPanel = vgui.Create("DPanelList") VehPanel:SetSize(470, 200) VehPanel:SetAutoSize(true) VehPanel:EnableHorizontal(true) VehPanel:SetPadding(5) VehPanel:SetSpacing(5) local function AddVehIcon(Model, skin, description, command) local button = vgui.Create("DButton") button:SetSize(80,80) button.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Colors.ButtonBackground) return true end button.PaintOver = function(self,w,h) if self.Hovered then draw.RoundedBoxEx(4,0,h-20,w,20,Color(0,0,0,200),false,false,true,true) draw.SimpleText(description,'DefaultSmall',w/2,h-10,nil,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) end end button.DoClick = function() RunCmd(command) end button:SetToolTip(description) local icon = vgui.Create("SpawnIcon",button) icon:InvalidateLayout( true ) icon:SetModel(Model) icon:SetSize(64, 64) icon:SetPos(8,8) icon:SetMouseInputEnabled(false) icon.DoClick = function() LocalPlayer():ConCommand("darkrp "..command) end VehPanel:AddItem(button) end local shown = 0 for k,v in pairs(CustomVehicles) do if (not v.allowed or table.HasValue(v.allowed, LocalPlayer():Team())) and (not v.customCheck or v.customCheck(LocalPlayer())) 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" AddVehIcon(v.model or "models/buggy.mdl", Skin, "Buy a "..v.name.." for "..CUR..v.price, "/buyvehicle "..v.name) shown = shown + 1 end end if shown > 0 then VehCat:SetContents(VehPanel) ItemList:AddItem(VehCat) else VehPanel:Remove() VehCat:Remove() end ItemList:AddItem(VehCat) end end ItemList = vgui.Create('DPanelList',ShopTab) ItemList:SetPos(5,5) ItemList:SetSize(ShopTab:GetWide()-10,ShopTab:GetTall()-10) ItemList:EnableVerticalScrollbar(true) ItemList:SetSpacing(5) F4Menu.Tabs[ShopButton] = ShopTab return ShopButton end local function AddForumTab() local ForumButton = vgui.Create('DButton',F4Menu) ForumButton:SetPos(5,F4Menu.Canvas.y+220) ForumButton:SetSize(110,35) ForumButton.Icon = Materials.ForumButton ForumButton.Text = Texts.ForumTabTitle ForumButton.DoClick = function(self) F4Menu:OpenTab(self) end ForumButton.Paint = function(self,w,h) local ry,rh if self.Toggled then ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabActive,true,true) else ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabInactive,true,true) end surface.SetDrawColor(Color(255,255,255,255)) surface.SetMaterial(self.Icon) surface.DrawTexturedRect(12,ry+rh/2-8,16,16) draw.SimpleText(self.Text,Texts.TabTitleFont,32+3,ry+rh/2+3,Colors.TabTitleShadow,nil,TEXT_ALIGN_CENTER) draw.SimpleText(self.Text,Texts.TabTitleFont,32,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER) return true end local ForumTab = vgui.Create('DPanel',F4Menu.Canvas) ForumTab:SetSize(F4Menu.Canvas:GetSize()) ForumTab.Paint = function()end ForumTab.Refresh = function()end local HTML = vgui.Create('HTML',ForumTab) HTML:SetPos(0,0) HTML:SetSize(ForumTab:GetWide(),ForumTab:GetTall()-35) HTML:OpenURL('http://gmod-warehouse.weebly.com') local Controls = vgui.Create('DHTMLControls',ForumTab) Controls:SetPos(0,ForumTab:GetTall()-35) Controls:SetSize(ForumTab:GetWide(),35) Controls.HomeURL = 'http://gmod-warehouse.weebly.com' Controls:SetHTML(HTML) F4Menu.Tabs[ForumButton] = ForumTab return ForumButton end local function AddAdminTab() local AdminButton = vgui.Create('DButton',F4Menu) AdminButton:SetPos(5,F4Menu.Canvas.y+440) AdminButton:SetSize(110,35) AdminButton.Icon = Materials.CloseButton AdminButton.Text = Texts.CloseTab AdminButton.DoClick = function(self) F4Menu:Close() end AdminButton.Paint = function(self,w,h) local ry,rh if self.Toggled then ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabActive,true,true) else ry,rh = 5,h-5 draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabInactive,true,true) end surface.SetDrawColor(Color(255,255,255,255)) surface.SetMaterial(self.Icon) surface.DrawTexturedRect(12,ry+rh/2-8,16,16) draw.SimpleText(self.Text,Texts.TabTitleFont,32+3,ry+rh/2+3,Colors.TabTitleShadow,nil,TEXT_ALIGN_CENTER) draw.SimpleText(self.Text,Texts.TabTitleFont,32,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER) return true end F4Menu.Tabs[AdminButton] = AdminTab return AdminButton end local function AddCloseTab() local CloseButton = vgui.Create('DButton',F4Menu) CloseButton:SetPos(5,F4Menu.Canvas.y+560) CloseButton:SetSize(110,35) CloseButton.Icon = Materials.CloseButton CloseButton.Text = Texts.CloseTab CloseButton.DoClick = function(self) F4Menu:Close() end CloseButton.Paint = function(self,w,h) local ry,rh if self.Toggled then ry,rh = 0,h draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabActive,true,true) else ry,rh = 5,h-5 draw.RoundedBoxEx(0,0,ry,w,rh,Colors.TabInactive,true,true) end surface.SetDrawColor(Color(255,255,255,255)) surface.SetMaterial(self.Icon) surface.DrawTexturedRect(12,ry+rh/2-8,16,16) draw.SimpleText(self.Text,Texts.TabTitleFont,32+3,ry+rh/2+3,Colors.TabTitleShadow,nil,TEXT_ALIGN_CENTER) draw.SimpleText(self.Text,Texts.TabTitleFont,32,ry+rh/2,Colors.TabTitleFront,nil,TEXT_ALIGN_CENTER) return true end F4Menu.Tabs[CloseButton] = CloseTab return CloseButton end //A small trebuchet20 fix surface.CreateFont(Texts.TabTitleFont, { font = "Trebuchet MS", size = 20, weight = 900 }) local function ChangeJobVGUI() if F4Menu and F4Menu:IsValid() then F4Menu:SetVisible(true) F4Menu:OpenTab() return end CreateMenu() AddJobsTab() AddShopTab() AddActionsTab() --AddForumTab() --AddAdminTab() AddCloseTab() end local _CreateButton = CreateButton local function CreateButton(...) local p = _CreateButton(...) p:SetTextColor(Color(255,255,255)) p:SetTextStyleColor(Color(85,85,85,255)) return p end local function CreateButtonDialog() local dialog = vgui.Create('DPanelList') dialog:SetSize(210,25) dialog:SetPadding(5) dialog:SetSpacing(5) dialog:EnableHorizontal(true) dialog:SetAutoSize(true) dialog:MakePopup() dialog:ParentToHUD() dialog.PerformLayout = function(self,...) DPanelList.PerformLayout(self,...) self:Center() end dialog.Paint = function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(10,10,10,255)) end dialog:AddItem(CreateButton(1,'Close','icon16/delete.png',function()dialog:Remove()end)) return dialog end local dialog local function KeysMenu(um) if dialog and dialog:IsValid() then return end local trace = LocalPlayer():GetEyeTraceNoCursor() if !trace or !trace.Entity or !trace.Entity:IsValid() then return end ---local Vehicle = um:ReadBool() dialog = CreateButtonDialog() local DisplayType = Vehicle and "vehicle" or "door" local _RunCmd = RunCmd local function RunCmd(...) _RunCmd(...) if ValidPanel(dialog) then dialog:Remove() end end local function EditDoorGroup() local menu = DermaMenu() local groups = menu:AddSubMenu("Door Groups") local teams = menu:AddSubMenu("Jobs") local add = teams:AddSubMenu("Add") local remov = teams:AddSubMenu("Remove") menu:AddOption("None", function() RunCmd("/togglegroupownable") end) for k,v in pairs(RPExtraTeamDoors) do groups:AddOption(k, function() RunCmd("/togglegroupownable",k) end) end if not trace.Entity.DoorData then return end for k,v in pairs(RPExtraTeams) do if not trace.Entity.DoorData.TeamOwn or not trace.Entity.DoorData.TeamOwn[k] then add:AddOption( v.name, function() RunCmd("/toggleteamownable",k) end ) else remove:AddOption( v.name, function() RunCmd("/toggleteamownable",k) end ) end end menu:Open() end local function EditDoorTitle() Derma_StringRequest("Set door title", "Set the title of the "..DisplayType.." you're looking at", "", function(text) RunCmd("/title",text) end, function() end, "Ok", "Cancel") end if trace.Entity:OwnedBy(LocalPlayer()) then if trace.Entity:IsMasterOwner(LocalPlayer()) then dialog:AddItem(CreateButton(1,'Sell '..DisplayType,'icon16/money_add.png',function()RunCmd("/toggleown")end)) dialog:AddItem(CreateButton(1,'Add owner','icon16/user_add.png',function() local menu = DermaMenu() menu.found = false for k,v in pairs(player.GetAll()) do if not trace.Entity:OwnedBy(v) and not trace.Entity:AllowedToOwn(v) then menu.found = true menu:AddOption(v:Nick(), function() RunCmd("/ao ", v:UserID()) end) end end if not menu.found then menu:AddOption("Noone available", function() end) end menu:Open() end)) dialog:AddItem(CreateButton(1,'Remove owner','icon16/user_delete.png',function() local menu = DermaMenu() for k,v in pairs(player.GetAll()) do if (trace.Entity:OwnedBy(v) and not trace.Entity:IsMasterOwner(v)) or trace.Entity:AllowedToOwn(v) then menu.found = true menu:AddOption(v:Nick(), function() RunCmd("/ro",v:UserID()) end) end end if not menu.found then menu:AddOption("Noone available", function() end) end menu:Open() end)) else dialog:AddItem(CreateButton(1,'Unown '..DisplayType,'icon16/money_add.png',function()RunCmd("/toggleown")end)) end dialog:AddItem(CreateButton(1,'Set '..DisplayType..' title','icon16/note_edit.png',EditDoorTitle)) if LocalPlayer():IsSuperAdmin() and not Vehicle then dialog:AddItem(CreateButton(1,'Edit '..DisplayType..' group','icon16/group_edit.png',EditDoorGroup)) end elseif not trace.Entity:OwnedBy(LocalPlayer()) and trace.Entity:IsOwnable() and not trace.Entity:IsOwned() and not trace.Entity.DoorData.NonOwnable then if LocalPlayer():IsSuperAdmin() then if not trace.Entity.DoorData.GroupOwn then dialog:AddItem(CreateButton(1,'Purchase '..DisplayType,'icon16/money_delete.png',function()RunCmd("/toggleown")end)) end dialog:AddItem(CreateButton(1,'Disable ownership','icon16/cancel.png',function()RunCmd("/toggleownable")end)) dialog:AddItem(CreateButton(1,'Edit '..DisplayType..' group','icon16/group_edit.png',EditDoorGroup)) elseif not trace.Entity.DoorData.GroupOwn then RunCmd("/toggleown") else dialog:Remove() end elseif not trace.Entity:OwnedBy(LocalPlayer()) and trace.Entity:AllowedToOwn(LocalPlayer()) then if LocalPlayer():IsSuperAdmin() then dialog:AddItem(CreateButton(1,'Co-own '..DisplayType,'icon16/money_delete.png',function()RunCmd("/toggleown")end)) dialog:AddItem(CreateButton(1,'Edit '..DisplayType..' group','icon16/group_edit.png',EditDoorGroup)) elseif not trace.Entity.DoorData.GroupOwn then RunCmd("/toggleown") dialog:Remove() end elseif LocalPlayer():IsSuperAdmin() and trace.Entity.DoorData.NonOwnable then dialog:AddItem(CreateButton(1,'Enable ownership','icon16/accept.png',function() RunCmd("/toggleownable") end)) dialog:AddItem(CreateButton(1,'Set '..DisplayType..' title','icon16/note_edit.png',EditDoorTitle)) elseif LocalPlayer():IsSuperAdmin() and not trace.Entity:OwnedBy(LocalPlayer()) and trace.Entity:IsOwned() and not trace.Entity:AllowedToOwn(LocalPlayer()) then dialog:AddItem(CreateButton(1,'Disable ownership','icon16/cancel.png',function() RunCmd("/toggleownable") end)) dialog:AddItem(CreateButton(1,'Set '..DisplayType..' title','icon16/note_edit.png',EditDoorTitle)) dialog:AddItem(CreateButton(1,'Edit '..DisplayType..' group','icon16/group_edit.png',EditDoorGroup)) else dialog:Remove() end end GM.ShowTeam = KeysMenu usermessage.Hook("KeysMenu", KeysMenu) timer.Simple(0,function() CUR = GAMEMODE.Config.currency GAMEMODE.ShowSpare2 = ChangeJobVGUI end)