Advertisement
godfatha96

Untitled

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