Advertisement
Guest User

Untitled

a guest
Jun 27th, 2013
3,528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.05 KB | None | 0 0
  1. CreateClientConVar("rp_playermodel", "", true, true)
  2.  
  3. local function MayorOptns()
  4. local MayCat = vgui.Create("DCollapsibleCategory")
  5. function MayCat:Paint()
  6. self:SetBGColor(team.GetColor(LocalPlayer():Team()))
  7. end
  8. MayCat:SetLabel("Mayor options")
  9. local maypanel = vgui.Create("DListLayout")
  10. maypanel:SetSize(740,170)
  11. local SearchWarrant = maypanel:Add("DButton")
  12. SearchWarrant:SetText(LANGUAGE.searchwarrantbutton)
  13. SearchWarrant.DoClick = function()
  14. local menu = DermaMenu()
  15. for _,ply in pairs(player.GetAll()) do
  16. if not ply:getDarkRPVar("warrant") and ply ~= LocalPlayer() then
  17. menu:AddOption(ply:Nick(), function()
  18. Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil,
  19. function(a)
  20. RunConsoleCommand("darkrp", "/warrant", ply:SteamID(), a)
  21. end,
  22. function() end )
  23. end)
  24. end
  25. end
  26. menu:Open()
  27. end
  28.  
  29. local Warrant = maypanel:Add("DButton")
  30. Warrant:SetText(LANGUAGE.make_wanted)
  31. Warrant.DoClick = function()
  32. local menu = DermaMenu()
  33. for _,ply in pairs(player.GetAll()) do
  34. if not ply:getDarkRPVar("wanted") and ply ~= LocalPlayer() then
  35. menu:AddOption(ply:Nick(), function() Derma_StringRequest("wanted", "Why would you make "..ply:Nick().." wanted?", nil,
  36. function(a)
  37. RunConsoleCommand("darkrp", "/wanted", ply:SteamID(), a)
  38. end,
  39. function() end )
  40. end)
  41. end
  42. end
  43. menu:Open()
  44. end
  45.  
  46. local UnWarrant = maypanel:Add("DButton")
  47. UnWarrant:SetText(LANGUAGE.make_unwanted)
  48. UnWarrant.DoClick = function()
  49. local menu = DermaMenu()
  50. for _,ply in pairs(player.GetAll()) do
  51. if ply:getDarkRPVar("wanted") and ply ~= LocalPlayer() then
  52. menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("darkrp /unwanted \"" .. ply:SteamID() .. "\"") end)
  53. end
  54. end
  55. menu:Open()
  56. end
  57.  
  58. local Lockdown = maypanel:Add("DButton")
  59. Lockdown:SetText(LANGUAGE.initiate_lockdown)
  60. Lockdown.DoClick = function()
  61. LocalPlayer():ConCommand("darkrp /lockdown")
  62. end
  63.  
  64.  
  65. local UnLockdown = maypanel:Add("DButton")
  66. UnLockdown:SetText(LANGUAGE.stop_lockdown)
  67. UnLockdown.DoClick = function()
  68. LocalPlayer():ConCommand("darkrp /unlockdown")
  69. end
  70.  
  71. local Lottery = maypanel:Add("DButton")
  72. Lottery:SetText(LANGUAGE.start_lottery)
  73. Lottery.DoClick = function()
  74. LocalPlayer():ConCommand("darkrp /lottery")
  75. end
  76.  
  77. local GiveLicense = maypanel:Add("DButton")
  78. GiveLicense:SetText(LANGUAGE.give_license_lookingat)
  79. GiveLicense.DoClick = function()
  80. LocalPlayer():ConCommand("darkrp /givelicense")
  81. end
  82.  
  83. local PlaceLaws = maypanel:Add("DButton")
  84. PlaceLaws:SetText("Place a screen containing the laws.")
  85. PlaceLaws.DoClick = function()
  86. LocalPlayer():ConCommand("darkrp /placelaws")
  87. end
  88.  
  89. local AddLaws = maypanel:Add("DButton")
  90. AddLaws:SetText("Add a law.")
  91. AddLaws.DoClick = function()
  92. Derma_StringRequest("Add a law", "Type the law you would like to add here.", "", function(law)
  93. RunConsoleCommand("darkrp", "/addlaw", law)
  94. end)
  95. end
  96.  
  97. local RemLaws = maypanel:Add("DButton")
  98. RemLaws:SetText("Remove a law.")
  99. RemLaws.DoClick = function()
  100. Derma_StringRequest("Remove a law", "Enter the number of the law you would like to remove here.", "", function(num)
  101. LocalPlayer():ConCommand("darkrp /removelaw " .. num)
  102. end)
  103. end
  104. MayCat:SetContents(maypanel)
  105. MayCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  106. return MayCat
  107. end
  108.  
  109. local function CPOptns()
  110. local CPCat = vgui.Create("DCollapsibleCategory")
  111. function CPCat:Paint()
  112. self:SetBGColor(team.GetColor(LocalPlayer():Team()))
  113. end
  114. CPCat:SetLabel("Police options")
  115. local CPpanel = vgui.Create("DListLayout")
  116. CPpanel:SetSize(740,170)
  117. local SearchWarrant = CPpanel:Add("DButton")
  118. SearchWarrant:SetText(LANGUAGE.request_warrant)
  119. SearchWarrant.DoClick = function()
  120. local menu = DermaMenu()
  121. for _,ply in pairs(player.GetAll()) do
  122. if not ply:getDarkRPVar("warrant") and ply ~= LocalPlayer() then
  123. menu:AddOption(ply:Nick(), function()
  124. Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil,
  125. function(a)
  126. RunConsoleCommand("darkrp", "/warrant", ply:SteamID(), a)
  127. end,
  128. function() end )
  129. end)
  130. end
  131. end
  132. menu:Open()
  133. end
  134.  
  135. local Warrant = CPpanel:Add("DButton")
  136. Warrant:SetText(LANGUAGE.searchwarrantbutton)
  137. Warrant.DoClick = function()
  138. local menu = DermaMenu()
  139. for _,ply in pairs(player.GetAll()) do
  140. if not ply:getDarkRPVar("wanted") and ply ~= LocalPlayer() then
  141. menu:AddOption(ply:Nick(), function()
  142. Derma_StringRequest("wanted", "Why would you make "..ply:Nick().." wanted?", nil,
  143. function(a)
  144. if not IsValid(ply) then return end
  145. RunConsoleCommand("darkrp", "/wanted", ply:SteamID(), a)
  146. end,
  147. function() end )
  148. end)
  149. end
  150. end
  151. menu:Open()
  152. end
  153.  
  154. local UnWarrant = CPpanel:Add("DButton")
  155. UnWarrant:SetText(LANGUAGE.unwarrantbutton)
  156. UnWarrant.DoClick = function()
  157. local menu = DermaMenu()
  158. for _,ply in pairs(player.GetAll()) do
  159. if ply:getDarkRPVar("wanted") and ply ~= LocalPlayer() then
  160. menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("darkrp /unwanted \"" .. ply:SteamID() .. "\"") end)
  161. end
  162. end
  163. menu:Open()
  164. end
  165.  
  166. if LocalPlayer():Team() == TEAM_CHIEF and GAMEMODE.Config.chiefjailpos or LocalPlayer():IsAdmin() then
  167. local SetJailPos = CPpanel:Add("DButton")
  168. SetJailPos:SetText(LANGUAGE.set_jailpos)
  169. SetJailPos.DoClick = function() LocalPlayer():ConCommand("darkrp /jailpos") end
  170.  
  171. local AddJailPos = CPpanel:Add("DButton")
  172. AddJailPos:SetText(LANGUAGE.add_jailpos)
  173. AddJailPos.DoClick = function() LocalPlayer():ConCommand("darkrp /addjailpos") end
  174. end
  175.  
  176. local ismayor -- Firstly look if there's a mayor
  177. local ischief -- Then if there's a chief
  178. for k,v in pairs(player.GetAll()) do
  179. if v:Team() == TEAM_MAYOR then
  180. ismayor = true
  181. break
  182. end
  183. end
  184.  
  185. if not ismayor then
  186. for k,v in pairs(player.GetAll()) do
  187. if v:Team() == TEAM_CHIEF then
  188. ischief = true
  189. break
  190. end
  191. end
  192. end
  193.  
  194. local Team = LocalPlayer():Team()
  195. if not ismayor and (Team == TEAM_CHIEF or (not ischief and Team == TEAM_POLICE)) then
  196. local GiveLicense = CPpanel:Add("DButton")
  197. GiveLicense:SetText(LANGUAGE.give_license_lookingat)
  198. GiveLicense.DoClick = function()
  199. LocalPlayer():ConCommand("darkrp /givelicense")
  200. end
  201. end
  202. CPCat:SetContents(CPpanel)
  203. CPCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  204. return CPCat
  205. end
  206.  
  207.  
  208. local function CitOptns()
  209. local CitCat = vgui.Create("DCollapsibleCategory")
  210. function CitCat:Paint()
  211. self:SetBGColor(team.GetColor(LocalPlayer():Team()))
  212. end
  213. CitCat:SetLabel("Citizen options")
  214. local Citpanel = vgui.Create("DListLayout")
  215. Citpanel:SetSize(740,110)
  216.  
  217. local joblabel = Citpanel:Add("DLabel")
  218. joblabel:SetText(LANGUAGE.set_custom_job)
  219.  
  220. local jobentry = Citpanel:Add("DTextEntry")
  221. jobentry:SetAllowNonAsciiCharacters(true)
  222. jobentry:SetValue(LocalPlayer():getDarkRPVar("job") or "")
  223. jobentry.OnEnter = function()
  224. RunConsoleCommand("DarkRP", "/job", tostring(jobentry:GetValue()))
  225. end
  226.  
  227. CitCat:SetContents(Citpanel)
  228. CitCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  229. return CitCat
  230. end
  231.  
  232.  
  233. local function MobOptns()
  234. local MobCat = vgui.Create("DCollapsibleCategory")
  235. function MobCat:Paint()
  236. self:SetBGColor(team.GetColor(LocalPlayer():Team()))
  237. end
  238. MobCat:SetLabel("Mobboss options")
  239. local Mobpanel = vgui.Create("DListLayout")
  240. Mobpanel:SetSize(740,110)
  241.  
  242. local agendalabel = Mobpanel:Add("DLabel")
  243. agendalabel:SetText(LANGUAGE.set_agenda)
  244.  
  245. local agendaentry = Mobpanel:Add("DTextEntry")
  246. agendaentry:SetAllowNonAsciiCharacters(true)
  247. agendaentry:SetValue(LocalPlayer():getDarkRPVar("agenda") or "")
  248. agendaentry.OnEnter = function()
  249. RunConsoleCommand("darkrp", "/agenda", tostring(agendaentry:GetValue()))
  250. end
  251.  
  252. MobCat:SetContents(Mobpanel)
  253. MobCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  254. return MobCat
  255. end
  256.  
  257. function GM:MoneyTab()
  258. local FirstTabPanel = vgui.Create("DPanelList")
  259. FirstTabPanel:EnableVerticalScrollbar( true )
  260. function FirstTabPanel:Update()
  261. self:Clear(true)
  262. local MoneyCat = vgui.Create("DCollapsibleCategory")
  263. MoneyCat:SetLabel("Money")
  264. local MoneyPanel = vgui.Create("DListLayout")
  265. MoneyPanel:SetSize(740,60)
  266.  
  267. local GiveMoneyButton = MoneyPanel:Add("DButton")
  268. GiveMoneyButton:SetText(LANGUAGE.give_money)
  269. GiveMoneyButton.DoClick = function()
  270. Derma_StringRequest("Amount of money", "How much money do you want to give?", "", function(a) LocalPlayer():ConCommand("darkrp /give " .. tostring(a)) end)
  271. end
  272.  
  273. local SpawnMoneyButton = MoneyPanel:Add("DButton")
  274. SpawnMoneyButton:SetText(LANGUAGE.drop_money)
  275. SpawnMoneyButton.DoClick = function()
  276. Derma_StringRequest("Amount of money", "How much money do you want to drop?", "", function(a) LocalPlayer():ConCommand("darkrp /dropmoney " .. tostring(a)) end)
  277. end
  278.  
  279. MoneyCat:SetContents(MoneyPanel)
  280. MoneyCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  281.  
  282.  
  283. local Commands = vgui.Create("DCollapsibleCategory")
  284. Commands:SetLabel("Actions")
  285. local ActionsPanel = vgui.Create("DListLayout")
  286. ActionsPanel:SetSize(740,210)
  287. local rpnamelabel = ActionsPanel:Add("DLabel")
  288. rpnamelabel:SetText(LANGUAGE.change_name)
  289.  
  290. local rpnameTextbox = ActionsPanel:Add("DTextEntry")
  291. rpnameTextbox:SetAllowNonAsciiCharacters(true)
  292. rpnameTextbox:SetText(LocalPlayer():Nick())
  293. rpnameTextbox.OnEnter = function() RunConsoleCommand("darkrp", "/rpname", tostring(rpnameTextbox:GetValue())) end
  294.  
  295. local sleep = ActionsPanel:Add("DButton")
  296. sleep:SetText(LANGUAGE.go_to_sleep)
  297. sleep.DoClick = function()
  298. LocalPlayer():ConCommand("darkrp /sleep")
  299. end
  300. local Drop = ActionsPanel:Add("DButton")
  301. Drop:SetText(LANGUAGE.drop_weapon)
  302. Drop.DoClick = function() LocalPlayer():ConCommand("darkrp /drop") end
  303. if GAMEMODE.Config.enablebuyhealth then
  304. local health = MoneyPanel:Add("DButton")
  305. health:SetText(string.format(LANGUAGE.buy_health, tostring(GAMEMODE.Config.healthcost)))
  306. health.DoClick = function() LocalPlayer():ConCommand("darkrp /Buyhealth") end
  307. end
  308.  
  309. if LocalPlayer():Team() ~= TEAM_MAYOR then
  310. local RequestLicense = ActionsPanel:Add("DButton")
  311. RequestLicense:SetText(LANGUAGE.request_gunlicense)
  312. RequestLicense.DoClick = function() LocalPlayer():ConCommand("darkrp /requestlicense") end
  313. end
  314.  
  315. local Demote = ActionsPanel:Add("DButton")
  316. Demote:SetText(LANGUAGE.demote_player_menu)
  317. Demote.DoClick = function()
  318. local menu = DermaMenu()
  319. for _,ply in pairs(player.GetAll()) do
  320. if ply ~= LocalPlayer() then
  321. menu:AddOption(ply:Nick(), function()
  322. Derma_StringRequest("Demote reason", "Why would you demote "..ply:Nick().."?", nil,
  323. function(a)
  324. RunConsoleCommand("darkrp", "/demote", ply:SteamID(), a)
  325. end,
  326. function() end )
  327. end)
  328. end
  329. end
  330. menu:Open()
  331. end
  332.  
  333. local UnOwnAllDoors = ActionsPanel:Add("DButton")
  334. UnOwnAllDoors:SetText("Sell all of your doors")
  335. UnOwnAllDoors.DoClick = function() LocalPlayer():ConCommand("darkrp /unownalldoors") end
  336. Commands:SetContents(ActionsPanel)
  337. FirstTabPanel:AddItem(MoneyCat)
  338. Commands:SetSkin(GAMEMODE.Config.DarkRPSkin)
  339. FirstTabPanel:AddItem(Commands)
  340.  
  341. if LocalPlayer():Team() == TEAM_MAYOR then
  342. FirstTabPanel:AddItem(MayorOptns())
  343. elseif LocalPlayer():Team() == TEAM_CITIZEN then
  344. FirstTabPanel:AddItem(CitOptns())
  345. elseif LocalPlayer():IsCP() then
  346. FirstTabPanel:AddItem(CPOptns())
  347. elseif LocalPlayer():Team() == TEAM_MOB then
  348. FirstTabPanel:AddItem(MobOptns())
  349. end
  350. end
  351. FirstTabPanel:Update()
  352. return FirstTabPanel
  353. end
  354.  
  355. function GM:JobsTab()
  356. local hordiv = vgui.Create("DHorizontalDivider")
  357. hordiv:SetLeftWidth(390)
  358. function hordiv.m_DragBar:OnMousePressed() end
  359. hordiv.m_DragBar:SetCursor("none")
  360. local Panel
  361. local Information
  362. function hordiv:Update()
  363. if Panel and Panel:IsValid() then
  364. Panel:Remove()
  365. end
  366. Panel = vgui.Create("DPanelList")
  367. Panel:SetSize(390, 540)
  368. Panel:EnableHorizontal( true )
  369. Panel:EnableVerticalScrollbar( true )
  370. Panel:SetSkin(GAMEMODE.Config.DarkRPSkin)
  371.  
  372.  
  373. local Info = {}
  374. local model
  375. local modelpanel
  376. local function UpdateInfo(a)
  377. if Information and Information:IsValid() then
  378. Information:Remove()
  379. end
  380. Information = vgui.Create("DPanelList")
  381. Information:SetPos(378,0)
  382. Information:SetSize(370, 540)
  383. Information:SetSpacing(10)
  384. Information:EnableHorizontal( false )
  385. Information:EnableVerticalScrollbar( true )
  386. Information:SetSkin(GAMEMODE.Config.DarkRPSkin)
  387. function Information:Rebuild() -- YES IM OVERRIDING IT AND CHANGING ONLY ONE LINE BUT I HAVE A FUCKING GOOD REASON TO DO IT!
  388. local Offset = 0
  389. if ( self.Horizontal ) then
  390. local x, y = self.Padding, self.Padding;
  391. for k, panel in pairs( self.Items ) do
  392. local w = panel:GetWide()
  393. local h = panel:GetTall()
  394. if ( x + w > self:GetWide() ) then
  395. x = self.Padding
  396. y = y + h + self.Spacing
  397. end
  398. panel:SetPos( x, y )
  399. x = x + w + self.Spacing
  400. Offset = y + h + self.Spacing
  401. end
  402. else
  403. for k, panel in pairs( self.Items ) do
  404. if not panel:IsValid() then return end
  405. panel:SetSize( self:GetCanvas():GetWide() - self.Padding * 2, panel:GetTall() )
  406. panel:SetPos( self.Padding, self.Padding + Offset )
  407. panel:InvalidateLayout( true )
  408. Offset = Offset + panel:GetTall() + self.Spacing
  409. end
  410. Offset = Offset + self.Padding
  411. end
  412. self:GetCanvas():SetTall( Offset + (self.Padding) - self.Spacing )
  413. end
  414.  
  415. if type(Info) == "table" and #Info > 0 then
  416. for k,v in ipairs(Info) do
  417. local label = vgui.Create("DLabel")
  418. label:SetText(v)
  419. label:SizeToContents()
  420. if label:IsValid() then
  421. Information:AddItem(label)
  422. end
  423. end
  424. end
  425.  
  426. if model and type(model) == "string" and a ~= false then
  427. modelpanel = vgui.Create("DModelPanel")
  428. modelpanel:SetModel(model)
  429. modelpanel:SetSize(90,230)
  430. modelpanel:SetAnimated(true)
  431. modelpanel:SetFOV(90)
  432. modelpanel:SetAnimSpeed(1)
  433. if modelpanel:IsValid() then
  434. Information:AddItem(modelpanel)
  435. end
  436. end
  437. hordiv:SetLeft(Panel)
  438. hordiv:SetRight(Information)
  439. end
  440. UpdateInfo()
  441.  
  442. local function AddIcon(Model, name, description, Weapons, command, special, specialcommand)
  443. local icon = vgui.Create("SpawnIcon")
  444. local IconModel = Model
  445. if type(Model) == "table" then
  446. IconModel = Model[math.random(#Model)]
  447. end
  448. icon:SetModel(IconModel)
  449.  
  450. icon:SetSize(128, 128)
  451. icon:SetToolTip()
  452. icon.OnCursorEntered = function()
  453. icon.PaintOverOld = icon.PaintOver
  454. icon.PaintOver = icon.PaintOverHovered
  455. Info[1] = LANGUAGE.job_name .. name
  456. Info[2] = LANGUAGE.job_description .. description
  457. Info[3] = LANGUAGE.job_weapons .. Weapons
  458. model = IconModel
  459. UpdateInfo()
  460. end
  461. icon.OnCursorExited = function()
  462. if ( icon.PaintOver == icon.PaintOverHovered ) then
  463. icon.PaintOver = icon.PaintOverOld
  464. end
  465. Info = {}
  466. if modelpanel and modelpanel:IsValid() and icon:IsValid() then
  467. modelpanel:Remove()
  468. UpdateInfo(false)
  469. end
  470. end
  471.  
  472. icon.DoClick = function()
  473. local function DoChatCommand(frame)
  474. if special then
  475. local menu = DermaMenu()
  476. menu:AddOption("Vote", function() LocalPlayer():ConCommand("darkrp "..command) frame:Close() end)
  477. menu:AddOption("Do not vote", function() LocalPlayer():ConCommand("darkrp " .. specialcommand) frame:Close() end)
  478. menu:Open()
  479. else
  480. LocalPlayer():ConCommand("darkrp " .. command)
  481. frame:Close()
  482. end
  483. end
  484.  
  485. if type(Model) == "table" and #Model > 0 then
  486. hordiv:GetParent():GetParent():Close()
  487. local frame = vgui.Create("DFrame")
  488. frame:SetTitle("Choose model")
  489. frame:SetVisible(true)
  490. frame:MakePopup()
  491.  
  492. local levels = 1
  493. local IconsPerLevel = math.floor(ScrW()/64)
  494.  
  495. while #Model * (64/levels) > ScrW() do
  496. levels = levels + 1
  497. end
  498. frame:SetSize(math.Min(#Model * 64, IconsPerLevel*64), math.Min(90+(64*(levels-1)), ScrH()))
  499. frame:Center()
  500.  
  501. local CurLevel = 1
  502. for k,v in pairs(Model) do
  503. local icon = vgui.Create("SpawnIcon", frame)
  504. if (k-IconsPerLevel*(CurLevel-1)) > IconsPerLevel then
  505. CurLevel = CurLevel + 1
  506. end
  507. icon:SetPos((k-1-(CurLevel-1)*IconsPerLevel) * 64, 25+(64*(CurLevel-1)))
  508. icon:SetModel(v)
  509. icon:SetSize(64, 64)
  510. icon:SetToolTip()
  511. icon.DoClick = function()
  512. RunConsoleCommand("rp_playermodel", v)
  513. RunConsoleCommand("_rp_ChosenModel", v)
  514. DoChatCommand(frame)
  515. end
  516. end
  517. else
  518. DoChatCommand(hordiv:GetParent():GetParent())
  519. end
  520. end
  521.  
  522. if icon:IsValid() then
  523. Panel:AddItem(icon)
  524. end
  525. end
  526.  
  527. for k,v in ipairs(RPExtraTeams) do
  528. if LocalPlayer():Team() ~= k and GAMEMODE:CustomObjFitsMap(v) then
  529. local nodude = true
  530. if v.admin == 1 and not LocalPlayer():IsAdmin() then
  531. nodude = false
  532. end
  533. if v.admin > 1 and not LocalPlayer():IsSuperAdmin() then
  534. nodude = false
  535. end
  536. if v.customCheck and not v.customCheck(LocalPlayer()) then
  537. nodude = false
  538. end
  539.  
  540. if (type(v.NeedToChangeFrom) == "number" and LocalPlayer():Team() ~= v.NeedToChangeFrom) or (type(v.NeedToChangeFrom) == "table" and not table.HasValue(v.NeedToChangeFrom, LocalPlayer():Team())) then
  541. nodude = false
  542. end
  543.  
  544. if nodude then
  545. local weps = "no extra weapons"
  546. if #v.weapons > 0 then
  547. weps = table.concat(v.weapons, "\n")
  548. end
  549. if (not v.RequiresVote and v.vote) or (v.RequiresVote and v.RequiresVote(LocalPlayer(), k)) then
  550. local condition = ((v.admin == 0 and LocalPlayer():IsAdmin()) or (v.admin == 1 and LocalPlayer():IsSuperAdmin()) or LocalPlayer().DarkRPVars["Priv"..v.command])
  551. if not v.model or not v.name or not v.description or not v.command then chat.AddText(Color(255,0,0,255), "Incorrect team! Fix your shared.lua!") return end
  552. AddIcon(v.model, v.name, v.description, weps, "/vote"..v.command, condition, "/"..v.command)
  553. else
  554. if not v.model or not v.name or not v.description or not v.command then chat.AddText(Color(255,0,0,255), "Incorrect team! Fix your shared.lua!") return end
  555. AddIcon(v.model, v.name, v.description, weps, "/"..v.command)
  556. end
  557. end
  558. end
  559. end
  560. end
  561. hordiv:Update()
  562. return hordiv
  563. end
  564.  
  565. function GM:EntitiesTab()
  566. local EntitiesPanel = vgui.Create("DPanelList")
  567. EntitiesPanel:EnableVerticalScrollbar( true )
  568. function EntitiesPanel:Update()
  569. self:Clear(true)
  570. local WepCat = vgui.Create("DCollapsibleCategory")
  571. WepCat:SetLabel("Weapons")
  572. local WepPanel = vgui.Create("DPanelList")
  573. WepPanel:SetSize(470, 100)
  574. WepPanel:SetAutoSize(true)
  575. WepPanel:SetSpacing(1)
  576. WepPanel:EnableHorizontal(true)
  577. WepPanel:EnableVerticalScrollbar(true)
  578. local function AddIcon(Model, description, command)
  579. local icon = vgui.Create("SpawnIcon")
  580. icon:InvalidateLayout( true )
  581. icon:SetModel(Model)
  582. icon:SetSize(64, 64)
  583. icon:SetToolTip(description)
  584. icon.DoClick = function() LocalPlayer():ConCommand("darkrp "..command) end
  585. WepPanel:AddItem(icon)
  586. end
  587.  
  588. for k,v in pairs(CustomShipments) do
  589. if not GAMEMODE:CustomObjFitsMap(v) then continue end
  590. if (v.seperate and (not GAMEMODE.Config.restrictbuypistol or
  591. (GAMEMODE.Config.restrictbuypistol and (not v.allowed[1] or table.HasValue(v.allowed, LocalPlayer():Team())))))
  592. and (not v.customCheck or v.customCheck and v.customCheck(LocalPlayer())) then
  593. AddIcon(v.model, string.format(LANGUAGE.buy_a, "a "..v.name, GAMEMODE.Config.currency..(v.pricesep or "")), "/buy "..v.name)
  594. end
  595. end
  596.  
  597. for k,v in pairs(GAMEMODE.AmmoTypes) do
  598. if not v.customCheck or v.customCheck(LocalPlayer()) then
  599. AddIcon(v.model, string.format(LANGUAGE.buy_a, v.name, GAMEMODE.Config.currency .. v.price), "/buyammo " .. v.ammoType)
  600. end
  601. end
  602. WepCat:SetContents(WepPanel)
  603. WepCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  604. self:AddItem(WepCat)
  605.  
  606. local EntCat = vgui.Create("DCollapsibleCategory")
  607. EntCat:SetLabel("Entities")
  608. local EntPanel = vgui.Create("DPanelList")
  609. EntPanel:SetSize(470, 200)
  610. EntPanel:SetAutoSize(true)
  611. EntPanel:SetSpacing(1)
  612. EntPanel:EnableHorizontal(true)
  613. EntPanel:EnableVerticalScrollbar(true)
  614. local function AddEntIcon(Model, description, command)
  615. local icon = vgui.Create("SpawnIcon")
  616. icon:InvalidateLayout( true )
  617. icon:SetModel(Model)
  618. icon:SetSize(64, 64)
  619. icon:SetToolTip(description)
  620. icon.DoClick = function() LocalPlayer():ConCommand("darkrp "..command) end
  621. EntPanel:AddItem(icon)
  622. end
  623.  
  624. for k,v in pairs(DarkRPEntities) do
  625. if not v.allowed or (type(v.allowed) == "table" and table.HasValue(v.allowed, LocalPlayer():Team()))
  626. and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
  627. local cmdname = string.gsub(v.ent, " ", "_")
  628.  
  629. AddEntIcon(v.model, "Buy a " .. v.name .." " .. GAMEMODE.Config.currency .. v.price, v.cmd)
  630. end
  631. end
  632.  
  633. if FoodItems and (GAMEMODE.Config.foodspawn or LocalPlayer():Team() == TEAM_COOK) and LocalPlayer():Team() == TEAM_COOK then
  634. for k,v in pairs(FoodItems) do
  635. AddEntIcon(v.model, string.format(LANGUAGE.buy_a, "a "..k, "$15"), "/buyfood "..k)
  636. end
  637. end
  638. for k,v in pairs(CustomShipments) do
  639. if not GAMEMODE:CustomObjFitsMap(v) then continue end
  640. if not v.noship and table.HasValue(v.allowed, LocalPlayer():Team())
  641. and (not v.customCheck or (v.customCheck and v.customCheck(LocalPlayer()))) then
  642. AddEntIcon(v.model, string.format(LANGUAGE.buy_a, "a "..v.name .." shipment", GAMEMODE.Config.currency .. tostring(v.price)), "/buyshipment "..v.name)
  643. end
  644. end
  645. EntCat:SetContents(EntPanel)
  646. EntCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  647. self:AddItem(EntCat)
  648.  
  649.  
  650. if #CustomVehicles <= 0 then return end
  651. local VehicleCat = vgui.Create("DCollapsibleCategory")
  652. VehicleCat:SetLabel("Vehicles")
  653. local VehiclePanel = vgui.Create("DPanelList")
  654. VehiclePanel:SetSize(470, 200)
  655. VehiclePanel:SetAutoSize(true)
  656. VehiclePanel:SetSpacing(1)
  657. VehiclePanel:EnableHorizontal(true)
  658. VehiclePanel:EnableVerticalScrollbar(true)
  659. local function AddVehicleIcon(Model, skin, description, command)
  660. local icon = vgui.Create("SpawnIcon")
  661. icon:InvalidateLayout( true )
  662. icon:SetModel(Model)
  663. icon:SetSkin(skin)
  664. icon:SetSize(64, 64)
  665. icon:SetToolTip(description)
  666. icon.DoClick = function() LocalPlayer():ConCommand("darkrp "..command) end
  667. VehiclePanel:AddItem(icon)
  668. end
  669.  
  670. local founds = 0
  671. for k,v in pairs(CustomVehicles) do
  672. if (not v.allowed or table.HasValue(v.allowed, LocalPlayer():Team())) and (not v.customCheck or v.customCheck(LocalPlayer())) then
  673. local Skin = (list.Get("Vehicles")[v.name] and list.Get("Vehicles")[v.name].KeyValues and list.Get("Vehicles")[v.name].KeyValues.Skin) or "0"
  674. AddVehicleIcon(v.model or "models/buggy.mdl", Skin, "Buy a "..v.name.." for "..GAMEMODE.Config.currency..v.price, "/buyvehicle "..v.name)
  675. founds = founds + 1
  676. end
  677. end
  678. if founds ~= 0 then
  679. VehicleCat:SetContents(VehiclePanel)
  680. VehicleCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  681. self:AddItem(VehicleCat)
  682. else
  683. VehiclePanel:Remove()
  684. VehicleCat:Remove()
  685. end
  686. end
  687. EntitiesPanel:SetSkin(GAMEMODE.Config.DarkRPSkin)
  688. EntitiesPanel:Update()
  689. return EntitiesPanel
  690. end
  691.  
  692. function GM:RPHUDTab()
  693. local HUDTABpanel = vgui.Create("DIconLayout")
  694. HUDTABpanel:SetSize(750, 550)
  695. function HUDTABpanel:Update()
  696. self:Clear(true)
  697.  
  698. backgrndcat = HUDTABpanel:Add("DCollapsibleCategory")
  699. backgrndcat:SetSize(230, 130)
  700. function backgrndcat.Header:OnMousePressed() end
  701. backgrndcat:SetLabel("HUD background")
  702. local backgrndpanel = vgui.Create("DListLayout")
  703. local backgrnd = backgrndpanel:Add("CtrlColor")
  704. backgrnd:SetConVarR("background1")
  705. backgrnd:SetConVarG("background2")
  706. backgrnd:SetConVarB("background3")
  707. backgrnd:SetConVarA("background4")
  708.  
  709. local resetbackgrnd = backgrndpanel:Add("DButton")
  710. resetbackgrnd:SetText("Reset")
  711. resetbackgrnd:SetSize(230, 20)
  712. resetbackgrnd.DoClick = function()
  713. LocalPlayer():ConCommand("background1 0")
  714. LocalPlayer():ConCommand("background2 0")
  715. LocalPlayer():ConCommand("background3 0")
  716. LocalPlayer():ConCommand("background4 100")
  717. end
  718. backgrndcat:SetContents(backgrndpanel)
  719. backgrndcat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  720.  
  721. hforegrndcat = HUDTABpanel:Add("DCollapsibleCategory")
  722. hforegrndcat:SetSize(230, 130)
  723. function hforegrndcat.Header:OnMousePressed() end
  724. hforegrndcat:SetLabel("Health bar foreground")
  725. local hforegrndpanel = vgui.Create("DListLayout")
  726. hforegrndpanel:SetTall(130)
  727. local hforegrnd = hforegrndpanel:Add("CtrlColor")
  728. hforegrnd:SetConVarR("Healthforeground1")
  729. hforegrnd:SetConVarG("Healthforeground2")
  730. hforegrnd:SetConVarB("Healthforeground3")
  731. hforegrnd:SetConVarA("Healthforeground4")
  732.  
  733. local resethforegrnd = hforegrndpanel:Add("DButton")
  734. resethforegrnd:SetText("Reset")
  735. resethforegrnd:SetSize(230, 20)
  736. resethforegrnd.DoClick = function()
  737. LocalPlayer():ConCommand("Healthforeground1 140")
  738. LocalPlayer():ConCommand("Healthforeground2 0")
  739. LocalPlayer():ConCommand("Healthforeground3 0")
  740. LocalPlayer():ConCommand("Healthforeground4 180")
  741. end
  742. hforegrndcat:SetContents(hforegrndpanel)
  743. hforegrndcat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  744.  
  745.  
  746. hbackgrndcat = HUDTABpanel:Add("DCollapsibleCategory")
  747. hbackgrndcat:SetSize(230, 130)
  748. function hbackgrndcat.Header:OnMousePressed() end
  749. hbackgrndcat:SetLabel("Health bar Background")
  750. local hbackgrndpanel = vgui.Create("DListLayout")
  751. hbackgrndpanel:SetTall(130)
  752. local hbackgrnd = hbackgrndpanel:Add("CtrlColor")
  753. hbackgrnd:SetConVarR("Healthbackground1")
  754. hbackgrnd:SetConVarG("Healthbackground2")
  755. hbackgrnd:SetConVarB("Healthbackground3")
  756. hbackgrnd:SetConVarA("Healthbackground4")
  757.  
  758. local resethbackgrnd = hbackgrndpanel:Add("DButton")
  759. resethbackgrnd:SetText("Reset")
  760. resethbackgrnd:SetSize(230, 20)
  761. resethbackgrnd.DoClick = function()
  762. LocalPlayer():ConCommand("Healthbackground1 0")
  763. LocalPlayer():ConCommand("Healthbackground2 0")
  764. LocalPlayer():ConCommand("Healthbackground3 0")
  765. LocalPlayer():ConCommand("Healthbackground4 200")
  766. end
  767. hbackgrndcat:SetContents(hbackgrndpanel)
  768. hbackgrndcat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  769.  
  770. hTextcat = HUDTABpanel:Add("DCollapsibleCategory")
  771. hTextcat:SetSize(230, 130)
  772. function hTextcat.Header:OnMousePressed() end
  773. hTextcat:SetLabel("Health bar text")
  774. local hTextpanel = vgui.Create("DListLayout")
  775. hTextpanel:SetTall(130)
  776. local hText = hTextpanel:Add("CtrlColor")
  777. hText:SetConVarR("HealthText1")
  778. hText:SetConVarG("HealthText2")
  779. hText:SetConVarB("HealthText3")
  780. hText:SetConVarA("HealthText4")
  781.  
  782. local resethText = hTextpanel:Add("DButton")
  783. resethText:SetText("Reset")
  784. resethText:SetSize(230, 20)
  785. resethText.DoClick = function()
  786. LocalPlayer():ConCommand("HealthText1 255")
  787. LocalPlayer():ConCommand("HealthText2 255")
  788. LocalPlayer():ConCommand("HealthText3 255")
  789. LocalPlayer():ConCommand("HealthText4 200")
  790. end
  791. hTextcat:SetContents(hTextpanel)
  792. hTextcat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  793.  
  794. jobs1cat = HUDTABpanel:Add("DCollapsibleCategory")
  795. jobs1cat:SetSize(230, 130)
  796. function jobs1cat.Header:OnMousePressed() end
  797. jobs1cat:SetLabel("Jobs/wallet foreground")
  798. local jobs1panel = vgui.Create("DListLayout")
  799. jobs1panel:SetTall(130)
  800. local jobs1 = jobs1panel:Add("CtrlColor")
  801. jobs1:SetConVarR("Job21")
  802. jobs1:SetConVarG("Job22")
  803. jobs1:SetConVarB("Job23")
  804. jobs1:SetConVarA("Job24")
  805.  
  806. local resetjobs1 = jobs1panel:Add("DButton")
  807. resetjobs1:SetText("Reset")
  808. resetjobs1:SetSize(230, 20)
  809. resetjobs1.DoClick = function()
  810. LocalPlayer():ConCommand("Job21 0")
  811. LocalPlayer():ConCommand("Job22 0")
  812. LocalPlayer():ConCommand("Job23 0")
  813. LocalPlayer():ConCommand("Job24 255")
  814. end
  815. jobs1cat:SetContents(jobs1panel)
  816. jobs1cat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  817.  
  818. jobs2cat = HUDTABpanel:Add("DCollapsibleCategory")
  819. jobs2cat:SetSize(230, 130)
  820. function jobs2cat.Header:OnMousePressed() end
  821. jobs2cat:SetLabel("Jobs/wallet background")
  822. local jobs2panel = vgui.Create("DListLayout")
  823. jobs2panel:SetSize(230, 130)
  824. local jobs2 = jobs2panel:Add("CtrlColor")
  825. jobs2:SetConVarR("Job11")
  826. jobs2:SetConVarG("Job12")
  827. jobs2:SetConVarB("Job13")
  828. jobs2:SetConVarA("Job14")
  829.  
  830. local resetjobs2 = jobs2panel:Add("DButton")
  831. resetjobs2:SetText("Reset")
  832. resetjobs2:SetSize(230, 20)
  833. resetjobs2.DoClick = function()
  834. LocalPlayer():ConCommand("Job11 0")
  835. LocalPlayer():ConCommand("Job12 0")
  836. LocalPlayer():ConCommand("Job13 150")
  837. LocalPlayer():ConCommand("Job14 200")
  838. end
  839. jobs2cat:SetContents(jobs2panel)
  840. jobs2cat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  841.  
  842. salary1cat = HUDTABpanel:Add("DCollapsibleCategory")
  843. salary1cat:SetSize(230, 130)
  844. function salary1cat.Header:OnMousePressed() end
  845. salary1cat:SetLabel("Salary foreground")
  846. local salary1panel = vgui.Create("DListLayout")
  847. salary1panel:SetSize(230, 130)
  848. local salary1 = salary1panel:Add("CtrlColor")
  849. salary1:SetConVarR("salary21")
  850. salary1:SetConVarG("salary22")
  851. salary1:SetConVarB("salary23")
  852. salary1:SetConVarA("salary24")
  853.  
  854. local resetsalary1 = salary1panel:Add("DButton")
  855. resetsalary1:SetText("Reset")
  856. resetsalary1:SetSize(230, 20)
  857. resetsalary1.DoClick = function()
  858. LocalPlayer():ConCommand("salary21 0")
  859. LocalPlayer():ConCommand("salary22 0")
  860. LocalPlayer():ConCommand("salary23 0")
  861. LocalPlayer():ConCommand("salary24 255")
  862. end
  863. salary1cat:SetContents(salary1panel)
  864. salary1cat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  865.  
  866. salary2cat = HUDTABpanel:Add("DCollapsibleCategory")
  867. salary2cat:SetSize(230, 130)
  868. function salary2cat.Header:OnMousePressed() end
  869. salary2cat:SetLabel("Salary background")
  870. local salary2panel = vgui.Create("DListLayout")
  871. salary2panel:SetSize(230, 130)
  872. local salary2 = salary2panel:Add("CtrlColor")
  873. salary2:SetConVarR("salary11")
  874. salary2:SetConVarG("salary12")
  875. salary2:SetConVarB("salary13")
  876. salary2:SetConVarA("salary14")
  877.  
  878. local resetsalary2 = salary2panel:Add("DButton")
  879. resetsalary2:SetText("Reset")
  880. resetsalary2:SetSize(230, 20)
  881. resetsalary2.DoClick = function()
  882. LocalPlayer():ConCommand("salary11 0")
  883. LocalPlayer():ConCommand("salary12 150")
  884. LocalPlayer():ConCommand("salary13 0")
  885. LocalPlayer():ConCommand("salary14 200")
  886. end
  887. salary2cat:SetContents(salary2panel)
  888. salary2cat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  889.  
  890. local HudWidthCat = HUDTABpanel:Add("DCollapsibleCategory")
  891. HudWidthCat:SetSize(230, 130)
  892. function HudWidthCat.Header:OnMousePressed() end
  893. HudWidthCat:SetLabel("HUD width")
  894. local HudWidthpanel = vgui.Create("DListLayout")
  895. HudWidthpanel:SetSize(230, 130)
  896. local HudWidth = HudWidthpanel:Add("DNumSlider")
  897. HudWidth:SetMinMax(0, ScrW() - 30)
  898. HudWidth:SetDecimals(0)
  899. HudWidth:SetConVar("HudW")
  900.  
  901. local resetHudWidth = HudWidthpanel:Add("DButton")
  902. resetHudWidth:SetText("Reset")
  903. resetHudWidth:SetSize(230, 20)
  904. resetHudWidth.DoClick = function()
  905. LocalPlayer():ConCommand("HudW 240")
  906. end
  907. HudWidthCat:SetContents(HudWidthpanel)
  908. HudWidthCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  909.  
  910. local HudHeightCat = HUDTABpanel:Add("DCollapsibleCategory")
  911. HudHeightCat:SetSize(230, 130)
  912. function HudHeightCat.Header:OnMousePressed() end
  913. HudHeightCat:SetLabel("HUD Height")
  914. local HudHeightpanel = vgui.Create("DListLayout")
  915. HudHeightpanel:SetSize(230, 130)
  916. local HudHeight = HudHeightpanel:Add("DNumSlider")
  917. HudHeight:SetMinMax(1, ScrW() - 20)
  918. HudHeight:SetDecimals(0)
  919. HudHeight:SetConVar("HudH")
  920.  
  921. local resetHudHeight = HudHeightpanel:Add("DButton")
  922. resetHudHeight:SetText("Reset")
  923. resetHudHeight:SetSize(230, 20)
  924. resetHudHeight.DoClick = function()
  925. LocalPlayer():ConCommand("HudH 110")
  926. end
  927. HudHeightCat:SetContents(HudHeightpanel)
  928. HudHeightCat:SetSkin(GAMEMODE.Config.DarkRPSkin)
  929. end
  930. HUDTABpanel:SetSkin(GAMEMODE.Config.DarkRPSkin)
  931. return HUDTABpanel
  932. end
  933.  
  934. local DefaultWeapons = {
  935. {name = "GravGun",class = "weapon_physcannon"},
  936. {name = "Physgun",class = "weapon_physgun"},
  937. {name = "Crowbar",class = "weapon_crowbar"},
  938. {name = "Stunstick",class = "weapon_stunstick"},
  939. {name = "Pistol",class = "weapon_pistol"},
  940. {name = "357", class = "weapon_357"},
  941. {name = "SMG", class = "weapon_smg1"},
  942. {name = "Shotgun", class = "weapon_shotgun"},
  943. {name = "Crossbow", class = "weapon_crossbow"},
  944. {name = "AR2", class = "weapon_ar2"},
  945. {name = "BugBait", class = "weapon_bugbait"},
  946. {name = "RPG", class = "weapon_rpg"},
  947. {name = "Tool gun", class = "gmod_tool"}
  948. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement