Advertisement
dahhoovy

cl_cleanhud.lua

Sep 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.14 KB | None | 0 0
  1. surface.CreateFont("Roboto16", {font = "Roboto", size = 16, weight = 350})
  2. surface.CreateFont("Roboto18", {font = "Roboto", size = 18, weight = 350})
  3. surface.CreateFont("Roboto20", {font = "Roboto", size = 20, weight = 350})
  4. surface.CreateFont("Roboto22", {font = "Roboto", size = 22, weight = 350})
  5. surface.CreateFont("Roboto24", {font = "Roboto", size = 24, weight = 350})
  6. surface.CreateFont("Roboto26", {font = "Roboto", size = 26, weight = 350})
  7. surface.CreateFont("Roboto28", {font = "Roboto", size = 28, weight = 350})
  8. surface.CreateFont("Roboto30", {font = "Roboto", size = 30, weight = 350})
  9.  
  10. include ("cleanhud/cleanhud_config.lua")
  11.  
  12. local polyAmmo = {
  13. {x = ScrW() - 150, y = ScrH()},
  14. {x = ScrW() - 150, y = ScrH() - 20},
  15. {x = ScrW() - 125, y = ScrH() - 45},
  16. {x = ScrW(), y = ScrH() - 45},
  17. {x = ScrW(), y = ScrH()}
  18. }
  19.  
  20. local polyAgenda = {
  21. {x = 0, y = 0},
  22. {x = ScrW() * 0.2, y = 0},
  23. {x = ScrW() * 0.2, y = 150},
  24. {x = ScrW() * 0.2 - 25, y = 175},
  25. {x = 0, y = 175}
  26. }
  27.  
  28. local usericon = Material("icon16/user.png")
  29. local moneyicon = Material("icon16/money.png")
  30. local coinsicon = Material("icon16/coins.png")
  31. local timeicon = Material("icon16/time.png")
  32. local hearticon = Material("icon16/heart.png")
  33. local shieldicon = Material("icon16/shield.png")
  34. local Page = Material("icon16/page_white.png")
  35.  
  36. local textFont
  37. local nameFont
  38. local elementSpacing = 0
  39. local innerSpacing = 0
  40. local widthComp = 0
  41.  
  42. local ostime
  43.  
  44. CleanHUD.Agenda = nil
  45.  
  46. local plyMeta = FindMetaTable("Player")
  47.  
  48. function formatInt(i)
  49. return tostring(i):reverse():gsub("%d%d%d", "%1,"):reverse():gsub("^,", "")
  50. end
  51.  
  52. CleanHUD.PulseAlpha = 75
  53.  
  54. -- presets
  55. if CleanHUD.ColorPreset == "dark" then
  56. CleanHUD.PlayerName = Color(0, 200, 190)
  57. CleanHUD.TextColor = Color(230, 230, 230)
  58. CleanHUD.AgendaTitleColor = Color(100, 100, 230)
  59. CleanHUD.BackgroundColor = Color(55, 55, 55, 245)
  60. CleanHUD.AccentColor = Color(125, 125, 125)
  61. CleanHUD.HealthBar = Color(255, 120, 120)
  62. CleanHUD.ArmorBar = Color(120, 120, 255)
  63. CleanHUD.PulseAlpha = 75
  64. end
  65. if CleanHUD.ColorPreset == "light" then
  66. CleanHUD.PlayerName = Color(40, 40, 40)
  67. CleanHUD.TextColor = Color(45, 45, 45)
  68. CleanHUD.AgendaTitleColor = Color(100, 100, 230)
  69. CleanHUD.BackgroundColor = Color(255, 255, 255, 240)
  70. CleanHUD.AccentColor = Color(185, 185, 185)
  71. CleanHUD.HealthBar = Color(255, 120, 120)
  72. CleanHUD.ArmorBar = Color(120, 120, 255)
  73. CleanHUD.PulseAlpha = 220
  74. end
  75. if CleanHUD.ColorPreset == "teal" then
  76. CleanHUD.PlayerName = Color(255, 255, 255)
  77. CleanHUD.TextColor = Color(240, 240, 240)
  78. CleanHUD.AgendaTitleColor = Color(100, 100, 230)
  79. CleanHUD.BackgroundColor = Color(0, 200, 165, 210)
  80. CleanHUD.AccentColor = Color(230, 230, 230)
  81. CleanHUD.HealthBar = Color(255, 120, 120)
  82. CleanHUD.ArmorBar = Color(120, 120, 255)
  83. CleanHUD.PulseAlpha = 190
  84. end
  85. if CleanHUD.ColorPreset == "blue" then
  86. CleanHUD.PlayerName = Color(255, 255, 255)
  87. CleanHUD.TextColor = Color(240, 240, 240)
  88. CleanHUD.AgendaTitleColor = Color(100, 100, 230)
  89. CleanHUD.BackgroundColor = Color(100, 120, 255, 210)
  90. CleanHUD.AccentColor = Color(230, 230, 230)
  91. CleanHUD.HealthBar = Color(255, 120, 120)
  92. CleanHUD.ArmorBar = Color(120, 120, 255)
  93. CleanHUD.PulseAlpha = 210
  94. end
  95. if CleanHUD.ColorPreset == "none" then
  96. CleanHUD.PulseAlpha = 190
  97. end
  98.  
  99. if ScreenScale(640) == 1600 or ScreenScale(640) == 1440 then
  100. textFont = "Roboto20"
  101. nameFont = "Roboto24"
  102. elementSpacing = 45
  103. if CleanHUD.Gamemode == "sandbox" then innerSpacing = -15 end
  104. widthComp = 50
  105. end
  106. if ScreenScale(640) <= 1366 then
  107. textFont = "Roboto20"
  108. nameFont = "Roboto24"
  109. elementSpacing = 90
  110. if CleanHUD.Gamemode == "sandbox" then innerSpacing = -15 end
  111. widthComp = 90
  112. elseif ScreenScale(640) == 1920 then
  113. textFont = "Roboto22"
  114. nameFont = "Roboto30"
  115. elementSpacing = 5
  116. if CleanHUD.Gamemode == "sandbox" then innerSpacing = -20 end
  117. widthComp = 5
  118. innerSpacing = -25
  119. end
  120. if ScreenScale(640) == 1024 then
  121. textFont = "Roboto18"
  122. nameFont = "Roboto22"
  123. elementSpacing = 90
  124. widthComp = 80
  125. innerSpacing = 20
  126. if CleanHUD.Gamemode == "sandbox" then innerSpacing = 0 end
  127. end
  128. if ScreenScale(640) == 800 then
  129. textFont = "Roboto16"
  130. nameFont = "Roboto20"
  131. elementSpacing = 90
  132. widthComp = 80
  133. innerSpacing = 20
  134. if CleanHUD.Gamemode == "sandbox" then innerSpacing = 10 end
  135. end
  136. if ScreenScale(640) == 1680 then
  137. textFont = "Roboto20"
  138. nameFont = "Roboto26"
  139. elementSpacing = 5
  140. innerSpacing = 5
  141. if CleanHUD.Gamemode == "sandbox" then innerSpacing = -20 end
  142. widthComp = 5
  143. end
  144.  
  145. local lerpTbl = {}
  146. lerpTbl.subtractHp = 0
  147. lerpTbl.subtractArmor = 355
  148. lerpTbl.subtractFood = 355
  149. lerpTbl.ammo = 0
  150. lerpTbl.lowAmmo = 0
  151. lerpTbl.highFade = false
  152. -- 335
  153.  
  154. local barOrder = {}
  155. function sortBarOrder()
  156. barOrder.hp = 0
  157. barOrder.armor = 3
  158. barOrder.food = 6
  159.  
  160. if LocalPlayer():Health() >= LocalPlayer():Armor() then
  161. barOrder.hp = barOrder.armor - 3
  162. elseif LocalPlayer():Health() < LocalPlayer():Armor() then
  163. barOrder.hp = barOrder.armor
  164. barOrder.armor = barOrder.hp - 3
  165. end
  166.  
  167. if not DarkRP.disabledDefaults["modules"]["hungermod"] then
  168. if LocalPlayer():getDarkRPVar("Energy") > LocalPlayer():Armor() then
  169. barOrder.food = barOrder.armor
  170. barOrder.armor = barOrder.food + 3
  171. end
  172. if LocalPlayer():getDarkRPVar("Energy") > LocalPlayer():Health() then
  173. barOrder.food = barOrder.hp
  174. barOrder.hp = barOrder.food + 3
  175. end
  176. end
  177. end
  178.  
  179. function drawHp()
  180.  
  181. lerpTbl.subtractHp = Lerp(0.03, lerpTbl.subtractHp, (100 - math.Clamp(LocalPlayer():Health(), 0, 100)) * 3.35)
  182.  
  183. local poly2 = {
  184. {x = (ScrW() * 0.333 - 65) + 50 + lerpTbl.subtractHp - widthComp, y = 40 + barOrder.hp},
  185. {x = (ScrW() * 0.666 + 65) - 50 - lerpTbl.subtractHp + widthComp, y = 40 + barOrder.hp},
  186. {x = (ScrW() * 0.666 + 61) - 50 - lerpTbl.subtractHp + widthComp, y = 43 + barOrder.hp},
  187. {x = (ScrW() * 0.333 - 61) + 50 + lerpTbl.subtractHp - widthComp, y = 43 + barOrder.hp}
  188. }
  189.  
  190. -- hp bar
  191. surface.SetDrawColor(CleanHUD.HealthBar)
  192. draw.NoTexture()
  193. surface.DrawPoly(poly2)
  194.  
  195. end
  196.  
  197. function drawArmor()
  198.  
  199. lerpTbl.subtractArmor = Lerp(0.03, lerpTbl.subtractArmor, (100 - math.Clamp(LocalPlayer():Armor(), 0, 100)) * 3.35)
  200.  
  201. local poly3 = {
  202. {x = (ScrW() * 0.333 - 60) + 50 + lerpTbl.subtractArmor - widthComp, y = 40 + barOrder.armor},
  203. {x = (ScrW() * 0.666 + 60) - 50 - lerpTbl.subtractArmor + widthComp, y = 40 + barOrder.armor},
  204. {x = (ScrW() * 0.666 + 56) - 50 - lerpTbl.subtractArmor + widthComp, y = 43 + barOrder.armor},
  205. {x = (ScrW() * 0.333 - 56) + 50 + lerpTbl.subtractArmor - widthComp, y = 43 + barOrder.armor}
  206. }
  207.  
  208. -- hp bar
  209. surface.SetDrawColor(CleanHUD.ArmorBar)
  210. draw.NoTexture()
  211. surface.DrawPoly(poly3)
  212.  
  213. end
  214.  
  215. function drawFood()
  216.  
  217. local energy = LocalPlayer():getDarkRPVar("Energy")
  218. lerpTbl.subtractFood = Lerp(0.03, lerpTbl.subtractFood, (100 - math.Clamp(energy, 0, 100)) * 3.35)
  219.  
  220. local poly4 = {
  221. {x = (ScrW() * 0.333 - 65) + 50 + lerpTbl.subtractFood - widthComp, y = 40 + barOrder.food},
  222. {x = (ScrW() * 0.666 + 65) - 50 - lerpTbl.subtractFood + widthComp, y = 40 + barOrder.food},
  223. {x = (ScrW() * 0.666 + 61) - 50 - lerpTbl.subtractFood + widthComp, y = 43 + barOrder.food},
  224. {x = (ScrW() * 0.333 - 61) + 50 + lerpTbl.subtractFood - widthComp, y = 43 + barOrder.food}
  225. }
  226.  
  227. -- food/energy bar
  228. surface.SetDrawColor(CleanHUD.FoodBar)
  229. draw.NoTexture()
  230. surface.DrawPoly(poly4)
  231.  
  232. end
  233.  
  234. function drawAmmo()
  235.  
  236. --[[
  237. {x = ScrW() - 150, y = ScrH()},
  238. {x = ScrW() - 150, y = ScrH() - 20},
  239. {x = ScrW() - 125, y = ScrH() - 45},
  240. {x = ScrW(), y = ScrH() - 45},
  241. {x = ScrW(), y = ScrH()}
  242. ]]
  243.  
  244. local ammo = LocalPlayer():GetActiveWeapon():Clip1()
  245.  
  246. surface.SetDrawColor(CleanHUD.BackgroundColor)
  247. draw.NoTexture()
  248. surface.DrawPoly(polyAmmo)
  249. if ammo <= 5 and LocalPlayer():GetActiveWeapon():Clip1() > -1 then
  250. if math.Round(lerpTbl.lowAmmo) == 15 then
  251. lerpTbl.highFade = false
  252. end
  253. if math.Round(lerpTbl.lowAmmo) == CleanHUD.PulseAlpha - 25 then
  254. lerpTbl.highFade = true
  255. end
  256.  
  257. if lerpTbl.highFade then
  258. lerpTbl.lowAmmo = Lerp (0.03, lerpTbl.lowAmmo, 0)
  259. else
  260. lerpTbl.lowAmmo = Lerp (0.03, lerpTbl.lowAmmo, CleanHUD.PulseAlpha)
  261. end
  262. surface.SetDrawColor(255, 120, 120, lerpTbl.lowAmmo)
  263. draw.NoTexture()
  264. surface.DrawPoly(polyAmmo)
  265. end
  266.  
  267. surface.SetDrawColor(CleanHUD.AccentColor)
  268. draw.NoTexture()
  269. surface.DrawLine(ScrW() - 145, ScrH(), ScrW() - 145, ScrH() - 18)
  270. surface.DrawLine(ScrW() - 145, ScrH() - 18, ScrW() - 123, ScrH() - 40)
  271. surface.DrawLine(ScrW() - 123, ScrH() - 40, ScrW(), ScrH() - 40)
  272.  
  273. end
  274.  
  275. function drawAgenda()
  276.  
  277. --[[
  278.  
  279. {x = 0, y = 0},
  280. {x = ScrW() * 0.2, y = 0},
  281. {x = ScrW() * 0.2, y = 125},
  282. {x = ScrW() * 0.2 - 25, y = 150},
  283. {x = 0, y = 150}
  284.  
  285. ]]
  286.  
  287. if CleanHUD.Gamemode == "darkrp" then
  288. local agenda = LocalPlayer():getAgendaTable()
  289. if not agenda then return end
  290. CleanHUD.Agenda = CleanHUD.Agenda or DarkRP.textWrap((LocalPlayer():getDarkRPVar("agenda") or ""):gsub("//", "\n"):gsub("\\n", "\n"), "Roboto28", 440)
  291.  
  292. surface.SetDrawColor(CleanHUD.BackgroundColor)
  293. draw.NoTexture()
  294. surface.DrawPoly(polyAgenda)
  295.  
  296. surface.SetDrawColor(CleanHUD.AccentColor)
  297. draw.NoTexture()
  298. surface.DrawLine(0, 170, ScrW() * 0.2 - 30, 170)
  299. surface.DrawLine(ScrW() * 0.2 - 30, 170, ScrW() * 0.2 - 5, 145)
  300. surface.DrawLine(ScrW() * 0.2 - 5, 145, ScrW() * 0.2 - 5, 0)
  301.  
  302. draw.SimpleText(agenda.Title, "Roboto26", 20, 9, CleanHUD.AgendaTitleColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
  303.  
  304. draw.DrawText(CleanHUD.Agenda , "Roboto20", 20, 45, CleanHUD.TextColor, TEXT_ALIGN_LEFT)
  305. end
  306.  
  307. end
  308.  
  309. plyMeta.drawWantedInfo = function(self)
  310.  
  311. if not self:Alive() then return end
  312.  
  313. local hisPos = self:GetShootPos()
  314. local shootPos = LocalPlayer():GetShootPos()
  315. local aimVec = LocalPlayer():GetAimVector()
  316.  
  317. --if not pos:isInSight({localplayer, self}) then return end
  318.  
  319. if hisPos:DistToSqr(shootPos) < 45000 then
  320. local pos = hisPos - shootPos
  321. local unitPos = pos:GetNormalized()
  322. if unitPos:Dot(aimVec) > 0.95 then
  323. local eyepos = self:EyePos()
  324. eyepos.z = eyepos.z + 15
  325. eyepos = eyepos:ToScreen()
  326.  
  327. if GAMEMODE.Config.showname then
  328. local nick, plyTeam = self:Nick(), self:Team()
  329. draw.DrawNonParsedText(nick, "Roboto22", eyepos.x + 1, eyepos.y + 11, Color(100, 100, 00), 1)
  330. draw.DrawNonParsedText(nick, "Roboto22", eyepos.x, eyepos.y + 10, team.GetColor(plyTeam) , 1)
  331. end
  332.  
  333. local wantedText = DarkRP.getPhrase("wanted", tostring(self:getDarkRPVar("wantedReason")))
  334.  
  335. draw.DrawNonParsedText(wantedText, "Roboto24", eyepos.x + 1, eyepos.y - 41, Color(210, 210, 210), 1)
  336. draw.DrawNonParsedText(wantedText, "Roboto24", eyepos.x, eyepos.y - 40, Color(246, 246, 246), 1)
  337. end
  338. end
  339. end
  340.  
  341. plyMeta.drawPlayerInfo = function(self)
  342. local pos = self:EyePos()
  343.  
  344. if (!CleanHUD.RemovePlayerInfoBackground) then
  345. pos.z = pos.z + 10
  346. else
  347. pos.z = pos.z + 12
  348. end
  349.  
  350. pos = pos:ToScreen()
  351. if CleanHUD.Gamemode == "sandbox" or not self:getDarkRPVar("wanted") then
  352. -- Move the text up a few pixels to compensate for the height of the text
  353. pos.y = pos.y - 75
  354. end
  355.  
  356. local nick, plyTeam = self:Nick(), self:Team()
  357. local teamname = "."
  358. surface.SetFont("Roboto20")
  359. local nameWidth = surface.GetTextSize(nick)
  360.  
  361. if CleanHUD.Gamemode == "darkrp" then
  362. teamname = self:getDarkRPVar("job") or team.GetName(self:Team())
  363. end
  364.  
  365. local jobWidth = surface.GetTextSize(teamname)
  366.  
  367. local width = 175
  368. local height = 85
  369.  
  370. if (!CleanHUD.RemovePlayerInfoBackground) then
  371. if (math.max(nameWidth, jobWidth) > (width - 20)) then
  372. width = math.max(nameWidth, jobWidth) + 22
  373. end
  374. end
  375.  
  376. if (!CleanHUD.RemovePlayerInfoBackground) then
  377. draw.RoundedBox(4, pos.x - width/2, pos.y, width, height, CleanHUD.BackgroundColor)
  378. surface.SetDrawColor(CleanHUD.AccentColor)
  379. draw.NoTexture()
  380. surface.DrawLine(pos.x - width/2 + 5, pos.y + 5, pos.x + width / 2 - 5, pos.y + 5)
  381. surface.DrawLine(pos.x + width / 2 - 5, pos.y + 5, pos.x + width / 2 - 5, pos.y + height - 5)
  382. surface.DrawLine(pos.x + width / 2 - 5, pos.y + height - 5, pos.x - width/2 + 5, pos.y + height - 5)
  383. surface.DrawLine(pos.x - width/2 + 5, pos.y + height - 5, pos.x - width/2 + 5, pos.y + 5)
  384. end
  385.  
  386. if (!CleanHUD.RemovePlayerInfoBackground) then
  387. draw.SimpleText(nick, "Roboto20", pos.x - width/2 + 10, pos.y + 6, CleanHUD.PlayerName)
  388. else
  389. draw.SimpleTextOutlined(nick, "Roboto20", pos.x, pos.y + 6, CleanHUD.PlayerName, TEXT_ALIGN_CENTER, nil, 1, Color(30, 30, 30, 80))
  390. end
  391.  
  392. local health = math.Clamp(math.max(self:Health(), 0), 0, 100)
  393. local barMultiply = (width - 20) / 100
  394. if (!CleanHUD.RemovePlayerInfoBackground) then
  395. draw.RoundedBox(2, pos.x - width/2 + 10, pos.y + height - 13, barMultiply * health, 3, CleanHUD.HealthBar)
  396. else
  397. draw.RoundedBox(2, pos.x - width/2 + 9, pos.y + height - 14, width - 20 + 2, 5, Color(30, 30, 30, 140))
  398. draw.RoundedBox(2, pos.x - width/2 + 10, pos.y + height - 13, barMultiply * health, 3, CleanHUD.HealthBar)
  399. end
  400.  
  401. if CleanHUD.Gamemode == "darkrp" then
  402. if (!CleanHUD.RemoveJobName) then
  403. if (!CleanHUD.RemovePlayerInfoBackground) then
  404. draw.SimpleText(teamname, "Roboto20", pos.x - width/2 + 10, pos.y + 27, CleanHUD.TextColor)
  405. else
  406. draw.SimpleTextOutlined(teamname, "Roboto20", pos.x, pos.y + 27, CleanHUD.TextColor, TEXT_ALIGN_CENTER, nil, 1, Color(30, 30, 30, 80))
  407. end
  408. end
  409. end
  410.  
  411. if CleanHUD.Gamemode == "darkrp" then
  412. if self:getDarkRPVar("HasGunlicense") then
  413. surface.SetMaterial(Page)
  414. surface.SetDrawColor(255,255,255,255)
  415. surface.DrawTexturedRect(pos.x + 50, pos.y + 13, 24, 24)
  416. end
  417. end
  418. end
  419.  
  420. local function DrawEntityDisplay()
  421. local shootPos = LocalPlayer():GetShootPos()
  422. local aimVec = LocalPlayer():GetAimVector()
  423.  
  424.  
  425. for k, ply in pairs(players or player.GetAll()) do
  426. if ply == LocalPlayer() or not ply:Alive() or ply:GetNoDraw() then
  427. if ply.HUDPanel then
  428. ply.HUDPanel:Remove()
  429. ply.HUDPanel = nil
  430. end
  431. continue
  432. end
  433. local hisPos = ply:GetShootPos()
  434. if CleanHUD.Gamemode == "darkrp" then
  435. if ply:getDarkRPVar("wanted") then
  436. if ply.HUDPanel then
  437. ply.HUDPanel:Remove()
  438. ply.HUDPanel = nil
  439. end
  440. ply:drawWantedInfo()
  441. continue
  442. end
  443. end
  444.  
  445. if CleanHUD.Gamemode == "darkrp" and GAMEMODE.Config.globalshow then
  446. ply:drawPlayerInfo()
  447. end
  448. if hisPos:DistToSqr(shootPos) < 45000 then
  449. local pos = hisPos - shootPos
  450. local unitPos = pos:GetNormalized()
  451. if unitPos:Dot(aimVec) > 0.95 then
  452. local trace = util.QuickTrace(shootPos, pos, LocalPlayer())
  453. if trace.Hit and trace.Entity ~= ply then
  454. if ply.HUDPanel then
  455. ply.HUDPanel:Remove()
  456. ply.HUDPanel = nil
  457. end
  458. break
  459. end
  460. ply:drawPlayerInfo()
  461. else
  462. if ply.HUDPanel then
  463. ply.HUDPanel:Remove()
  464. ply.HUDPanel = nil
  465. end
  466. end
  467. else
  468. if ply.HUDPanel then
  469. ply.HUDPanel:Remove()
  470. ply.HUDPanel = nil
  471. end
  472. end
  473. end
  474.  
  475. local tr = LocalPlayer():GetEyeTrace()
  476.  
  477. if CleanHUD.Gamemode == "darkrp" then
  478. if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():DistToSqr(LocalPlayer():GetPos()) < 40000 then
  479. tr.Entity:drawOwnableInfo()
  480. end
  481. end
  482. end
  483.  
  484. hook.Add("DarkRPVarChanged", "agenda", function(ply, var, _, new)
  485. if ply ~= LocalPlayer() then return end
  486. if var == "agenda" and new then
  487. CleanHUD.Agenda = DarkRP.textWrap(new:gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
  488. end
  489. end)
  490.  
  491. hook.Add("HUDPaint", "drawHud", function()
  492.  
  493. local poly1 = {
  494. {x = ScrW() * 0.333 - 70 - widthComp, y = 0},
  495. {x = (ScrW() * 0.666 + 70 + widthComp), y = 0},
  496. {x = (ScrW() * 0.666 + 70 + widthComp) - 50, y = 40},
  497. {x = (ScrW() * 0.333 - 70 - widthComp) + 50, y = 40}
  498. }
  499.  
  500. sortBarOrder()
  501. drawHp()
  502. drawArmor()
  503. if not DarkRP.disabledDefaults["modules"]["hungermod"] then
  504. if LocalPlayer():getDarkRPVar("Energy") > 4 then
  505. drawFood()
  506. end
  507. end
  508. drawAgenda()
  509. DrawEntityDisplay()
  510.  
  511. -- poly1
  512. surface.SetDrawColor(CleanHUD.BackgroundColor)
  513. draw.NoTexture()
  514. surface.DrawPoly(poly1)
  515.  
  516. -- line
  517. surface.SetDrawColor(CleanHUD.AccentColor)
  518. draw.NoTexture()
  519. surface.DrawLine(ScrW() * 0.333 - 60 - widthComp, 0, (ScrW() * 0.333 - 70) + 55 - widthComp, 35)
  520. surface.DrawLine((ScrW() * 0.333 - 70) + 55 - widthComp, 35, (ScrW() * 0.666 + 70) - 55 + widthComp, 35)
  521. surface.DrawLine((ScrW() * 0.666 + 70) - 55 + widthComp, 35, (ScrW() * 0.666 + 60) + widthComp, 0)
  522.  
  523. -- job / rank
  524. surface.SetDrawColor(255, 255, 255)
  525. surface.SetMaterial(usericon)
  526. surface.DrawTexturedRect(ScrW() * 0.333 - 10 - elementSpacing, 10, 16, 16)
  527. if CleanHUD.Gamemode == "darkrp" then
  528. local job = string.sub(LocalPlayer():getDarkRPVar("job"), 1, 13)
  529. draw.SimpleText(job, textFont, ScrW() * 0.333 + 15 - elementSpacing, 18, CleanHUD.TextColor, nil, TEXT_ALIGN_CENTER)
  530. elseif CleanHUD.Gamemode == "sandbox" then
  531. local rank = string.sub(CleanHUD.UserGroups[LocalPlayer():GetUserGroup()], 1, 13)
  532. draw.SimpleText(rank, textFont, ScrW() * 0.333 + 15 - elementSpacing, 18, CleanHUD.TextColor, nil, TEXT_ALIGN_CENTER)
  533. end
  534.  
  535. -- money / HP
  536. if CleanHUD.Gamemode == "darkrp" then
  537. surface.SetMaterial(moneyicon)
  538. surface.DrawTexturedRect(ScrW() * 0.333 + 115 - elementSpacing - innerSpacing, 10, 16, 16)
  539. local money = string.sub(formatInt(LocalPlayer():getDarkRPVar("money")), 1, 11)
  540. draw.SimpleText("$" .. money, textFont, ScrW() * 0.333 + 137 - elementSpacing - innerSpacing, 18, CleanHUD.TextColor, nil, TEXT_ALIGN_CENTER)
  541. elseif CleanHUD.Gamemode == "sandbox" then
  542. surface.SetMaterial(hearticon)
  543. surface.DrawTexturedRect(ScrW() * 0.333 + 115 - elementSpacing - innerSpacing, 10, 16, 16)
  544. local health = string.sub(LocalPlayer():Health(), 1, 10)
  545. draw.SimpleText(health, textFont, ScrW() * 0.333 + 137 - elementSpacing - innerSpacing, 18, CleanHUD.TextColor, nil, TEXT_ALIGN_CENTER)
  546. end
  547.  
  548. -- salary / armor
  549. if CleanHUD.Gamemode == "darkrp" then
  550. surface.SetMaterial(coinsicon)
  551. surface.DrawTexturedRect(ScrW() * 0.666 - 175 + elementSpacing + innerSpacing, 10, 16, 16)
  552. draw.SimpleText("$" .. formatInt(LocalPlayer():getDarkRPVar("salary")), textFont, ScrW() * 0.666 - 152 + elementSpacing + innerSpacing, 18, CleanHUD.TextColor, nil, TEXT_ALIGN_CENTER)
  553. elseif CleanHUD.Gamemode == "sandbox" then
  554. surface.SetMaterial(shieldicon)
  555. surface.DrawTexturedRect(ScrW() * 0.666 - 170 + elementSpacing + innerSpacing, 10, 16, 16)
  556. draw.SimpleText(LocalPlayer():Armor(), textFont, ScrW() * 0.666 - 147 + elementSpacing + innerSpacing, 18, CleanHUD.TextColor, nil, TEXT_ALIGN_CENTER)
  557. end
  558.  
  559.  
  560. -- local time
  561. ostime = os.time()
  562. surface.SetMaterial(timeicon)
  563. surface.DrawTexturedRect(ScrW() * 0.666 - 65 + elementSpacing, 10, 16, 16)
  564. draw.SimpleText(os.date( "%H:%M" , ostime ), textFont, ScrW() * 0.666 - 40 + elementSpacing, 18, CleanHUD.TextColor, nil, TEXT_ALIGN_CENTER)
  565.  
  566. -- playername
  567. local name = string.sub(LocalPlayer():Nick(), 1, 11)
  568. local nameY = 29
  569. if ScreenScale(640) == 1920 then nameY = 32 end
  570. draw.SimpleText(name, nameFont, ScrW() / 2, nameY, CleanHUD.PlayerName, TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM)
  571.  
  572. if IsValid(LocalPlayer():GetActiveWeapon()) then
  573. lerpTbl.ammo = Lerp(0.045, lerpTbl.ammo, LocalPlayer():GetActiveWeapon():Clip1())
  574. local mag_extra = LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetPrimaryAmmoType())
  575. local ammo = (math.max(math.Round(lerpTbl.ammo), 0)) .. " / " .. mag_extra
  576.  
  577. if ammo != "0 / 0" then
  578. drawAmmo()
  579. draw.SimpleText(ammo, "Roboto28", (ScrW() - 117) + 100/2, ScrH() - 33, CleanHUD.TextColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
  580. end
  581. end
  582. end)
  583.  
  584.  
  585. local hideHUDElements = {
  586. ["DarkRP_HUD"] = true,
  587. ["DarkRP_EntityDisplay"] = true,
  588. ["DarkRP_Agenda"] = true,
  589. ["DarkRP_LocalPlayerHUD"] = true,
  590. ["DarkRP_Hungermod"] = true,
  591. CHudAmmo = true,
  592. CHudHealth = true,
  593. CHudBattery = true
  594. }
  595.  
  596. hook.Add("HUDShouldDraw", "hideHudElements", function(name)
  597. if hideHUDElements[name] then return false end
  598. end)
  599.  
  600. hook.Add("HUDDrawTargetID", "hideCursorHud", function()
  601. return false
  602. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement