Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.94 KB | None | 0 0
  1. -----------------------------------------------------------------
  2. -- @package HUDHive
  3. -- @author Richard
  4. -- @email richard@iamrichardt.com
  5. -- @build v1.3.1
  6. -- @release 02.04.2016
  7. -----------------------------------------------------------------
  8.  
  9. -----------------------------------------------------------------
  10. -- [ TODO ]
  11. -- InitPost needs re-done.
  12. -----------------------------------------------------------------
  13.  
  14. HUDHive = HUDHive or {}
  15. HUDHive.Settings = HUDHive.Settings or {}
  16.  
  17. local WeaponAmmo = WeaponAmmo or {}
  18. local WeaponInfo = WeaponInfo or {}
  19. local HUDHiveInit = true
  20. local HUDNotes = HUDNotes or {}
  21. local HUDNote_c = 0
  22. local HUDNote_i = 1
  23.  
  24. -----------------------------------------------------------------
  25. -- [ CLIENT CONVARS ]
  26. -----------------------------------------------------------------
  27.  
  28. CreateClientConVar("hudhive_hide", 0, true, false)
  29.  
  30. -----------------------------------------------------------------
  31. -- [ DEFAULT DARKRP COLOR TABLE ]
  32. -----------------------------------------------------------------
  33.  
  34. local colors = {}
  35. colors.black = Color(0, 0, 0, 255)
  36. colors.blue = Color(0, 0, 255, 255)
  37. colors.brightred = Color(200, 30, 30, 255)
  38. colors.darkred = Color(0, 0, 70, 100)
  39. colors.darkblack = Color(0, 0, 0, 200)
  40. colors.gray1 = Color(0, 0, 0, 155)
  41. colors.gray2 = Color(51, 58, 51,100)
  42. colors.red = Color(255, 0, 0, 255)
  43. colors.white = Color(255, 255, 255, 255)
  44. colors.white1 = Color(255, 255, 255, 200)
  45.  
  46. -----------------------------------------------------------------
  47. -- [ IMAGES ]
  48. -----------------------------------------------------------------
  49.  
  50. local ImageGUIMain = Material(HUDHive.Settings.ImageGUIMain, "noclamp smooth")
  51. local ImageGUIAgenda = Material(HUDHive.Settings.ImageGUIAgenda, "noclamp smooth")
  52. local ImageGUIOther = Material(HUDHive.Settings.ImageGUIOther, "noclamp smooth")
  53. local ImageAgenda = Material(HUDHive.Settings.AgendaIcon, "noclamp smooth")
  54. local ImageAmmoIndicator = Material(HUDHive.Settings.AmmoIcon, "noclamp smooth")
  55. local ImageLeveling = Material(HUDHive.Settings.XPBoxLeftIcon, "noclamp smooth")
  56. local ImageLockdownIndicator = Material(HUDHive.Settings.LockdownIcon, "noclamp smooth")
  57. local ImageMoney = Material(HUDHive.Settings.MainMoneyIcon, "noclamp smooth")
  58. local ImageSalary = Material(HUDHive.Settings.MainSalaryIcon, "noclamp smooth")
  59. local ImageWantedIndicator = Material(HUDHive.Settings.WantedBoxIcon, "noclamp smooth")
  60. local ImageArrestedIndicator = Material(HUDHive.Settings.ArrestedIcon, "noclamp smooth")
  61. local ImageWeaponLicense = Material(HUDHive.Settings.HeadHudGunlicenseIcon, "noclamp smooth")
  62.  
  63. -----------------------------------------------------------------
  64. -- [ HIDE ELEMENTS ]
  65. -----------------------------------------------------------------
  66.  
  67. local ElementList = {
  68. ["DarkRP_HUD"] = true, // Controls all DarkRP huds including arrested, lockdown, etc
  69. ["DarkRP_LocalPlayerHUD"] = true, // Bottom left hud
  70. ["DarkRP_EntityDisplay"] = true, // Info for doors, vehicles, and above player head
  71. ["DarkRP_ZombieInfo"] = true, // Information from /showzombie
  72. ["DarkRP_Hungermod"] = true, // Hunger mod information
  73. ["DarkRP_Agenda"] = true, // Agenda hud
  74. ["CHudHealth"] = true, // Player health
  75. ["CHudBattery"] = true, // Suit battery
  76. ["CHudSuitPower"] = true, // Suit power
  77. ["CHudAmmo"] = true, // Weapon ammo
  78. ["CHudSecondaryAmmo"] = true, // Secondary weapon ammo
  79. }
  80.  
  81. local function HideElements( element )
  82. if ElementList[ element ] then
  83. return false
  84. end
  85. end
  86. hook.Add( "HUDShouldDraw", "HideElements", HideElements )
  87.  
  88. -----------------------------------------------------------------
  89. -- [ HELPERS ]
  90. -----------------------------------------------------------------
  91.  
  92. local blur = Material("pp/blurscreen")
  93. local function DrawBlurPanel( panel, amount, heavyness )
  94. local x, y = panel:LocalToScreen(0, 0)
  95. local scrW, scrH = ScrW(), ScrH()
  96.  
  97. surface.SetDrawColor( 255, 255, 255 )
  98. surface.SetMaterial( blur )
  99.  
  100. for i = 1, ( heavyness or 3 ) do
  101. blur:SetFloat( "$blur", ( i / 3 ) * ( amount or 6 ) )
  102. blur:Recompute()
  103.  
  104. render.UpdateScreenEffectTexture()
  105. surface.DrawTexturedRect( x * -1, y * -1, scrW, scrH )
  106. end
  107. end
  108.  
  109. function draw.MYOutlinedBox( x, y, w, h, thickness, clr )
  110. surface.SetDrawColor( clr )
  111. for i=0, thickness - 1 do
  112. surface.DrawOutlinedRect( x + i, y + i, w - i * 2, h - i * 2 )
  113. end
  114. end
  115.  
  116.  
  117. function draw.HHOutlinedBox(x, y, w, h, col, bordercol)
  118. surface.SetDrawColor(col)
  119. surface.DrawRect(x + 1, y + 1, w - 2, h - 2)
  120. surface.SetDrawColor(bordercol)
  121. surface.DrawOutlinedRect(x, y, w, h)
  122. end
  123.  
  124. function draw.HHOutlinedBoxThick( x, y, w, h, borderthick, clr )
  125. surface.SetDrawColor( clr )
  126. for i=0, borderthick - 1 do
  127. surface.DrawOutlinedRect( x + i, y + i, w - i * 2, h - i * 2 )
  128. end
  129. end
  130.  
  131. -----------------------------------------------------------------
  132. -- [ CLEAN PANELS ]
  133. -----------------------------------------------------------------
  134.  
  135. function HUDHive:CleanPanels()
  136. if IsValid(HUDHive.PanelMain) then HUDHive.PanelMain:Remove() end
  137. if IsValid(HUDHive.PanelAmmoMain) then HUDHive.PanelAmmoMain:Remove() end
  138. if IsValid(HUDHive.PanelAgendaMain) then HUDHive.PanelAgendaMain:Remove() end
  139. if IsValid(HUDHive.PanelLockdownMain) then HUDHive.PanelLockdownMain:Remove() end
  140. if IsValid(HUDHive.PanelWantedMain) then HUDHive.PanelWantedMain:Remove() end
  141. if IsValid(HUDHive.PanelXPMain) then HUDHive.PanelXPMain:Remove() end
  142. end
  143.  
  144. -----------------------------------------------------------------
  145. -- [ INITIALIZE ENTIRE HUD ]
  146. -----------------------------------------------------------------
  147.  
  148. local function HUDHiveInitPanel()
  149.  
  150. HUDHive:CleanPanels()
  151.  
  152. HUDHive.PanelMain = vgui.Create("DPanel")
  153. HUDHive.PanelMain:SetSize(HUDHive.Settings.MainBoxWidth, HUDHive.Settings.MainBoxHeight)
  154. HUDHive.PanelMain:SetPos(5, 5)
  155. if not HUDHive.Settings.MainEnabled then
  156. HUDHive.PanelMain:SetVisible(false)
  157. end
  158. HUDHive.PanelMain:ParentToHUD()
  159. HUDHive.PanelMain.Paint = function(self, w, h)
  160. if not HUDHive.Settings.BackgroundsEnable then
  161. DrawBlurPanel(self)
  162. draw.RoundedBox(3, 0, 0, w, h, HUDHive.Settings.BackgroundColorSolid )
  163. end
  164. end
  165.  
  166. -----------------------------------------------------------------
  167. -- [ HUD INSIDE CONTAINER ]
  168. -----------------------------------------------------------------
  169.  
  170. HUDHive.PanelHHContainer = vgui.Create("DPanel", HUDHive.PanelMain)
  171. HUDHive.PanelHHContainer:Dock(FILL)
  172. HUDHive.PanelHHContainer:DockMargin(5,5,5,5)
  173. HUDHive.PanelHHContainer.Paint = function(self, w, h) end
  174.  
  175. -----------------------------------------------------------------
  176. -- [ HTML BACKGROUND SUPPORT ]
  177. -----------------------------------------------------------------
  178.  
  179. if HUDHive.Settings.BackgroundsEnable then
  180. local DHTMLMainBackground = vgui.Create("DHTML", HUDHive.PanelMain)
  181. DHTMLMainBackground:SetSize(ScrW(), ScrH())
  182. DHTMLMainBackground:SetScrollbars(false)
  183. DHTMLMainBackground:SetHTML([[
  184. <body style="overflow: hidden; height: auto; width: auto;">
  185. <img src="]] .. table.Random(HUDHive.Settings.Backgrounds) .. [[" style="position: absolute; height: auto; width: auto; top: 0%; left: 0%; margin: auto;">
  186. </body>
  187. ]])
  188. DHTMLMainBackground.Paint = function(self, w, h) end
  189. end
  190.  
  191. -----------------------------------------------------------------
  192. -- [ LEFT PANEL ]
  193. -----------------------------------------------------------------
  194.  
  195. local PanelLeft = HUDHive.PanelMain:Add("DPanel", HUDHive.PanelHHContainer)
  196. PanelLeft:Dock(LEFT)
  197. PanelLeft:DockMargin(5,5,5,5)
  198. PanelLeft:SetWide(109)
  199. PanelLeft.Paint = function(self, w, h)
  200. if HUDHive.Settings.MainStatusShowIcons then
  201. local doPulse = math.abs( math.sin(CurTime() * HUDHive.Settings.MainStatusPulseSpeed or 2) * 200 )
  202.  
  203. -- Wanted
  204. if LocalPlayer():isWanted() then
  205. surface.SetDrawColor(Color( doPulse, doPulse, 0, 255 ))
  206. else
  207. surface.SetDrawColor(Color( 0, 0, 0, 255 ))
  208. end
  209. surface.SetMaterial(ImageWantedIndicator)
  210. surface.DrawTexturedRect(PanelLeft:GetWide()/2 - 34, 80, 16, 16)
  211.  
  212. -- Lockdown
  213. if GetGlobalBool("DarkRP_LockDown") then
  214. surface.SetDrawColor(Color( doPulse, doPulse, 0, 255 ))
  215. else
  216. surface.SetDrawColor(Color( 0, 0, 0, 255 ))
  217. end
  218. surface.SetMaterial(ImageLockdownIndicator)
  219. surface.DrawTexturedRect(PanelLeft:GetWide()/2 - 8, 80, 16, 16)
  220.  
  221. -- Gun License
  222. if LocalPlayer():getDarkRPVar("HasGunlicense") then
  223. surface.SetDrawColor(Color( 0, 255, 0, 255 ))
  224. else
  225. surface.SetDrawColor(Color( 0, 0, 0, 255 ))
  226. end
  227. surface.SetMaterial(ImageWeaponLicense)
  228. surface.DrawTexturedRect(PanelLeft:GetWide()/2 + 18, 80, 16, 16)
  229.  
  230. end
  231. end
  232.  
  233. local PanelRight = HUDHive.PanelMain:Add("DPanel", HUDHive.PanelHHContainer)
  234. PanelRight:Dock(FILL)
  235. PanelRight:DockMargin(0,5,0,0)
  236. PanelRight.Paint = function(self, w, h) end
  237.  
  238. -----------------------------------------------------------------
  239. -- [ LEGACY SALARY / MONEY COUNTER ]
  240. -----------------------------------------------------------------
  241.  
  242. if HUDHive.Settings.MainLegacyFundsEnabled then
  243.  
  244. local PanelBottom = HUDHive.PanelMain:Add("DPanel", HUDHive.PanelHHContainer)
  245. PanelBottom:Dock(BOTTOM)
  246. PanelBottom:DockMargin(0,0,0,0)
  247. PanelBottom:SetTall(35)
  248. PanelBottom:SetWide(109)
  249. PanelBottom.Paint = function(self, w, h)
  250.  
  251. if HUDHive.Settings.MainUseIconsMoneySalary then
  252.  
  253. surface.SetDrawColor( HUDHive.Settings.MainMoneyIconColor )
  254. surface.SetMaterial(ImageMoney)
  255. surface.DrawTexturedRect(10, 8, 16, 16)
  256.  
  257. local fundsYPos = 3
  258. if not HUDHive.Settings.CustomFontsEnabled then
  259. fundsYPos = 7
  260. end
  261.  
  262. draw.DrawText(DarkRP.formatMoney(LocalPlayer():getDarkRPVar("money")) or 0, "HHFontPlayerMoney", 32, fundsYPos, HUDHive.Settings.MainMoneyTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  263. surface.SetDrawColor( HUDHive.Settings.MainSalaryIconColor )
  264. surface.SetMaterial(ImageSalary)
  265. surface.DrawTexturedRect(w - 27, 7, 16, 16)
  266.  
  267. draw.DrawText(DarkRP.formatMoney(LocalPlayer():getDarkRPVar("salary")) or 0, "HHFontSalaryMoney", w - 32, fundsYPos, HUDHive.Settings.MainSalaryTitleTextColor, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  268.  
  269. else
  270.  
  271. draw.DrawText(string.upper(HUDHive.Language.money), "HHFontPlayerMoney", 10, 8, HUDHive.Settings.MainMoneyTitleTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  272. draw.DrawText(DarkRP.formatMoney(LocalPlayer():getDarkRPVar("money")) or 0, "HHFontPlayerMoney", w - 10, 0, HUDHive.Settings.MainMoneyTextColor, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  273.  
  274. draw.DrawText(string.upper(HUDHive.Language.salary), "HHFontSalaryMoney", 10, 21, HUDHive.Settings.MainSalaryTitleTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  275. draw.DrawText(DarkRP.formatMoney(LocalPlayer():getDarkRPVar("salary")) or 0, "HHFontSalaryMoney", w - 10, 21, HUDHive.Settings.MainSalaryTitleTextColor, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  276.  
  277. end
  278.  
  279. end
  280.  
  281. end
  282.  
  283. -----------------------------------------------------------------
  284. -- [ AVATAR ]
  285. -----------------------------------------------------------------
  286.  
  287. local PanelAvatar = HUDHive.PanelMain:Add("DPanel", PanelLeft)
  288. PanelAvatar:SetPos(22, 7)
  289. PanelAvatar:SetSize(74,74)
  290. PanelAvatar.Paint = function(self, w, h,)
  291.  
  292. local avatarBackgroundColor = HUDHive.Settings.MainAvatarBGColor
  293. if HUDHive.Settings.MainAvatarTeamBGColor then
  294. draw.MYOutlinedBox( 0, 0, PanelAvatar:GetWide(), PanelAvatar:GetTall(), 2, team.GetColor( LocalPlayer():Team() ) )
  295.  
  296. -- avatarBackgroundColor = team.GetColor( LocalPlayer():Team() )
  297. end
  298.  
  299. if LocalPlayer():isWanted() or GetGlobalBool("DarkRP_LockDown") then
  300. local doPulse = math.abs( math.sin(CurTime() * HUDHive.Settings.MainStatusPulseSpeed or 2) * 200 )
  301. avatarBackgroundColor = Color( doPulse, doPulse, 0, 100 )
  302. end
  303.  
  304. draw.RoundedBox(3, 0, 0, w, h, Color( avatarBackgroundColor.r, avatarBackgroundColor.g, avatarBackgroundColor.b, 200 ) )
  305. end
  306.  
  307. if HUDHive.Settings.MainAnimatedAvatarEnabled then
  308.  
  309. local PlayerModel = vgui.Create("DModelPanel", PanelAvatar)
  310. PlayerModel:SetModel(LocalPlayer():GetModel())
  311. PlayerModel:SetPos(5, 5)
  312. PlayerModel:SetSize(64, 64)
  313. PlayerModel:SetFOV(HUDHive.Settings.MainAnimatedFOV)
  314. PlayerModel:SetCamPos(HUDHive.Settings.MainAnimatedCamPOS)
  315. PlayerModel:SetLookAt(HUDHive.Settings.MainAnimatedLookAt)
  316. PlayerModel.Think = function()
  317. PlayerModel:SetModel(LocalPlayer():GetModel())
  318. local PlayerModelBGroup = ""
  319. local PlayerModelSkin = LocalPlayer():GetSkin() or 0
  320.  
  321. for n = 0, LocalPlayer():GetNumBodyGroups() do
  322. PlayerModelBGroup = PlayerModelBGroup .. LocalPlayer():GetBodygroup(n)
  323. end
  324. PlayerModel.Entity:SetBodyGroups(PlayerModelBGroup)
  325. PlayerModel.Entity:SetSkin(PlayerModelSkin)
  326. end
  327. PlayerModel.LayoutEntity = function(ent)
  328. return
  329. end
  330. function PlayerModel.Entity:GetPlayerColor() return LocalPlayer():GetPlayerColor() end
  331. function PlayerModel.Entity:GetSkin() return LocalPlayer():GetSkin() end
  332.  
  333.  
  334. else
  335.  
  336. local AvatarPlayer = vgui.Create("AvatarImage", PanelAvatar)
  337. AvatarPlayer:SetSize( 64, 64 )
  338. AvatarPlayer:SetPlayer(LocalPlayer(), 64)
  339. AvatarPlayer:SetPos(5, 5)
  340.  
  341. end
  342.  
  343. -----------------------------------------------------------------
  344. -- [ LEFT PANEL TEXT ]
  345. -----------------------------------------------------------------
  346.  
  347. local LabelPlayerName = vgui.Create("DLabel", PanelLeft)
  348. LabelPlayerName:SetColor(HUDHive.Settings.MainPlayerNameTextColor)
  349. LabelPlayerName:SetFont("HHFontPlayernameText")
  350. LabelPlayerName:SetSize( LabelPlayerName:GetParent():GetWide(), 32)
  351. LabelPlayerName:Dock(FILL)
  352. LabelPlayerName:DockMargin(0, 90, 0, 0)
  353. LabelPlayerName:SetContentAlignment(5)
  354. LabelPlayerName:SetText("")
  355. timer.Create( "UpdatePlayername", 1, 0, function()
  356. -- LabelPlayerName:SetText(LocalPlayer():Nick())
  357. LabelPlayerName:SetText("")
  358. end)
  359.  
  360. local LabelPlayerJob = vgui.Create("DLabel", PanelLeft)
  361. LabelPlayerJob:SetColor(HUDHive.Settings.MainPlayerJobTextColor)
  362. LabelPlayerJob:SetFont("HHFontJobText")
  363. LabelPlayerJob:SetSize( LabelPlayerName:GetParent():GetWide(), 32)
  364. LabelPlayerJob:Dock(FILL)
  365. LabelPlayerJob:DockMargin(0,0,0,0)
  366. LabelPlayerJob:SetContentAlignment(2)
  367. LabelPlayerJob:SetText("")
  368. LabelPlayerJob.Paint = function(self, w, h)
  369. draw.DrawText(LocalPlayer():getDarkRPVar("job") or "", "HHFontJobText", w / 2, h - 22, HUDHive.Settings.MainPlayerJobTextColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  370. end
  371.  
  372. -----------------------------------------------------------------
  373. -- [ FUNCTION -> CREATE BLOCK ]
  374. -----------------------------------------------------------------
  375. -- Each block will be cycled through the function via the config
  376. -- file.
  377. -----------------------------------------------------------------
  378. -- [ blockName ]
  379. -- The name of the block (Health, XP, etc)
  380. -----------------------------------------------------------------
  381. -- [blockType]
  382. -- This specifies an ID for the block to decide what data to pull
  383. -----------------------------------------------------------------
  384. -- [ blockMax ]
  385. -- The max value for the block. <number / maxvalue>
  386. -----------------------------------------------------------------
  387. -- [ blockIconEnabled ]
  388. -- If you want to use icons, true for icon - false for text
  389. -----------------------------------------------------------------
  390. -- [ blockIcon ]
  391. -- If you want to use icons, this will be the image that you
  392. -- want to use
  393. -----------------------------------------------------------------
  394. -- [ blockLabelColor ]
  395. -- The text color for the blockName
  396. -----------------------------------------------------------------
  397. -- [ blockBarColor ]
  398. -- The color of the progress bar
  399. -----------------------------------------------------------------
  400. -- [ blockIconColor ]
  401. -- The color of the icon.
  402. -----------------------------------------------------------------
  403.  
  404. local function CreateBlock( blockName, blockSpacer, blockType, blockMax, blockIconEnabled, blockIcon, blockLabelColor, blockBarColor, blockIconColor )
  405.  
  406. local CalcProg = 0
  407. local Spacer = blockSpacer or 0
  408.  
  409. -----------------------------------------------------------------
  410. -- [ CreateBlock - > Primary Container ]
  411. -----------------------------------------------------------------
  412.  
  413. HUDHive.PanelBlockContainer = vgui.Create("DPanel", PanelRight)
  414. HUDHive.PanelBlockContainer:Dock(TOP)
  415. HUDHive.PanelBlockContainer:DockMargin(5, 0, 5, Spacer)
  416. HUDHive.PanelBlockContainer:SetTall(20)
  417. HUDHive.PanelBlockContainer.Paint = function(self, w, h) end
  418.  
  419. -----------------------------------------------------------------
  420. -- [ CreateBlock - > Progress Bar ]
  421. -----------------------------------------------------------------
  422.  
  423. local PanelBlockProgress = HUDHive.PanelBlockContainer:Add("DPanel")
  424. PanelBlockProgress:SetSize(10, 18)
  425. PanelBlockProgress:DockMargin(5, 1, 5, 1)
  426. PanelBlockProgress:Dock(TOP)
  427. PanelBlockProgress.Paint = function(self, w, h)
  428.  
  429. surface.SetDrawColor(HUDHive.Settings.MainBarBackgroundColor)
  430. surface.DrawRect(0, 0, w, h)
  431.  
  432. surface.SetDrawColor(blockBarColor)
  433. surface.DrawRect(0, 0, w*(math.Clamp(CalcProg or 0, 0, 1)), h)
  434.  
  435. surface.SetDrawColor(Color(10,10,10,66))
  436. surface.DrawRect(0, 9, w*(math.Clamp(CalcProg or 0, 0, 1)), h)
  437.  
  438. draw.HHOutlinedBoxThick( 0, 0, w, h, 1, HUDHive.Settings.MainBarOutlineColor )
  439.  
  440. end
  441. PanelBlockProgress.Think = function()
  442.  
  443. if not IsValid(LocalPlayer()) then return end
  444.  
  445. local getBlockData
  446. if blockType == "money" then getBlockData = LocalPlayer():getDarkRPVar("money")
  447. elseif blockType == "salary" then getBlockData = LocalPlayer():getDarkRPVar("salary")
  448. elseif blockType == "health" then getBlockData = LocalPlayer():Health()
  449. elseif blockType == "armor" then getBlockData = LocalPlayer():Armor()
  450. elseif blockType == "hunger" then getBlockData = math.Round(LocalPlayer():getDarkRPVar( "Energy" ) or 0)
  451. elseif blockType == "stamina" then getBlockData = LocalPlayer():getDarkRPVar("Stamina") or LocalPlayer():getDarkRPVar("stamina") or LocalPlayer():GetNWInt("tcb_Stamina") or LocalPlayer():GetNWFloat("stamina",0)
  452. elseif blockType == "xp" and (DARKRP_LVL_SYSTEM or LevelSystemConfiguration) then
  453. local playerLevel = LocalPlayer():getDarkRPVar('level') or LocalPlayer():getDarkRPVar('lvl') or 0
  454. local playerXP = LocalPlayer():getDarkRPVar('xp') or 0
  455. local expFormat = 0
  456. local calcXP = 0
  457. if LevelSystemConfiguration then
  458. local xpPercent = ( ( playerXP or 0 ) / ( ( ( 10 + ( ( ( playerLevel or 1 ) * ( ( playerLevel or 1 ) + 1 ) * 90 ) ) ) ) * LevelSystemConfiguration.XPMult or 1.0 ) ) or 0
  459. calcXP = xpPercent * 100 or 0
  460. calcXP = math.Round(calcXP) or 0
  461. expFormat = math.Clamp(calcXP, 0, 99)
  462. getBlockData = expFormat
  463. elseif DARKRP_LVL_SYSTEM then
  464. local formatPlayerlevel = DARKRP_LVL_SYSTEM["XP"][tonumber(playerLevel)]
  465. if not formatPlayerlevel then return end
  466. playerXP = math.floor(playerXP) or 0
  467. calcXP = (playerXP*100/formatPlayerlevel) or 0
  468. expFormat = math.floor(calcXP) or 0
  469. getBlockData = expFormat
  470. end
  471. else getBlockData = "0"
  472. end
  473.  
  474. local prog = getBlockData / blockMax
  475. CalcProg = Lerp(FrameTime()*3, CalcProg or 0, prog or 0)
  476.  
  477. end
  478.  
  479. -----------------------------------------------------------------
  480. -- [ CreateBlock - > Block Progress ]
  481. -----------------------------------------------------------------
  482. -- Label for LEFT side of each block. You can either have the
  483. -- text label display or you can utilize icons only.
  484. -----------------------------------------------------------------
  485. -- ICONS ONLY: HUDHive.Settings.MainBarsUseIcons = true
  486. -- TEXT ONLY: HUDHive.Settings.MainBarsUseIcons = false
  487. -----------------------------------------------------------------
  488.  
  489. local LabelBlockName = vgui.Create("DLabel", PanelBlockProgress)
  490. LabelBlockName:Dock(LEFT)
  491. LabelBlockName:DockMargin(3,2,2,2)
  492. LabelBlockName:SetWide(250)
  493. LabelBlockName:SetFont("HHFontBlockInfo")
  494. LabelBlockName:SetText("")
  495. LabelBlockName.Paint = function(self, w, h)
  496. if blockIconEnabled then
  497. local ImageBlock = Material(blockIcon, "noclamp smooth")
  498. surface.SetDrawColor(blockIconColor or Color( 255, 255, 255, 255 ))
  499. surface.SetMaterial(ImageBlock)
  500. surface.DrawTexturedRect(1, 1, 12, 12)
  501. else
  502. LabelBlockName:SetText(blockName)
  503. end
  504. end
  505.  
  506. -----------------------------------------------------------------
  507. -- [ CreateBlock - > Block Progress ]
  508. -----------------------------------------------------------------
  509. -- Label for RIGHT side of each block. The right side displays
  510. -- the current progress of each item. You can either have this
  511. -- progress information or you can hide it.
  512. -----------------------------------------------------------------
  513. -- Show progress: HUDHive.Settings.MainBarsShowProgress = true
  514. -- Hide progress: HUDHive.Settings.MainBarsShowProgress = false
  515. -----------------------------------------------------------------
  516.  
  517. local LabelBlockNameR = vgui.Create("DLabel", PanelBlockProgress)
  518. LabelBlockNameR:Dock(RIGHT)
  519. LabelBlockNameR:DockMargin(3,2,5,2)
  520. LabelBlockNameR:SetWide(75)
  521. LabelBlockNameR:SetFont("HHFontBlockInfo")
  522. LabelBlockNameR:SetText("")
  523. LabelBlockNameR:SetContentAlignment(6)
  524. LabelBlockNameR.Paint = function(self, w, h)
  525. local getBlockData
  526. if blockType == "money" then getBlockData = DarkRP.formatMoney(LocalPlayer():getDarkRPVar("money")) or 0
  527. elseif blockType == "salary" then getBlockData = DarkRP.formatMoney(LocalPlayer():getDarkRPVar("salary")) .. " / " .. HUDHive.Language.hour
  528. elseif blockType == "health" then getBlockData = LocalPlayer():Health()
  529. elseif blockType == "armor" then getBlockData = LocalPlayer():Armor()
  530. elseif blockType == "hunger" then getBlockData = math.Round(LocalPlayer():getDarkRPVar( "Energy" ) or 0)
  531. elseif blockType == "stamina" then getBlockData = LocalPlayer():getDarkRPVar("Stamina") or LocalPlayer():getDarkRPVar("stamina") or LocalPlayer():GetNWInt("tcb_Stamina") or LocalPlayer():GetNWFloat("stamina",0)
  532. elseif blockType == "xp" and (DARKRP_LVL_SYSTEM or LevelSystemConfiguration) then
  533. local playerLevel = LocalPlayer():getDarkRPVar('level') or LocalPlayer():getDarkRPVar('lvl') or 0
  534. local playerXP = LocalPlayer():getDarkRPVar('xp') or 0
  535. local expFormat = 0
  536. local calcXP = 0
  537. if LevelSystemConfiguration then
  538. local xpPercent = ( ( playerXP or 0 ) / ( ( ( 10 + ( ( ( playerLevel or 1 ) * ( ( playerLevel or 1 ) + 1 ) * 90 ) ) ) ) * LevelSystemConfiguration.XPMult or 1.0 ) )
  539. calcXP = xpPercent * 100
  540. calcXP = math.Round(calcXP)
  541. expFormat = math.Clamp(calcXP, 0, 99)
  542. getBlockData = expFormat
  543. elseif DARKRP_LVL_SYSTEM then
  544. local formatPlayerlevel = DARKRP_LVL_SYSTEM["XP"][tonumber(playerLevel)]
  545. if not formatPlayerlevel then return end
  546. playerXP = math.floor(playerXP)
  547. calcXP = (playerXP*100/formatPlayerlevel) or 0
  548. expFormat = math.floor(calcXP)
  549. getBlockData = expFormat
  550. end
  551. else getBlockData = "0"
  552. end
  553. if HUDHive.Settings.MainBarsShowProgress then
  554. LabelBlockNameR:SetText(getBlockData)
  555. end
  556. end
  557.  
  558. return HUDHive.PanelBlockContainer
  559.  
  560. end
  561.  
  562. for k, v in pairs( HUDHive.Settings.Datablocks ) do
  563.  
  564. if not v.enabled then continue end
  565.  
  566. local getBlockData
  567. if blockType == "money" then getBlockData = DarkRP.formatMoney(LocalPlayer():getDarkRPVar("money")) or 0
  568. elseif blockType == "salary" then getBlockData = DarkRP.formatMoney(LocalPlayer():getDarkRPVar("salary")) or 0
  569. elseif blockType == "health" then getBlockData = LocalPlayer():Health()
  570. elseif blockType == "armor" then getBlockData = LocalPlayer():Armor()
  571. elseif blockType == "hunger" then getBlockData = math.Round(LocalPlayer():getDarkRPVar( "Energy" ) or 0)
  572. elseif blockType == "stamina" then getBlockData = LocalPlayer():getDarkRPVar("Stamina") or LocalPlayer():getDarkRPVar("stamina") or LocalPlayer():GetNWInt("tcb_Stamina") or LocalPlayer():GetNWFloat("stamina",0)
  573. elseif blockType == "xp" and (DARKRP_LVL_SYSTEM or LevelSystemConfiguration) then
  574. local playerLevel = LocalPlayer():getDarkRPVar('level') or LocalPlayer():getDarkRPVar('lvl') or 0
  575. local playerXP = LocalPlayer():getDarkRPVar('xp') or 0
  576. local expFormat = 0
  577. local calcXP = 0
  578. if LevelSystemConfiguration then
  579. local xpPercent = ( ( playerXP or 0 ) / ( ( ( 10 + ( ( ( playerLevel or 1 ) * ( ( playerLevel or 1 ) + 1 ) * 90 ) ) ) ) * LevelSystemConfiguration.XPMult or 1.0 ) )
  580. calcXP = xpPercent * 100
  581. calcXP = math.Round(calcXP)
  582. expFormat = math.Clamp(calcXP, 0, 99)
  583. getBlockData = expFormat
  584. elseif DARKRP_LVL_SYSTEM then
  585. playerXP = math.floor(playerXP)
  586. calcXP = (playerXP*100/formatPlayerlevel) or 0
  587. expFormat = math.floor(calcXP)
  588. getBlockData = expFormat
  589. end
  590. else getBlockData = "0"
  591. end
  592. local prog = getBlockData / v.blockMax
  593.  
  594. local ItemHealth = CreateBlock(v.blockName, v.blockSpacer, v.blockType, v.blockMax, v.blockIconEnabled, v.blockIcon, v.blockLabelColor, v.blockBarColor, v.blockIconColor)
  595. ItemHealth.mat = MatHealth
  596.  
  597. end
  598.  
  599. -----------------------------------------------------------------
  600. -- [ AMMO PANEL ]
  601. -----------------------------------------------------------------
  602.  
  603. HUDHive.PanelAmmoMain = vgui.Create("DPanel")
  604. HUDHive.PanelAmmoMain:SetSize(HUDHive.Settings.AmmoBoxWidth, HUDHive.Settings.AmmoBoxHeight)
  605. if not HUDHive.Settings.AmmoEnabled then
  606. HUDHive.PanelAmmoMain:SetVisible(false)
  607. end
  608. if HUDHive.Settings.XPAmmoPosition == 1 then
  609. HUDHive.PanelAmmoMain:SetPos(5, 5)
  610. elseif HUDHive.Settings.XPAmmoPosition == 2 then
  611. HUDHive.PanelAmmoMain:SetPos(ScrW() - HUDHive.PanelAmmoMain:GetWide() - 5, 5)
  612. elseif HUDHive.Settings.XPAmmoPosition == 3 then
  613. HUDHive.PanelAmmoMain:SetPos(5, ScrH() - HUDHive.PanelAmmoMain:GetTall() - 5)
  614. elseif HUDHive.Settings.XPAmmoPosition == 4 then
  615. HUDHive.PanelAmmoMain:SetPos(ScrW() - HUDHive.PanelAmmoMain:GetWide() - 5, ScrH() - HUDHive.PanelAmmoMain:GetTall() - 5)
  616. end
  617. HUDHive.PanelAmmoMain:ParentToHUD()
  618. HUDHive.PanelAmmoMain.Paint = function(self, w, h)
  619. if not HUDHive.Settings.BackgroundsEnable and HUDHive.PanelAmmoMain:IsVisible() then
  620. DrawBlurPanel(self)
  621. draw.RoundedBox(3, 0, 0, w, h, HUDHive.Settings.BackgroundColorSolid )
  622. end
  623. end
  624.  
  625. -----------------------------------------------------------------
  626. -- [ HTML BACKGROUND SUPPORT ]
  627. -----------------------------------------------------------------
  628.  
  629. if HUDHive.Settings.BackgroundsEnable then
  630.  
  631. local DHTMLAmmoBackground = vgui.Create("DHTML", HUDHive.PanelAmmoMain)
  632. DHTMLAmmoBackground:SetSize(ScrW(), ScrH())
  633. DHTMLAmmoBackground:SetScrollbars(false)
  634. DHTMLAmmoBackground:SetHTML([[
  635. <body style="overflow: hidden; height: auto; width: auto;">
  636. <img src="]] .. table.Random(HUDHive.Settings.BackgroundsOther) .. [[" style="position: absolute; height: auto; width: auto; top: 0%; left: 0%; margin: auto;">
  637. </body>
  638. ]])
  639. DHTMLAmmoBackground.Paint = function(self, w, h) end
  640.  
  641. end
  642.  
  643. local PanelAmmoContainer = vgui.Create("DPanel", HUDHive.PanelAmmoMain)
  644. PanelAmmoContainer:SetSize(HUDHive.PanelAmmoMain:GetWide(), HUDHive.PanelAmmoMain:GetTall())
  645. PanelAmmoContainer.Paint = function(self, w, h)
  646.  
  647. local PlayerWeapon = LocalPlayer():GetActiveWeapon()
  648. if !IsValid(PlayerWeapon) then return end
  649.  
  650. local ImageAmmoColor = Color(HUDHive.Settings.AmmoIconNormalColor.r,HUDHive.Settings.AmmoIconNormalColor.g,HUDHive.Settings.AmmoIconNormalColor.b)
  651. local FBReloadBaseAlpha = 0
  652. local FBReloadIconAlpha = 1
  653.  
  654. local FBMagMax = 0
  655. if PlayerWeapon.Primary then
  656. FBMagMax = PlayerWeapon.Primary.ClipSize or 0
  657. end
  658.  
  659. local countAmmoClip = tonumber(PlayerWeapon:Clip1()) or 0
  660. local countAmmoTotal = LocalPlayer():GetAmmoCount(PlayerWeapon:GetPrimaryAmmoType() or "")
  661.  
  662. if (PlayerWeapon:Clip1() <= FBMagMax / 3 and FBMagMax > 0) or (countAmmoClip < 3) then
  663. FBReloadBaseAlpha = math.Clamp(FBReloadBaseAlpha + 40,0,255)
  664. FBReloadIconAlpha = 255 * math.sin(CurTime() * 5)
  665. ImageAmmoColor = Color(HUDHive.Settings.AmmoIconWarningColor.r,HUDHive.Settings.AmmoIconWarningColor.g,HUDHive.Settings.AmmoIconWarningColor.b)
  666. else
  667. FBReloadBaseAlpha = math.Clamp(FBReloadBaseAlpha - 40,0,255)
  668. FBReloadIconAlpha = 255
  669. end
  670.  
  671. draw.RoundedBox(0, 0, 0, w, h, Color(15,15,15,200))
  672.  
  673. surface.SetDrawColor(ImageAmmoColor.r,ImageAmmoColor.g,ImageAmmoColor.b,FBReloadIconAlpha)
  674. surface.SetMaterial(ImageAmmoIndicator)
  675. if HUDHive.Settings.AmmoBarEnabled then
  676. surface.DrawTexturedRect(w/2 - 18, h/2 - 20, 32, 32)
  677. else
  678. surface.DrawTexturedRect(w/2 - 18, h/2 - 15, 32, 32)
  679. end
  680.  
  681. end
  682.  
  683. HUDHive.PanelAmmoBox_Left = HUDHive.PanelAmmoMain:Add("DPanel")
  684. HUDHive.PanelAmmoBox_Left:DockMargin(5,5,5,5)
  685. HUDHive.PanelAmmoBox_Left:Dock(LEFT)
  686. HUDHive.PanelAmmoBox_Left.Paint = function(self, w, h)
  687. local PlayerWeapon = LocalPlayer():GetActiveWeapon()
  688. if !IsValid(PlayerWeapon) then return end
  689.  
  690. local countAmmoClip = tonumber(PlayerWeapon:Clip1()) or nil
  691.  
  692. local positionHeight = 15
  693. if HUDHive.Settings.AmmoBarEnabled then
  694. positionHeight = 21
  695. end
  696.  
  697. local positionYMargin = 20
  698. local positionCountYMargin = 20
  699. if not HUDHive.Settings.CustomFontsEnabled then
  700. positionYMargin = 26
  701. positionCountYMargin = 10
  702. end
  703.  
  704. if countAmmoClip == nil or countAmmoClip == -1 then
  705. countAmmoClip = "-"
  706. end
  707.  
  708. draw.DrawText(countAmmoClip, "HHFontAmmoCount", w / 2, h / 2 - positionHeight - positionCountYMargin, HUDHive.Settings.AmmoTextCountColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  709. draw.DrawText(string.upper(HUDHive.Language.ammoclip), "HHFontAmmoType", w / 2, h / 2 - positionHeight + positionYMargin, HUDHive.Settings.AmmoTextTitleColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  710. end
  711.  
  712. HUDHive.PanelAmmoBox_Right = HUDHive.PanelAmmoMain:Add("DPanel")
  713. HUDHive.PanelAmmoBox_Right:DockMargin(5,5,5,5)
  714. HUDHive.PanelAmmoBox_Right:Dock(FILL)
  715. HUDHive.PanelAmmoBox_Right.Paint = function(self, w, h)
  716. local PlayerWeapon = LocalPlayer():GetActiveWeapon()
  717. if !IsValid(PlayerWeapon) then return end
  718.  
  719. local countAmmoTotal = LocalPlayer():GetAmmoCount(PlayerWeapon:GetPrimaryAmmoType() or "")
  720. local positionHeight = 15
  721. if HUDHive.Settings.AmmoBarEnabled then
  722. positionHeight = 21
  723. end
  724.  
  725. local positionYMargin = 20
  726. local positionCountYMargin = 20
  727. if not HUDHive.Settings.CustomFontsEnabled then
  728. positionYMargin = 26
  729. positionCountYMargin = 10
  730. end
  731.  
  732. if countAmmoTotal == nil or countAmmoTotal == "" then
  733. countAmmoTotal = "-"
  734. end
  735.  
  736. draw.DrawText(countAmmoTotal, "HHFontAmmoCount", w / 2, h / 2 - positionHeight - positionCountYMargin, HUDHive.Settings.AmmoTextCountColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  737. draw.DrawText(string.upper(HUDHive.Language.ammoexta), "HHFontAmmoType", w / 2, h / 2 - positionHeight + positionYMargin, HUDHive.Settings.AmmoTextTitleColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  738. end
  739. HUDHive.PanelAmmoBox_Right.Think = function() end
  740.  
  741. if HUDHive.Settings.AmmoBarEnabled then
  742.  
  743. -----------------------------------------------------------------
  744. -- [ AMMO PANEL -> PROGRESS BAR ]
  745. -----------------------------------------------------------------
  746.  
  747. local PanelHHAmmoBar = vgui.Create("DPanel", HUDHive.PanelAmmoMain)
  748. PanelHHAmmoBar:SetSize(HUDHive.PanelAmmoMain:GetWide(), 15)
  749. PanelHHAmmoBar:SetPos(0, HUDHive.PanelAmmoMain:GetTall() - 15)
  750. PanelHHAmmoBar.Paint = function(self, w, h)
  751.  
  752. local PlayerWeapon = LocalPlayer():GetActiveWeapon()
  753. if !IsValid(PlayerWeapon) then return end
  754.  
  755. local clipAmount = tonumber(PlayerWeapon:Clip1()) or nil
  756.  
  757. local clipCapacity = 0
  758. if PlayerWeapon.Primary then
  759. clipCapacity = tonumber(PlayerWeapon.Primary.ClipSize or 0)
  760. else
  761. clipCapacity = tonumber(PlayerWeapon:GetMaxClip1())
  762. end
  763.  
  764. local ammoBarW = HUDHive.PanelAmmoMain:GetWide()
  765. local calcAmmo = clipAmount/clipCapacity
  766.  
  767. surface.SetDrawColor(Color(15,15,15,255))
  768. surface.DrawRect(0, 0, w, h)
  769.  
  770. draw.RoundedBox(0, 0, 0, math.Clamp( ammoBarW * calcAmmo, 0, ammoBarW ), h, HUDHive.Settings.AmmoBarColor)
  771. surface.SetDrawColor(Color(10,10,10,66))
  772. surface.DrawRect(0, 9, math.Clamp( ammoBarW * calcAmmo, 0, ammoBarW ), h)
  773.  
  774. draw.HHOutlinedBoxThick( 0, 0, w, h, 1, Color( 80, 80, 80, 100 ) )
  775.  
  776. end
  777. end
  778.  
  779. -----------------------------------------------------------------
  780. -- [ EXPERIENCE (XP) SYSTEM INTEGRATION ]
  781. -----------------------------------------------------------------
  782.  
  783. HUDHive.PanelXPMain = vgui.Create("DPanel")
  784. if HUDHive.Settings.XPBarEnabled then
  785. HUDHive.PanelXPMain:SetSize(220, 45)
  786. else
  787. HUDHive.PanelXPMain:SetSize(220, 35)
  788. end
  789. HUDHive.PanelXPMain:SetPos(ScrW() - HUDHive.PanelXPMain:GetWide() - 5, ScrH() - HUDHive.PanelXPMain:GetTall() - 5)
  790. HUDHive.PanelXPMain:ParentToHUD()
  791. if not (LevelSystemConfiguration or DARKRP_LVL_SYSTEM) and not HUDHive.Settings.XPEnabled then
  792. HUDHive.PanelXPMain:SetVisible(false)
  793. else
  794. HUDHive.PanelXPMain:SetVisible(true)
  795. end
  796.  
  797. HUDHive.PanelXPMain.Paint = function(self, w, h)
  798. if not HUDHive.Settings.BackgroundsEnable and HUDHive.PanelXPMain:IsVisible(true) then
  799. DrawBlurPanel(self)
  800. draw.RoundedBox(3, 0, 0, w, h, HUDHive.Settings.BackgroundColorSolid )
  801. end
  802. end
  803.  
  804. if HUDHive.Settings.XPEnabled and (LevelSystemConfiguration or DARKRP_LVL_SYSTEM) then
  805.  
  806. if HUDHive.Settings.BackgroundsEnable then
  807.  
  808. local DHTMLXPBackground = vgui.Create("DHTML", HUDHive.PanelXPMain)
  809. DHTMLXPBackground:SetSize(ScrW(), ScrH())
  810. DHTMLXPBackground:SetScrollbars(false)
  811. DHTMLXPBackground:SetHTML([[
  812. <body style="overflow: hidden; height: auto; width: auto;">
  813. <img src="]] .. table.Random(HUDHive.Settings.BackgroundsOther) .. [[" style="position: absolute; height: auto; width: auto; top: 0%; left: 0%; margin: auto;">
  814. </body>
  815. ]])
  816. DHTMLXPBackground.Paint = function(self, w, h) end
  817.  
  818. end
  819.  
  820. local PanelXPContainer = vgui.Create("DPanel", HUDHive.PanelXPMain)
  821. PanelXPContainer:SetSize(HUDHive.PanelXPMain:GetWide(), HUDHive.PanelXPMain:GetTall())
  822. PanelXPContainer.Paint = function(self, w, h)
  823. local PlayerWeapon = LocalPlayer():GetActiveWeapon()
  824. if !IsValid(PlayerWeapon) then return end
  825. local playerLevel = LocalPlayer():getDarkRPVar('level') or LocalPlayer():getDarkRPVar('lvl') or 0
  826. local playerXP = LocalPlayer():getDarkRPVar('xp') or 0
  827. local expFormat = 0
  828. local calcXP = 0
  829.  
  830. if LevelSystemConfiguration then
  831. local xpPercent = ( ( playerXP or 0 ) / ( ( ( 10 + ( ( ( playerLevel or 1 ) * ( ( playerLevel or 1 ) + 1 ) * 90 ) ) ) ) * LevelSystemConfiguration.XPMult or 1.0 ) )
  832. calcXP = xpPercent * 100
  833. calcXP = math.Round(calcXP)
  834. expFormat = math.Clamp(calcXP, 0, 99)
  835. elseif DARKRP_LVL_SYSTEM then
  836. local formatPlayerlevel = DARKRP_LVL_SYSTEM["XP"][tonumber(playerLevel)]
  837. if not formatPlayerlevel then return end
  838. playerXP = math.floor(playerXP)
  839. calcXP = (playerXP*100/formatPlayerlevel) or 0
  840. expFormat = math.floor(calcXP)
  841. end
  842.  
  843. draw.RoundedBox(0, 0, 0, w, h, Color(15, 15, 15, 200))
  844.  
  845. local ImageHeight = 4
  846. local TextHeight = 2
  847. if not HUDHive.Settings.XPBarEnabled then
  848. ImageHeight = 7
  849. TextHeight = 5
  850. end
  851.  
  852. if HUDHive.Settings.XPBoxLeftShowIcon then
  853. surface.SetDrawColor(HUDHive.Settings.XPIconColor)
  854. surface.SetMaterial(ImageLeveling)
  855. surface.DrawTexturedRect(5, ImageHeight, 22, 22)
  856. end
  857.  
  858. local xpYOffset = TextHeight
  859. local perYOffset = TextHeight
  860. if not HUDHive.Settings.CustomFontsEnabled then
  861. xpYOffset = TextHeight + 5
  862. perYOffset = TextHeight + 5
  863. end
  864.  
  865. if HUDHive.Settings.XPBoxLeftShowLevel then
  866. draw.DrawText(string.upper(HUDHive.Language.level) .. " " .. playerLevel or 0, "HHFontXPInfo", 35, xpYOffset, HUDHive.Settings.XPBoxLeftLevelTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  867. end
  868.  
  869. if HUDHive.Settings.XPBoxRightShowProgress then
  870. draw.DrawText(expFormat .. "%", "HHFontXPInfo", w - 8, perYOffset, HUDHive.Settings.XPBoxRightProgressTextColor, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  871. end
  872.  
  873. end
  874.  
  875. -----------------------------------------------------------------
  876. -- [ XP SYSTEM -> BAR ]
  877. -----------------------------------------------------------------
  878.  
  879. if HUDHive.Settings.XPBarEnabled then
  880.  
  881. local PanelXPBar = vgui.Create("DPanel", HUDHive.PanelXPMain)
  882. PanelXPBar:SetSize(HUDHive.PanelXPMain:GetWide(), 15)
  883. PanelXPBar:SetPos(0, HUDHive.PanelXPMain:GetTall() - 15)
  884. PanelXPBar.Paint = function(self, w, h)
  885.  
  886. local levelBarW = HUDHive.PanelXPMain:GetWide()
  887. local playerLevel = LocalPlayer():getDarkRPVar('level') or LocalPlayer():getDarkRPVar('lvl') or 0
  888. local playerXP = LocalPlayer():getDarkRPVar('xp') or 0
  889. local expFormat = 0
  890. local calcXP = 0
  891. local calcLevelProgress = 0
  892.  
  893. if LevelSystemConfiguration then
  894. local xpPercent = ( ( playerXP or 0 ) / ( ( ( 10 + ( ( ( playerLevel or 1 ) * ( ( playerLevel or 1 ) + 1 ) * 90 ) ) ) ) * LevelSystemConfiguration.XPMult or 1.0 ) )
  895. calcXP = xpPercent * 100
  896. calcXP = math.Round(calcXP)
  897. expFormat = math.Clamp(calcXP, 0, 99)
  898. calcLevelProgress = expFormat / 100
  899. elseif DARKRP_LVL_SYSTEM then
  900. local formatPlayerlevel = DARKRP_LVL_SYSTEM["XP"][tonumber(playerLevel)]
  901. if not formatPlayerlevel then return end
  902. playerXP = math.floor(playerXP)
  903. calcXP = (playerXP*100/formatPlayerlevel) or 0
  904. expFormat = math.Clamp(calcXP, 0, 99)
  905. calcLevelProgress = expFormat / 100
  906. end
  907.  
  908. surface.SetDrawColor(HUDHive.Settings.XPBarBackgroundColor)
  909. surface.DrawRect(0, 0, w, h)
  910.  
  911. draw.RoundedBox(0, 0, 0, math.Clamp( levelBarW * calcLevelProgress, 0, levelBarW ), h, HUDHive.Settings.XPBarProgressColor)
  912. surface.SetDrawColor(Color(10,10,10,66))
  913. surface.DrawRect(0, 9, math.Clamp( levelBarW * calcLevelProgress, 0, levelBarW ), h)
  914.  
  915. draw.HHOutlinedBoxThick( 0, 0, w, h, 1, HUDHive.Settings.XPBarOutlineColor )
  916.  
  917. end
  918.  
  919. local LabelBlockName = vgui.Create("DLabel", PanelXPBar)
  920. LabelBlockName:Dock(LEFT)
  921. LabelBlockName:DockMargin(3,2,2,1)
  922. LabelBlockName:SetWide(250)
  923. LabelBlockName:SetFont("HHFontBlockInfo")
  924. LabelBlockName:SetText("")
  925. LabelBlockName.Paint = function(self, w, h)
  926. LabelBlockName:SetText("XP")
  927. end
  928.  
  929. local LabelBlockNameR = vgui.Create("DLabel", PanelXPBar)
  930. LabelBlockNameR:Dock(RIGHT)
  931. LabelBlockNameR:DockMargin(3,2,2,1)
  932. LabelBlockNameR:SetWide(50)
  933. LabelBlockNameR:SetFont("HHFontBlockInfo")
  934. LabelBlockNameR:SetText("")
  935. LabelBlockNameR:SetContentAlignment(6)
  936. LabelBlockNameR.Paint = function(self, w, h)
  937.  
  938. local playerLevel = LocalPlayer():getDarkRPVar('level') or LocalPlayer():getDarkRPVar('lvl') or 0
  939. local playerXP = LocalPlayer():getDarkRPVar('xp') or 0
  940. local expFormat = 0
  941. local calcXP = 0
  942. local getBlockData = 0
  943.  
  944. if LevelSystemConfiguration then
  945. local xpPercent = ( ( playerXP or 0 ) / ( ( ( 10 + ( ( ( playerLevel or 1 ) * ( ( playerLevel or 1 ) + 1 ) * 90 ) ) ) ) * LevelSystemConfiguration.XPMult or 1.0 ) )
  946. calcXP = xpPercent * 100
  947. calcXP = math.Round(calcXP)
  948. expFormat = math.Clamp(calcXP, 0, 99)
  949. elseif DARKRP_LVL_SYSTEM then
  950. local formatPlayerlevel = DARKRP_LVL_SYSTEM["XP"][tonumber(playerLevel)]
  951. if not formatPlayerlevel then return end
  952. playerXP = math.floor(playerXP)
  953. calcXP = (playerXP*100/formatPlayerlevel) or 0
  954. expFormat = math.floor(calcXP)
  955. end
  956.  
  957. LabelBlockNameR:SetText(expFormat .. "%")
  958. end
  959.  
  960. end
  961.  
  962. end
  963.  
  964. -----------------------------------------------------------------
  965. -- [ AGENDA PANEL ]
  966. -----------------------------------------------------------------
  967.  
  968. HUDHive.PanelAgendaMain = vgui.Create("DPanel")
  969. HUDHive.PanelAgendaMain:SetSize(300, 165)
  970. HUDHive.PanelAgendaMain:SetPos(5, 5)
  971. if not HUDHive.Settings.AgendaEnabled then
  972. HUDHive.PanelAgendaMain:SetVisible(false)
  973. end
  974. HUDHive.PanelAgendaMain:ParentToHUD()
  975. HUDHive.PanelAgendaMain.Paint = function(self, w, h)
  976. if not HUDHive.Settings.BackgroundsEnable and HUDHive.PanelAgendaMain:IsVisible() then
  977. DrawBlurPanel(self)
  978. draw.RoundedBox(3, 0, 0, w, h, HUDHive.Settings.BackgroundColorSolid )
  979. end
  980. end
  981.  
  982. -----------------------------------------------------------------
  983. -- [ HTML BACKGROUND SUPPORT ]
  984. -----------------------------------------------------------------
  985.  
  986. if HUDHive.Settings.BackgroundsEnable then
  987.  
  988. local DHTMLAgendaBackground = vgui.Create("DHTML", HUDHive.PanelAgendaMain)
  989. DHTMLAgendaBackground:SetSize(ScrW(), ScrH())
  990. DHTMLAgendaBackground:SetScrollbars(false)
  991. DHTMLAgendaBackground:SetHTML([[
  992. <body style="overflow: hidden; height: auto; width: auto;">
  993. <img src="]] .. table.Random(HUDHive.Settings.BackgroundsAgenda) .. [[" style="position: absolute; height: auto; width: auto; top: 0%; left: 0%; margin: auto;">
  994. </body>
  995. ]])
  996. DHTMLAgendaBackground.Paint = function(self, w, h) end
  997.  
  998. end
  999.  
  1000. local PanelAgendaContainer = vgui.Create("DPanel", HUDHive.PanelAgendaMain)
  1001. PanelAgendaContainer:SetSize(HUDHive.PanelAgendaMain:GetWide(), HUDHive.PanelAgendaMain:GetTall())
  1002. PanelAgendaContainer.Paint = function(self, w, h) end
  1003.  
  1004. local LabelAgendaContext = vgui.Create("DLabel", PanelAgendaContainer)
  1005. LabelAgendaContext:Dock(LEFT)
  1006. LabelAgendaContext:DockMargin(3,2,2,7)
  1007. LabelAgendaContext:SetWide(HUDHive.PanelAgendaMain:GetWide())
  1008. LabelAgendaContext:SetText("")
  1009. LabelAgendaContext.Paint = function(self, w, h)
  1010.  
  1011. surface.SetDrawColor(HUDHive.Settings.AgendaIconColor)
  1012. surface.SetMaterial(ImageAgenda)
  1013. surface.DrawTexturedRect(5, 5, 24, 24)
  1014.  
  1015. local fetchAgenda = LocalPlayer():getAgendaTable()
  1016. if not fetchAgenda then return end
  1017.  
  1018. agendaTitle = string.upper(fetchAgenda.Title)
  1019.  
  1020. agendaText = DarkRP.textWrap((LocalPlayer():getDarkRPVar("agenda") or ""):gsub("//", "\n"):gsub("\\n", "\n"), "HHFontAgendaContent", HUDHive.PanelAgendaMain:GetWide() - 50)
  1021.  
  1022. local positionYAgenda = 4
  1023. if not HUDHive.Settings.CustomFontsEnabled then
  1024. positionYAgenda = 8
  1025. end
  1026.  
  1027. draw.DrawText(agendaTitle, "HHFontAgendaTitle", 35, positionYAgenda, HUDHive.Settings.AgendaTitleTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1028. draw.DrawText(agendaText, "HHFontAgendaContent", 35, 34, HUDHive.Settings.AgendaContentTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1029.  
  1030. end
  1031.  
  1032. -----------------------------------------------------------------
  1033. -- [ LOCKDOWN PANEL ]
  1034. -----------------------------------------------------------------
  1035.  
  1036. HUDHive.PanelLockdownMain = vgui.Create("DPanel")
  1037. HUDHive.PanelLockdownMain:SetSize(220, 80)
  1038. HUDHive.PanelLockdownMain:SetPos(ScrW() - HUDHive.PanelLockdownMain:GetWide() - 5, ScrH() / 2)
  1039. HUDHive.PanelLockdownMain:ParentToHUD()
  1040. HUDHive.PanelLockdownMain.Paint = function(self, w, h)
  1041. if not HUDHive.Settings.BackgroundsEnable then
  1042. DrawBlurPanel(self)
  1043. end
  1044. end
  1045.  
  1046. if HUDHive.Settings.BackgroundsEnable then
  1047.  
  1048. local DHTMLLockdownBackground = vgui.Create("DHTML", HUDHive.PanelLockdownMain)
  1049. DHTMLLockdownBackground:SetSize(ScrW(), ScrH())
  1050. DHTMLLockdownBackground:SetScrollbars(false)
  1051. DHTMLLockdownBackground:SetHTML([[
  1052. <body style="overflow: hidden; height: auto; width: auto;">
  1053. <img src="]] .. table.Random(HUDHive.Settings.BackgroundsOther) .. [[" style="position: absolute; height: auto; width: auto; top: 0%; left: 0%; margin: auto;">
  1054. </body>
  1055. ]])
  1056. DHTMLLockdownBackground.Paint = function(self, w, h) end
  1057.  
  1058. end
  1059.  
  1060. local PanelLockdownContainer = vgui.Create("DPanel", HUDHive.PanelLockdownMain)
  1061. PanelLockdownContainer:SetSize(HUDHive.PanelLockdownMain:GetWide(), HUDHive.PanelLockdownMain:GetTall())
  1062. PanelLockdownContainer.Paint = function(self, w, h)
  1063.  
  1064. local doPulse = math.abs( math.sin(CurTime() * HUDHive.Settings.MainStatusPulseSpeed or 2) * 200 )
  1065. draw.RoundedBox(0, 0, 0, w, h, Color(15,15,15,200))
  1066.  
  1067. local ImageHeight = 6
  1068.  
  1069. local TextHeight = 2
  1070. if not HUDHive.Settings.CustomFontsEnabled then
  1071. TextHeight = 7
  1072. end
  1073.  
  1074. if HUDHive.Settings.XPBoxLeftShowIcon then
  1075. local ImageLeveling = Material(HUDHive.Settings.LockdownIcon, "noclamp smooth")
  1076. surface.SetDrawColor(doPulse, doPulse, 0, 255)
  1077. surface.SetMaterial(ImageLeveling)
  1078. surface.DrawTexturedRect(HUDHive.PanelLockdownMain:GetWide() - 20, ImageHeight, 17, 17)
  1079. end
  1080.  
  1081. local lockdownText = DarkRP.textWrap((HUDHive.Settings.LockdownBoxText or ""):gsub("//", "\n"):gsub("\\n", "\n"), "HHFontLockdownMessage", HUDHive.PanelLockdownMain:GetWide() - 10)
  1082.  
  1083. draw.DrawText(string.upper(HUDHive.Language.lockdown_active), "HHFontLockdownTitle", 5, TextHeight, HUDHive.Settings.XPBoxLeftLevelTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1084.  
  1085. surface.SetDrawColor(Color(255,255,255,200))
  1086. surface.DrawRect(5, 27, w - 10, 2)
  1087.  
  1088. draw.DrawText(lockdownText, "HHFontLockdownMessage", 5, 33, HUDHive.Settings.AgendaTitleTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1089.  
  1090. end
  1091.  
  1092. -----------------------------------------------------------------
  1093. -- [ WANTED PANEL ]
  1094. -----------------------------------------------------------------
  1095.  
  1096. HUDHive.PanelWantedMain = vgui.Create("DPanel")
  1097. HUDHive.PanelWantedMain:SetSize(220, 80)
  1098. HUDHive.PanelWantedMain:SetPos(ScrW() - HUDHive.PanelWantedMain:GetWide() - 5, ScrH() / 2 - HUDHive.PanelWantedMain:GetTall() - 5)
  1099. HUDHive.PanelWantedMain:ParentToHUD()
  1100. HUDHive.PanelWantedMain.Paint = function(self, w, h)
  1101. if not HUDHive.Settings.BackgroundsEnable then
  1102. DrawBlurPanel(self)
  1103. end
  1104. end
  1105.  
  1106. if HUDHive.Settings.BackgroundsEnable then
  1107.  
  1108. local DHTMLWantedBackground = vgui.Create("DHTML", HUDHive.PanelWantedMain)
  1109. DHTMLWantedBackground:SetSize(ScrW(), ScrH())
  1110. DHTMLWantedBackground:SetScrollbars(false)
  1111. DHTMLWantedBackground:SetHTML([[
  1112. <body style="overflow: hidden; height: auto; width: auto;">
  1113. <img src="]] .. table.Random(HUDHive.Settings.BackgroundsOther) .. [[" style="position: absolute; height: auto; width: auto; top: 0%; left: 0%; margin: auto;">
  1114. </body>
  1115. ]])
  1116. DHTMLWantedBackground.Paint = function(self, w, h) end
  1117.  
  1118. end
  1119.  
  1120. local PanelWantedContainer = vgui.Create("DPanel", HUDHive.PanelWantedMain)
  1121. PanelWantedContainer:SetSize(HUDHive.PanelWantedMain:GetWide(), HUDHive.PanelWantedMain:GetTall())
  1122. PanelWantedContainer.Paint = function(self, w, h)
  1123.  
  1124. local doPulse = math.abs( math.sin(CurTime() * HUDHive.Settings.MainStatusPulseSpeed or 2) * 200 )
  1125. draw.RoundedBox(0, 0, 0, w, h, Color(15,15,15,200))
  1126.  
  1127. local ImageHeight = 6
  1128. local TextHeight = 2
  1129. if not HUDHive.Settings.CustomFontsEnabled then
  1130. TextHeight = 7
  1131. end
  1132.  
  1133. if HUDHive.Settings.XPBoxLeftShowIcon then
  1134. local ImageLeveling = Material(HUDHive.Settings.WantedBoxIcon, "noclamp smooth")
  1135. surface.SetDrawColor(doPulse, doPulse, 0, 255)
  1136. surface.SetMaterial(ImageLeveling)
  1137. surface.DrawTexturedRect(HUDHive.PanelLockdownMain:GetWide() - 20, ImageHeight, 17, 17)
  1138. end
  1139.  
  1140. local wantedReasonText = DarkRP.getPhrase("wanted", tostring(LocalPlayer():getDarkRPVar("wantedReason")))
  1141.  
  1142. draw.DrawText(string.upper(HUDHive.Language.wanted), "HHFontLockdownTitle", 5, TextHeight, HUDHive.Settings.XPBoxLeftLevelTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1143.  
  1144. surface.SetDrawColor(Color(255,255,255,200))
  1145. surface.DrawRect(5, 27, w - 10, 2)
  1146.  
  1147. draw.DrawText(wantedReasonText, "HHFontLockdownMessage", 5, 33, HUDHive.Settings.AgendaTitleTextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1148.  
  1149. end
  1150.  
  1151. hook.Add("Tick", "HUDHiveDoTick", function()
  1152.  
  1153. if GetConVarNumber("hudhive_hide") == 1 then
  1154. if IsValid(HUDHive.PanelMain) then HUDHive.PanelMain:SetVisible(false) end
  1155. if IsValid(HUDHive.PanelAmmoMain) then HUDHive.PanelAmmoMain:SetVisible(false) end
  1156. if IsValid(HUDHive.PanelAgendaMain) then HUDHive.PanelAgendaMain:SetVisible(false) end
  1157. if IsValid(HUDHive.PanelLockdownMain) then HUDHive.PanelLockdownMain:SetVisible(false) end
  1158. if IsValid(HUDHive.PanelWantedMain) then HUDHive.PanelWantedMain:SetVisible(false) end
  1159. if IsValid(HUDHive.PanelXPMain) then HUDHive.PanelXPMain:SetVisible(false) end
  1160. return
  1161. else
  1162. if IsValid(HUDHive.PanelMain) and HUDHive.Settings.MainEnabled then HUDHive.PanelMain:SetVisible(true) end
  1163. end
  1164.  
  1165. if not LocalPlayer():Alive() then
  1166. HUDHive.PanelAmmoMain:SetVisible(false)
  1167. HUDHive.PanelXPMain:SetVisible(false)
  1168. return
  1169. elseif not HUDHive.Settings.XPEnabled then
  1170. HUDHive.PanelXPMain:SetVisible(false)
  1171. else
  1172. HUDHive.PanelXPMain:SetVisible(true)
  1173. end
  1174.  
  1175. if HUDHive.Settings.MainPosition == 1 then
  1176. HUDHive.PanelMain:SetPos(5, 5)
  1177. elseif HUDHive.Settings.MainPosition == 2 then
  1178. HUDHive.PanelMain:SetPos(ScrW() - HUDHive.PanelMain:GetWide() - 5, 5)
  1179. elseif HUDHive.Settings.MainPosition == 3 then
  1180. HUDHive.PanelMain:SetPos(5, ScrH() - HUDHive.PanelMain:GetTall() - 5)
  1181. elseif HUDHive.Settings.MainPosition == 4 then
  1182. HUDHive.PanelMain:SetPos(ScrW() - HUDHive.PanelMain:GetWide() - 5, ScrH() - HUDHive.PanelMain:GetTall() - 5)
  1183. end
  1184.  
  1185. if HUDHive.Settings.AgendaPosition == 1 then
  1186. HUDHive.PanelAgendaMain:SetPos(5, 5)
  1187. elseif HUDHive.Settings.AgendaPosition == 2 then
  1188. HUDHive.PanelAgendaMain:SetPos(ScrW() - HUDHive.PanelAgendaMain:GetWide() - 5, 5)
  1189. elseif HUDHive.Settings.AgendaPosition == 3 then
  1190. HUDHive.PanelAgendaMain:SetPos(5, ScrH() - HUDHive.PanelAgendaMain:GetTall() - 5)
  1191. elseif HUDHive.Settings.AgendaPosition == 4 then
  1192. HUDHive.PanelAgendaMain:SetPos(ScrW() - HUDHive.PanelAgendaMain:GetWide() - 5, ScrH() - HUDHive.PanelAgendaMain:GetTall() - 5)
  1193. end
  1194.  
  1195. local PlayerWeapon = LocalPlayer():GetActiveWeapon()
  1196.  
  1197. if !IsValid(PlayerWeapon) then
  1198. HUDHive.PanelAmmoMain:SetVisible(false)
  1199. return
  1200. end
  1201.  
  1202. if HUDHive.Settings.XPAmmoPosition == 1 then
  1203. HUDHive.PanelXPMain:SetPos(5, 5)
  1204. if HUDHive.PanelXPMain:IsVisible() then
  1205. HUDHive.PanelAmmoMain:SetPos(5, 45)
  1206. else
  1207. HUDHive.PanelAmmoMain:SetPos(5, 5)
  1208. end
  1209. elseif HUDHive.Settings.XPAmmoPosition == 2 then
  1210. HUDHive.PanelXPMain:SetPos(ScrW() - HUDHive.PanelXPMain:GetWide() - 5, 5)
  1211. if HUDHive.Settings.XPEnabled then
  1212. HUDHive.PanelAmmoMain:SetPos(ScrW() - HUDHive.PanelAmmoMain:GetWide() - 5, 45)
  1213. end
  1214. elseif HUDHive.Settings.XPAmmoPosition == 3 then
  1215. if HUDHive.PanelAmmoMain:IsVisible() then
  1216. HUDHive.PanelXPMain:SetPos(5, ScrH() - HUDHive.PanelAmmoMain:GetTall() - 45)
  1217. else
  1218. HUDHive.PanelXPMain:SetPos(5, ScrH() - HUDHive.PanelXPMain:GetTall() - 5)
  1219. end
  1220. HUDHive.PanelAmmoMain:SetPos(5, ScrH() - HUDHive.PanelAmmoMain:GetTall() - 5)
  1221. elseif HUDHive.Settings.XPAmmoPosition == 4 then
  1222. if HUDHive.PanelAmmoMain:IsVisible() then
  1223. HUDHive.PanelXPMain:SetPos(ScrW() - HUDHive.PanelXPMain:GetWide() - 5, ScrH() - HUDHive.PanelAmmoMain:GetTall() - 45)
  1224. else
  1225. HUDHive.PanelXPMain:SetPos(ScrW() - HUDHive.PanelXPMain:GetWide() - 5, ScrH() - HUDHive.PanelXPMain:GetTall() - 5)
  1226. end
  1227. HUDHive.PanelAmmoMain:SetPos(ScrW() - HUDHive.PanelXPMain:GetWide() - 5, ScrH() - HUDHive.PanelAmmoMain:GetTall() - 5)
  1228. end
  1229.  
  1230. local countAmmoTotal = LocalPlayer():GetAmmoCount(PlayerWeapon:GetPrimaryAmmoType() or "")
  1231. local countAmmoClip = tonumber(PlayerWeapon:Clip1()) or nil
  1232.  
  1233. if !WeaponAmmo[PlayerWeapon] or WeaponAmmo[PlayerWeapon] < countAmmoClip then WeaponAmmo[PlayerWeapon] = countAmmoClip end
  1234. if !WeaponInfo[PlayerWeapon] or WeaponInfo[PlayerWeapon] < countAmmoTotal then WeaponInfo[PlayerWeapon] = countAmmoTotal end
  1235.  
  1236. if (countAmmoClip == nil or countAmmoClip == -1) and (countAmmoTotal == 0 and WeaponInfo[PlayerWeapon] <= 0) or (countAmmoClip == 0 && countAmmoTotal == 0 and WeaponAmmo[PlayerWeapon] == 0) then
  1237. HUDHive.PanelAmmoMain:SetVisible(false)
  1238. return
  1239. end
  1240.  
  1241. if countAmmoClip >= 0 or (WeaponAmmo[PlayerWeapon] or -1) >= 0 then
  1242. HUDHive.PanelAmmoBox_Right:SetVisible(true)
  1243. HUDHive.PanelAmmoMain:SetWide(220)
  1244. HUDHive.PanelAmmoBox_Left:SetWide(HUDHive.PanelAmmoMain:GetWide()/2-16+4)
  1245. else
  1246. HUDHive.PanelAmmoMain:SetWide(220)
  1247. HUDHive.PanelAmmoBox_Left:SetWide(HUDHive.PanelAmmoMain:GetWide()/2-16+4)
  1248. end
  1249.  
  1250. if HUDHive.Settings.AmmoEnabled then
  1251. HUDHive.PanelAmmoMain:SetVisible(true)
  1252. end
  1253. if LevelSystemConfiguration and HUDHive.Settings.XPEnabled then
  1254. HUDHive.PanelXPMain:SetVisible(true)
  1255. end
  1256.  
  1257. end)
  1258.  
  1259. end
  1260.  
  1261. function HUDHive:Hide()
  1262. local cmd = "1"
  1263. if GetConVarNumber("hudhive_hide") == 1 then
  1264. cmd = "0"
  1265. end
  1266. RunConsoleCommand("hudhive_hide", cmd)
  1267. end
  1268. concommand.Add("hudhive", HUDHive.Hide)
  1269.  
  1270. -----------------------------------------------------------------
  1271. -- [ NOTIFICATION SYSTEM ]
  1272. -----------------------------------------------------------------
  1273. -- The default one looks like crap, so we're going to modernize
  1274. -- it a bit. Simple clean boxes.
  1275. -----------------------------------------------------------------
  1276.  
  1277. local function NotificationSystem( str, type, length )
  1278.  
  1279. local tablist = {}
  1280. tablist.text = str
  1281. tablist.recv = SysTime()
  1282. tablist.len = length
  1283. tablist.velx = -5
  1284. tablist.vely = 0
  1285. tablist.x = ScrW() + 200
  1286. tablist.y = ScrH()
  1287. tablist.a = 255
  1288. tablist.type = type
  1289.  
  1290. table.insert( HUDNotes, tablist )
  1291.  
  1292. HUDNote_c = HUDNote_c + 1
  1293. HUDNote_i = HUDNote_i + 1
  1294.  
  1295. end
  1296.  
  1297. local function DrawNotification( self, k, v, i )
  1298.  
  1299. local H = ScrH() / 640
  1300. local x = v.x - HUDHive.Settings.NotiBoxRightPos * H
  1301. local y = v.y - HUDHive.Settings.NotiBoxHeightPos * H
  1302.  
  1303. if ( !v.w ) then
  1304. surface.SetFont( "HHFontNotificationTitle" )
  1305. v.w, v.h = surface.GetTextSize( v.text )
  1306. end
  1307.  
  1308. local w = v.w
  1309. local h = v.h
  1310.  
  1311. w = w - 16
  1312. h = h + 16
  1313.  
  1314. local col = HUDHive.Settings.NotiBoxColorGeneric
  1315. local textCol = HUDHive.Settings.NotiBoxTextColor
  1316.  
  1317. surface.SetDrawColor( col.r, col.g, col.b, col.a )
  1318. surface.DrawRect(x - w - h + 8, y - 8, w + h, h)
  1319.  
  1320. surface.SetDrawColor( 255, 255, 255, 255 )
  1321. surface.DrawRect(x - w - h + 8, y - 8, 3, h)
  1322.  
  1323. draw.SimpleText( v.text, "HHFontNotificationTitle", x+1, y+1, Color(0,0,0,v.a*0.8), TEXT_ALIGN_RIGHT )
  1324. draw.SimpleText( v.text, "HHFontNotificationTitle", x-1, y-1, Color(0,0,0,v.a*0.5), TEXT_ALIGN_RIGHT )
  1325. draw.SimpleText( v.text, "HHFontNotificationTitle", x+1, y-1, Color(0,0,0,v.a*0.6), TEXT_ALIGN_RIGHT )
  1326. draw.SimpleText( v.text, "HHFontNotificationTitle", x-1, y+1, Color(0,0,0,v.a*0.6), TEXT_ALIGN_RIGHT )
  1327. draw.SimpleText( v.text, "HHFontNotificationTitle", x, y, Color(textCol.r,textCol.g,textCol.b,v.a), TEXT_ALIGN_RIGHT )
  1328.  
  1329. local ideal_y = ScrH() - (HUDNote_c - i) * (h + 4)
  1330. local ideal_x = ScrW()
  1331.  
  1332. local timeleft = v.len - (SysTime() - v.recv)
  1333.  
  1334. if ( timeleft < 0.8 ) then ideal_x = ScrW() - 10 end
  1335. if ( timeleft < 0.5 ) then ideal_x = ScrW() + w * 2 end
  1336.  
  1337. local spd = RealFrameTime() * 15
  1338.  
  1339. v.y = v.y + v.vely * spd
  1340. v.x = v.x + v.velx * spd
  1341.  
  1342. local dist = ideal_y - v.y
  1343. v.vely = v.vely + dist * spd * 1
  1344. if (math.abs(dist) < 2 && math.abs(v.vely) < 0.1) then v.vely = 0 end
  1345. local dist = ideal_x - v.x
  1346. v.velx = v.velx + dist * spd * 1
  1347. if (math.abs(dist) < 2 && math.abs(v.velx) < 0.1) then v.velx = 0 end
  1348.  
  1349. v.velx = v.velx * (0.90 - RealFrameTime() * 8 )
  1350. v.vely = v.vely * (0.90 - RealFrameTime() * 8 )
  1351.  
  1352. end
  1353.  
  1354. local function PaintNotes()
  1355. if ( !HUDNotes ) then return end
  1356.  
  1357. local i = 0
  1358. for k, v in pairs( HUDNotes ) do
  1359. if ( v != 0 ) then
  1360. i = i + 1
  1361. DrawNotification( self, k, v, i)
  1362. end
  1363. end
  1364.  
  1365. for k, v in pairs( HUDNotes ) do
  1366. if ( v != 0 && v.recv + v.len < SysTime() ) then
  1367. HUDNotes[ k ] = 0
  1368. HUDNote_c = HUDNote_c - 1
  1369. if (HUDNote_c == 0) then HUDNotes = {} end
  1370. end
  1371. end
  1372. end
  1373. hook.Add( "HUDPaint", "PaintNotes", PaintNotes )
  1374.  
  1375. -----------------------------------------------------------------
  1376. -- [ ENTITY DISPLAY ]
  1377. -----------------------------------------------------------------
  1378. -- Display above the player's head. Includes the name, job,
  1379. -- wanted level, if player has gun license, health and armor
  1380. -- bars.
  1381. -----------------------------------------------------------------
  1382.  
  1383. local function DrawEntityDisplay()
  1384.  
  1385. local shootPos = LocalPlayer():GetShootPos()
  1386. local aimVec = LocalPlayer():GetAimVector()
  1387.  
  1388. for k, ply in pairs(player.GetAll()) do
  1389. if ply == LocalPlayer() or not ply:Alive() or ply:GetNoDraw() then continue end
  1390. local playerColor = ply:GetColor()
  1391. if playerColor.a != 255 then continue end
  1392. local hisPos = ply:GetShootPos()
  1393.  
  1394. if hisPos:DistToSqr(shootPos) < HUDHive.Settings.HeadHudDrawDistance then
  1395. local PlayerPosition = hisPos - shootPos
  1396. local unitPos = PlayerPosition:GetNormalized()
  1397. if unitPos:Dot(aimVec) > 0.35 then
  1398. local fetchTrace = util.QuickTrace(shootPos, PlayerPosition, LocalPlayer())
  1399. if fetchTrace.Hit and fetchTrace.Entity != ply then
  1400. return
  1401. end
  1402.  
  1403. local PlayerName = string.upper(ply:Name())
  1404. local PlayerTeam = string.upper(ply:Team())
  1405. local PlayerJob = string.upper(ply:getDarkRPVar("job") or "")
  1406. local PlayerHealth = ply:Health()
  1407. local PlayerArmor = ply:Armor()
  1408. local PlayerEyePos = ply:EyePos()
  1409. local PlayerTeamcolor = team.GetColor( ply:Team() )
  1410. local PlayerPosition = ( PlayerEyePos+Vector( 0, 0, 5 ) ):ToScreen()
  1411.  
  1412. PlayerPosition.y = PlayerPosition.y - HUDHive.Settings.HeadHudPositionVertical or 100
  1413.  
  1414. if HUDHive.Settings.HeadHudEnabled then
  1415. local w, h = 110, 13
  1416.  
  1417. if HUDHive.Settings.HeadHudShowJob then
  1418. draw.DrawText(PlayerJob, "HHFontHeadHudJob", PlayerPosition.x, PlayerPosition.y + HUDHive.Settings.HeadHudJobHPos, HUDHive.Settings.HeadHudJobTextColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1419. end
  1420.  
  1421. if HUDHive.Settings.HeadHudPlayernameEnabled then
  1422. draw.DrawText(PlayerName, "HHFontHeadHudName", PlayerPosition.x, PlayerPosition.y + HUDHive.Settings.HeadHudPlayernameHPos, Color(PlayerTeamcolor.r,PlayerTeamcolor.g,PlayerTeamcolor.b), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1423. end
  1424.  
  1425. if not HUDHive.Settings.HeadHudShowNicknames and HUDHive.Settings.HeadHudShowUserGroup and HUDHive.Settings.UserGroupTitles[ply:GetUserGroup()] then
  1426. draw.DrawText(string.upper(HUDHive.Settings.UserGroupTitles[ply:GetUserGroup()]), "HHFontHeadHudRank", PlayerPosition.x, PlayerPosition.y + HUDHive.Settings.HeadHudNicknamesHPos, HUDHive.Settings.UserGroupColors[ply:GetUserGroup()], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1427. elseif HUDHive.Settings.HeadHudShowNicknames and HUDHive.Settings.NicknameTitles[ply:SteamID()] and not HUDHive.Settings.HeadHudShowUserGroup then
  1428. draw.DrawText(string.upper(HUDHive.Settings.NicknameTitles[ply:SteamID()]), "HHFontHeadHudRank", PlayerPosition.x, PlayerPosition.y + HUDHive.Settings.HeadHudNicknamesHPos, HUDHive.Settings.NicknameColors[ply:SteamID()], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1429. end
  1430.  
  1431. -----------------------------------------------------------------
  1432. -- Compatibility with https://scriptfodder.com/scripts/view/393/
  1433. -----------------------------------------------------------------
  1434.  
  1435. if HUDHive.Settings.HeadHudOrganizationsEnabled and ply:GetNWString("orgName") != "" then
  1436. local organizationColor = ORGS_Config.nameColor or HUDHive.Settings.HeadHudOrganizationsDefaultColor
  1437. draw.DrawText(string.upper(ply:GetNWString("orgName")), "HHFontHeadHudOrganization", PlayerPosition.x, PlayerPosition.y + HUDHive.Settings.HeadHudOrganizationsHPos, organizationColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1438. elseif HUDHive.Settings.HeadHudOrganizationsEnabled and C_CREWS then
  1439. draw.DrawText(string.upper(ply:GetCrew() or "No Gang"), "HHFontHeadHudOrganization", PlayerPosition.x, PlayerPosition.y + HUDHive.Settings.HeadHudOrganizationsHPos, organizationColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1440. end
  1441.  
  1442. local doPulse = math.abs( math.sin(CurTime() * HUDHive.Settings.MainStatusPulseSpeed or 2) * 200 )
  1443.  
  1444. if ply:isWanted() then
  1445. surface.SetDrawColor(Color( doPulse, doPulse, 0, 255 ))
  1446. else
  1447. surface.SetDrawColor(Color( 0, 0, 0, 255 ))
  1448. end
  1449. surface.SetMaterial(ImageWantedIndicator)
  1450. surface.DrawTexturedRect(PlayerPosition.x - 75, PlayerPosition.y + 75, 16, 16)
  1451.  
  1452. if ply:getDarkRPVar("HasGunlicense") then
  1453. surface.SetDrawColor(HUDHive.Settings.HeadHudGunlicenseIconColor)
  1454. else
  1455. surface.SetDrawColor(Color( 0, 0, 0, 255 ))
  1456. end
  1457. surface.SetMaterial(ImageWeaponLicense)
  1458. surface.DrawTexturedRect(PlayerPosition.x + 60, PlayerPosition.y + 75, 16, 16)
  1459.  
  1460. if HUDHive.Settings.HeadHudXPBarEnabled and (DARKRP_LVL_SYSTEM or LevelSystemConfiguration or DARKRP_LEVELING_ENTRESTRICT) then
  1461.  
  1462. local playerLevel = ply:getDarkRPVar('level') or ply:getDarkRPVar('lvl') or ply:GetNWInt("lvl") or 0
  1463. local playerXP = ply:getDarkRPVar('xp') or ply:GetNWInt("exp") or 0
  1464. local expFormat = 0
  1465. local calcXP = 0
  1466. local EXP2 = 0
  1467. local getBlockData
  1468. if LevelSystemConfiguration then
  1469. local xpPercent = ( ( playerXP or 0 ) / ( ( ( 10 + ( ( ( playerLevel or 1 ) * ( ( playerLevel or 1 ) + 1 ) * 90 ) ) ) ) * LevelSystemConfiguration.XPMult or 1.0 ) )
  1470. calcXP = xpPercent * 100
  1471. calcXP = math.Round(calcXP)
  1472. expFormat = math.Clamp(calcXP, 0, 99)
  1473. getBlockData = expFormat
  1474. elseif DARKRP_LVL_SYSTEM then
  1475. local formatPlayerlevel = DARKRP_LVL_SYSTEM["XP"][tonumber(playerLevel)]
  1476. if not formatPlayerlevel then return end
  1477. playerXP = math.floor(playerXP)
  1478. calcXP = (playerXP*100/formatPlayerlevel) or 0
  1479. expFormat = math.floor(calcXP)
  1480. getBlockData = expFormat
  1481. elseif DARKRP_LEVELING_ENTRESTRICT then
  1482. local maxexp = ExpFormula(ply:GetNWInt("lvl",0))
  1483. playerXP = math.floor(playerXP)
  1484. calcXP = (playerXP*100/maxexp) or 0
  1485. expFormat = math.Round(calcXP)
  1486. getBlockData = expFormat
  1487. end
  1488.  
  1489. surface.SetDrawColor(HUDHive.Settings.HeadHudXPBarBGColor)
  1490. surface.DrawRect(PlayerPosition.x - w / 2, PlayerPosition.y + HUDHive.Settings.HeadHudXPHPos, w, h)
  1491. surface.SetDrawColor(HUDHive.Settings.HeadHudXPBarColor)
  1492. surface.DrawRect(PlayerPosition.x - w / 2, PlayerPosition.y + HUDHive.Settings.HeadHudXPHPos, w * math.Clamp(getBlockData / 100, 0, 1), h)
  1493. surface.SetDrawColor(Color( 10, 10, 10, 66 ))
  1494. surface.DrawRect(PlayerPosition.x - w / 2, PlayerPosition.y + HUDHive.Settings.HeadHudXPHPos, w * math.Clamp(getBlockData / 100, 0, 1), 7)
  1495.  
  1496. if HUDHive.Settings.HeadHudShowXPNumber then
  1497. draw.DrawText(getBlockData .. "%", "HHFontHeadHudHealth", PlayerPosition.x - 52, PlayerPosition.y + HUDHive.Settings.HeadHudXPHPos - 1, HUDHive.Settings.HeadHudXPNumberColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1498. draw.DrawText(string.upper(HUDHive.Language.level) .. " " .. playerLevel, "HHFontHeadHudHealth", PlayerPosition.x + 52, PlayerPosition.y + HUDHive.Settings.HeadHudXPHPos - 1, HUDHive.Settings.HeadHudXPNumberColor, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  1499. end
  1500.  
  1501. end
  1502.  
  1503. if HUDHive.Settings.HeadHudHealthBarEnabled then
  1504. surface.SetDrawColor(HUDHive.Settings.HeadHudHealthBarBGColor)
  1505. surface.DrawRect(PlayerPosition.x - w / 2, PlayerPosition.y + HUDHive.Settings.HeadHudHealthHPos, w, h)
  1506. surface.SetDrawColor(HUDHive.Settings.HeadHudHealthBarColor)
  1507. surface.DrawRect(PlayerPosition.x - w / 2, PlayerPosition.y + HUDHive.Settings.HeadHudHealthHPos, w * math.Clamp(ply:Health() / 100, 0, 1), h)
  1508. surface.SetDrawColor(Color( 10, 10, 10, 66 ))
  1509. surface.DrawRect(PlayerPosition.x - w / 2, PlayerPosition.y + HUDHive.Settings.HeadHudHealthHPos, w * math.Clamp(ply:Health() / 100, 0, 1), 7)
  1510.  
  1511. local YOffset = 3
  1512. if not HUDHive.Settings.CustomFontsEnabled then
  1513. YOffset = 1
  1514. end
  1515.  
  1516. if HUDHive.Settings.HeadHudShowHealthNumber then
  1517. draw.DrawText(ply:Health(), "HHFontHeadHudHealth", PlayerPosition.x, PlayerPosition.y + HUDHive.Settings.HeadHudHealthHPos - YOffset, HUDHive.Settings.HeadHudHealthNumberColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1518. end
  1519.  
  1520. end
  1521.  
  1522. if HUDHive.Settings.HeadHudArmorBarEnabled then
  1523. surface.SetDrawColor(HUDHive.Settings.HeadHudArmorBarBGColor)
  1524. surface.DrawRect(PlayerPosition.x - w/2, PlayerPosition.y + HUDHive.Settings.HeadHudArmorHPos, w * math.Clamp(PlayerArmor/100,0,1), 4)
  1525. end
  1526.  
  1527. else
  1528.  
  1529. local pos = ply:EyePos()
  1530.  
  1531. pos.z = pos.z + 10
  1532. pos = pos:ToScreen()
  1533. if not ply:getDarkRPVar("wanted") then
  1534. pos.y = pos.y - 50
  1535. end
  1536.  
  1537. if GAMEMODE.Config.showname then
  1538. local nick, plyTeam = PlayerName, PlayerTeam
  1539. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  1540. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
  1541. end
  1542.  
  1543. if GAMEMODE.Config.showhealth then
  1544. local health = DarkRP.getPhrase("health", ply:Health())
  1545. draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
  1546. draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
  1547. end
  1548.  
  1549. if GAMEMODE.Config.showjob then
  1550. local teamname = ply:getDarkRPVar("job") or team.GetName(ply:Team())
  1551. draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
  1552. draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 1)
  1553. end
  1554.  
  1555. if ply:getDarkRPVar("HasGunlicense") then
  1556. surface.SetMaterial(Page)
  1557. surface.SetDrawColor(255,255,255,255)
  1558. surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
  1559. end
  1560.  
  1561. end
  1562.  
  1563. end
  1564. end
  1565. end
  1566.  
  1567. local trace = LocalPlayer():GetEyeTrace()
  1568.  
  1569. if IsValid(trace.Entity) and trace.Entity:isKeysOwnable() and trace.Entity:GetPos():DistToSqr(LocalPlayer():GetPos()) < 40000 then
  1570. trace.Entity:drawOwnableInfo()
  1571. end
  1572.  
  1573. end
  1574.  
  1575.  
  1576. -----------------------------------------------------------------
  1577. -- [ ADMINTELL FUNCTION ]
  1578. -----------------------------------------------------------------
  1579.  
  1580. local function AdminTellDispatch(Message)
  1581.  
  1582. local textYOffset = 145
  1583. if not HUDHive.Settings.CustomFontsEnabled then
  1584. textYOffset = 130
  1585. end
  1586.  
  1587. if HUDHive.Settings.AdminTellEnabled then
  1588.  
  1589. local AdminTellBoxW = 220
  1590.  
  1591. draw.RoundedBox(0, ScrW() - 225, 145, AdminTellBoxW, 100, HUDHive.Settings.AdminTellBoxPrimaryColor)
  1592. draw.RoundedBox(0, ScrW() - 225, 145, AdminTellBoxW, 25, HUDHive.Settings.AdminTellBoxSecondaryColor)
  1593.  
  1594. local admintellText = DarkRP.textWrap((Message or ""):gsub("//", "\n"):gsub("\\n", "\n"), "HHFontAnnouncementMessage", AdminTellBoxW - 10)
  1595.  
  1596. draw.DrawNonParsedText(string.upper(HUDHive.Language.announcement), "HHFontAnnouncementTitle", ScrW() - AdminTellBoxW, textYOffset, HUDHive.Settings.AdminTellTitleColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1597. draw.DrawNonParsedText(admintellText or HUDHive.Language.no_message_available, "HHFontAnnouncementMessage", ScrW() - AdminTellBoxW, 175, HUDHive.Settings.AdminTellMessageColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1598.  
  1599. else
  1600.  
  1601. draw.RoundedBox(4, 10, 10, ScrW() - 20, 110, colors.darkblack)
  1602.  
  1603. draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", ScrW() / 2 + 10, 10, colors.white, 1)
  1604. draw.DrawNonParsedText(Message, "ChatFont", ScrW() / 2 + 10, 90, colors.brightred, 1)
  1605.  
  1606. end
  1607.  
  1608. end
  1609.  
  1610. local Arrested = function() end
  1611.  
  1612. usermessage.Hook("GotArrested", function(msg)
  1613. local ArrestedStart = CurTime()
  1614. local ArrestedExpires = msg:ReadFloat()
  1615.  
  1616. Arrested = function()
  1617. if CurTime() - ArrestedStart <= ArrestedExpires and LocalPlayer():getDarkRPVar("Arrested") then
  1618. draw.RoundedBox(0, 5, ScrH() / 2, 220, 55, HUDHive.Settings.AdminTellBoxPrimaryColor)
  1619. draw.RoundedBox(0, 5, ScrH() / 2, 220, 25, HUDHive.Settings.AdminTellBoxSecondaryColor)
  1620. draw.DrawNonParsedText(string.upper(HUDHive.Language.arrested), "HHFontArrestedTitle", 10, ScrH() / 2, HUDHive.Settings.AdminTellTitleColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1621. draw.DrawNonParsedText(string.upper( DarkRP.getPhrase( "youre_arrested", math.ceil( ArrestedExpires - ( CurTime() - ArrestedStart ) ) ) ), "HHFontArrestedMessage", 10, ScrH() / 2 + 30, HUDHive.Settings.AdminTellMessageColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1622.  
  1623. local doPulse = math.abs( math.sin(CurTime() * HUDHive.Settings.MainStatusPulseSpeed or 2) * 200 )
  1624. if HUDHive.Settings.XPBoxLeftShowIcon then
  1625. local ImageLeveling = Material(HUDHive.Settings.ArrestedIcon, "noclamp smooth")
  1626. surface.SetDrawColor(doPulse, doPulse, 0, 255)
  1627. surface.SetMaterial(ImageLeveling)
  1628. surface.DrawTexturedRect(200, ScrH() / 2 + 2, 20, 20)
  1629. end
  1630. elseif not LocalPlayer():getDarkRPVar("Arrested") then
  1631. Arrested = function() end
  1632. end
  1633. end
  1634. end)
  1635.  
  1636. -----------------------------------------------------------------
  1637. -- [ ADMINTELL ]
  1638. -----------------------------------------------------------------
  1639. -- System allows for sending messages to players.
  1640. -- /admintell playername message
  1641. -----------------------------------------------------------------
  1642.  
  1643. local AdminTell = function() end
  1644.  
  1645. usermessage.Hook("AdminTell", function(msg)
  1646. timer.Destroy("DarkRP_AdminTell")
  1647. local Message = msg:ReadString()
  1648.  
  1649. AdminTell = function()
  1650. AdminTellDispatch(Message)
  1651. end
  1652.  
  1653. timer.Create("DarkRP_AdminTell", HUDHive.Settings.AdminTellTimer or 10, 1, function()
  1654. AdminTell = function() end
  1655. end)
  1656. end)
  1657.  
  1658. -----------------------------------------------------------------
  1659. -- [ AGENDA CHECK ]
  1660. -----------------------------------------------------------------
  1661.  
  1662. local function IsAgenda()
  1663. local fetchAgenda = LocalPlayer():getAgendaTable()
  1664. local fetchAgendaContents = LocalPlayer():getDarkRPVar("agenda")
  1665.  
  1666. if not IsValid(HUDHive.PanelAgendaMain) then return end
  1667. if GetConVarNumber("hudhive_hide") == 1 then return end
  1668. if not HUDHive.Settings.AgendaEnabled then return end
  1669.  
  1670. if !fetchAgenda then
  1671. HUDHive.PanelAgendaMain:SetVisible(false)
  1672. else
  1673. HUDHive.PanelAgendaMain:SetVisible(true)
  1674. end
  1675.  
  1676. if (!fetchAgendaContents or fetchAgendaContents == "") and HUDHive.Settings.AgendaHideIfEmpty then
  1677. HUDHive.PanelAgendaMain:SetVisible(false)
  1678. end
  1679.  
  1680. end
  1681.  
  1682. -----------------------------------------------------------------
  1683. -- [ ARRESTED CHECK ]
  1684. -----------------------------------------------------------------
  1685.  
  1686. local function IsArrested()
  1687. local chatboxXPOS, chatboxYPOS = chat.GetChatBoxPos()
  1688. if GetConVarNumber("hudhive_hide") == 1 then return end
  1689. if LocalPlayer():isWanted() and HUDHive.Settings.WantedNotiEnabled then
  1690. if IsValid(HUDHive.PanelWantedMain) then HUDHive.PanelWantedMain:SetVisible(true) end
  1691. local cin = (math.sin(CurTime()) + 1) / 2
  1692. local chatBoxSize = math.floor(ScrH() / 4)
  1693. draw.DrawNonParsedText("", "ScoreboardSubtitle", chatboxXPOS, chatboxYPOS + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
  1694. else
  1695. if IsValid(HUDHive.PanelWantedMain) then HUDHive.PanelWantedMain:SetVisible(false) end
  1696. end
  1697. end
  1698.  
  1699. -----------------------------------------------------------------
  1700. -- [ LOCKDOWN CHECK ]
  1701. -----------------------------------------------------------------
  1702.  
  1703. local function IsLockDown()
  1704. local chatboxXPOS, chatboxYPOS = chat.GetChatBoxPos()
  1705. if GetConVarNumber("hudhive_hide") == 1 then return end
  1706. if HUDHive.Settings.LockdownNotiEnabled and GetGlobalBool("DarkRP_LockDown") then
  1707. if IsValid(HUDHive.PanelLockdownMain) then HUDHive.PanelLockdownMain:SetVisible(true) end
  1708. local cin = (math.sin(CurTime()) + 1) / 2
  1709. local chatBoxSize = math.floor(ScrH() / 4)
  1710. draw.DrawNonParsedText("", "ScoreboardSubtitle", chatboxXPOS, chatboxYPOS + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
  1711. else
  1712. if IsValid(HUDHive.PanelLockdownMain) then HUDHive.PanelLockdownMain:SetVisible(false) end
  1713. end
  1714. end
  1715.  
  1716. -----------------------------------------------------------------
  1717. -- [ LOAD IMPORTANT FUNCTIONS ]
  1718. -----------------------------------------------------------------
  1719. -- These functions control the differnt extra features including
  1720. -- the agenda, arrest and lockdown notifications, etc.
  1721. -----------------------------------------------------------------
  1722.  
  1723. hook.Add("HUDPaint", "HUDHive.PanelMainEntityDisplay", function()
  1724. IsAgenda()
  1725. IsArrested()
  1726. IsLockDown()
  1727. DrawEntityDisplay()
  1728. Arrested()
  1729. AdminTell()
  1730. end)
  1731.  
  1732. hook.Add("InitPostEntity", "HUDHiveInit", function()
  1733.  
  1734. local Arrested = function() end
  1735.  
  1736. usermessage.Hook("GotArrested", function(msg)
  1737. local ArrestedStart = CurTime()
  1738. local ArrestedExpires = msg:ReadFloat()
  1739.  
  1740. Arrested = function()
  1741. if CurTime() - ArrestedStart <= ArrestedExpires and LocalPlayer():getDarkRPVar("Arrested") then
  1742. draw.RoundedBox(0, 5, ScrH() / 2, 220, 55, HUDHive.Settings.AdminTellBoxPrimaryColor)
  1743. draw.RoundedBox(0, 5, ScrH() / 2, 220, 25, HUDHive.Settings.AdminTellBoxSecondaryColor)
  1744. draw.DrawNonParsedText(string.upper(HUDHive.Language.arrested), "HHFontArrestedTitle", 10, ScrH() / 2, HUDHive.Settings.AdminTellTitleColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1745. draw.DrawNonParsedText(string.upper( DarkRP.getPhrase( "youre_arrested", math.ceil( ArrestedExpires - ( CurTime() - ArrestedStart ) ) ) ), "HHFontArrestedMessage", 10, ScrH() / 2 + 30, HUDHive.Settings.AdminTellMessageColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1746.  
  1747. local doPulse = math.abs( math.sin(CurTime() * HUDHive.Settings.MainStatusPulseSpeed or 2) * 200 )
  1748. if HUDHive.Settings.XPBoxLeftShowIcon then
  1749. local ImageLeveling = Material(HUDHive.Settings.ArrestedIcon, "noclamp smooth")
  1750. surface.SetDrawColor(doPulse, doPulse, 0, 255)
  1751. surface.SetMaterial(ImageLeveling)
  1752. surface.DrawTexturedRect(200, ScrH() / 2 + 2, 20, 20)
  1753. end
  1754. elseif not LocalPlayer():getDarkRPVar("Arrested") then
  1755. Arrested = function() end
  1756. end
  1757. end
  1758. end)
  1759.  
  1760. usermessage.Hook("AdminTell", function(msg)
  1761. timer.Destroy("DarkRP_AdminTell")
  1762. local Message = msg:ReadString()
  1763.  
  1764. AdminTell = function()
  1765. AdminTellDispatch(Message)
  1766. end
  1767.  
  1768. timer.Create("DarkRP_AdminTell", HUDHive.Settings.AdminTellTimer or 10, 1, function()
  1769. AdminTell = function() end
  1770. end)
  1771.  
  1772. end)
  1773.  
  1774. local function DisplayNotify(msg)
  1775. local txt = msg:ReadString()
  1776. NotificationSystem(txt, msg:ReadShort(), msg:ReadLong())
  1777. surface.PlaySound("buttons/lightswitch2.wav")
  1778. end
  1779. usermessage.Hook("_Notify", DisplayNotify)
  1780.  
  1781. if HUDHive.Settings.XPOriginalHudDisabled and LevelSystemConfiguration and LevelSystemConfiguration.EnableHUD then
  1782. LevelSystemConfiguration.EnableHUD = false
  1783. end
  1784.  
  1785. if HUDHive.Settings.XPOriginalHudDisabled and DARKRP_LVL_SYSTEM and DARKRP_LVL_SYSTEM["SETTINGS"]["ALWAYS_SHOP_XP"] then
  1786. DARKRP_LVL_SYSTEM["SETTINGS"]["ALWAYS_SHOP_XP"] = false
  1787. end
  1788.  
  1789. HUDHiveInitPanel()
  1790.  
  1791. end)
  1792.  
  1793. -----------------------------------------------------------------
  1794. -- [ REFRESH ]
  1795. -----------------------------------------------------------------
  1796.  
  1797. if IsValid(HUDHive.PanelMain) then HUDHiveInitPanel() end
  1798.  
  1799. -----------------------------------------------------------------
  1800. -- [ TICK -> INITIALIZE ]
  1801. -----------------------------------------------------------------
  1802.  
  1803. hook.Add("Tick", "HUDHiveTick", function()
  1804. if not HUDHiveInit == true then
  1805. HUDHiveInitPanel()
  1806. HUDHiveInit = true
  1807. end
  1808. end)
  1809.  
  1810. -----------------------------------------------------------------
  1811. -- [ HIDE HUD KEYBIND ]
  1812. -----------------------------------------------------------------
  1813.  
  1814. if HUDHive.Settings.HideHUDEnabled then
  1815.  
  1816. local nextThink = 0
  1817. HUDHive.MenuKey = HUDHive.Settings.HideHUDKey or KEY_F6
  1818. hook.Add( "Think", "HUDHiveOpenKey", function()
  1819. if nextThink > CurTime() then return end
  1820.  
  1821. if input.IsKeyDown( HUDHive.MenuKey ) then
  1822. local cmd = "1"
  1823.  
  1824. if GetConVarNumber("hudhive_hide") == 1 then
  1825. cmd = "0"
  1826. end
  1827.  
  1828. RunConsoleCommand("hudhive_hide", cmd)
  1829. nextThink = CurTime() + 0.5
  1830. end
  1831.  
  1832. end)
  1833.  
  1834. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement