Advertisement
Guest User

Untitled

a guest
May 28th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Creates a convar (console variable) to disable/enable the ui.
  2. local d3uiHUDEnable_Sbox = CreateClientConVar( "d3HUD_Enable_Sbox", "1", true, true )
  3. // This one is for numbers on the health orbs.
  4. local d3uiHUDHPNum_Sbox = CreateClientConVar( "d3HPNum_enable_Sbox", "0", true, true )
  5.  
  6.  
  7. -- Caches the textures in memory. It's bad to fetch the textures over and over again every single frame.
  8. -- VMT files have to be used for images that have ditherd, smooth edges that fade to transparency.
  9. -- PNGs will have some white spots instead of transparent on the edges. Don't know why but they do.
  10. local healthOverlayTex = Material( "d3hb/d3health", "nocull smooth" ) -- VMT
  11. local OverlayGoop = Material( "d3hb/d3healthgoop.png", "nocull smooth" ) -- PNG
  12.  
  13. local armorOverlayTex = Material( "d3hb/d3armor", "nocull smooth" )
  14. local armorGoop = Material( "d3hb/d3armorgoop.png", "nocull smooth" )
  15.  
  16. local infoOverlay = Material( "d3hb/d3info", "nocull smooth" )
  17. local infoRadar = Material( "d3hb/d3radar.png", "nocull smooth" )
  18. local infoHunger = Material( "d3hb/d3hunger.png", "nocull smooth" )
  19.  
  20.  
  21. surface.CreateFont( "MoneyFont_14", {
  22. font = "Exocet Light",
  23. size = 14,
  24. weight = 500,
  25. blursize = 0,
  26. scanlines = 0,
  27. } )
  28.  
  29. surface.CreateFont( "MoneyFont_12", {
  30. font = "Exocet Light",
  31. size = 10,
  32. weight = 500,
  33. blursize = 0,
  34. scanlines = 0,
  35. } )
  36.  
  37. surface.CreateFont( "WeaponFont", {
  38. font = "Exocet Light",
  39. size = 14,
  40. weight = 500,
  41. blursize = 0,
  42. scanlines = 0,
  43. } )
  44.  
  45. surface.CreateFont( "WeaponFont_Small", {
  46. font = "Exocet Light",
  47. size = 10,
  48. weight = 500,
  49. blursize = 0,
  50. scanlines = 0,
  51. } )
  52.  
  53. surface.CreateFont( "WeaponFont_Extra_Small", {
  54. font = "Exocet Light",
  55. size = 8,
  56. weight = 500,
  57. blursize = 0,
  58. scanlines = 0,
  59. } )
  60.  
  61. surface.CreateFont( "AmmoFont", {
  62. font = "Exocet Light",
  63. size = 25,
  64. weight = 500,
  65. blursize = 0,
  66. scanlines = 0,
  67. } )
  68.  
  69. surface.CreateFont( "JobFont_24", {
  70. font = "Exocet Light",
  71. size = 24,
  72. weight = 500,
  73. blursize = 0,
  74. scanlines = 0,
  75. } )
  76.  
  77. surface.CreateFont( "JobFont_18", {
  78. font = "Exocet Light",
  79. size = 18,
  80. weight = 500,
  81. blursize = 0,
  82. scanlines = 0,
  83. } )
  84.  
  85. surface.CreateFont( "JobFont_14", {
  86. font = "Exocet Light",
  87. size = 14,
  88. weight = 500,
  89. blursize = 0,
  90. scanlines = 0,
  91. } )
  92.  
  93. surface.CreateFont( "JobFont_10", {
  94. font = "Exocet Light",
  95. size = 10,
  96. weight = 500,
  97. blursize = 0,
  98. scanlines = 0,
  99. } )
  100.  
  101. surface.CreateFont( "JobFont_8", {
  102. font = "Exocet Light",
  103. size = 8,
  104. weight = 500,
  105. blursize = 0,
  106. scanlines = 0,
  107. } )
  108.  
  109. /*-------------------------------------------------------------------
  110. This hook draws Health and Armor.
  111. -------------------------------------------------------------------*/
  112.  
  113. -- These have to be set outside the hook so they don't override everytime.
  114. local hpsmoothing = 0
  115. local arsmoothing = 0
  116.  
  117.  
  118. hook.Add( "HUDPaint", "!HUDDiablo", function()
  119.  
  120. if GetConVar( "d3HUD_Enable_Sbox" ):GetBool() == false then return end
  121.  
  122. local ply = LocalPlayer()
  123.  
  124. local w = 512
  125. local h = 256
  126.  
  127. local g = ScrW() / 2
  128.  
  129. local y = ScrH() - h + 100
  130. local z = ScrW() - 620 - g
  131.  
  132.  
  133. -- gets and draws the players job
  134. darkrpJob = ply:GetUserGroup()
  135. JobFont = "JobFont_24"
  136.  
  137. if string.len( darkrpJob ) > 18 then JobFont = "JobFont_8" elseif string.len( darkrpJob ) > 15 then JobFont = "JobFont_10" elseif string.len( darkrpJob ) > 10 then JobFont = "JobFont_14" elseif string.len( darkrpJob ) > 8 then JobFont = "JobFont_18" end
  138.  
  139. -- Number of props spawned and the max.
  140. -- the # takes the returned table and makes it a number
  141. -- GetConVar( "sbox_maxprops" ):GetInt()
  142. -- ply:GetCount( "props" )
  143.  
  144. end )
  145.  
  146.  
  147. // I added _Conf to the end of these just incase some other addon messes just happens
  148. // to have the same variable.
  149.  
  150. // Enable this if you use a special hunger mod that has it's own special meter
  151. // or you want have the default DarkRP hunger mod on but don't want your players
  152. // to see the UI for it for whaterver reason.
  153. SpecialHungerMod_Conf = false
  154.  
  155. // Set this to 1 (the default) for the players model, 2 for player's steam avatar,
  156. // 3 for a custom png, 0 for nothing (ugly, but supported).
  157. ShowHUDModel_Conf = 2
  158.  
  159. // Either overwrite the .png in the material/custom folder or change this to
  160. // your new one. The new one should be 56x56 pixels.
  161. ShowHUDModelCustomPNG_Conf = "custom/customimage.png" -- default image
  162.  
  163. // Incase you think the defaul font (Exocet Light) is unreadable here is a way to
  164. // change it.
  165. // Default is "JobFont_14"
  166. // Options you can choose from by default are here: https://wiki.garrysmod.com/page/Default_Fonts
  167.  
  168. AgendaFont_Conf = "JobFont_14"
  169.  
  170.  
  171. local hide = {
  172. CHudHealth = true,
  173. CHudBattery = true,
  174. CHudAmmo = true,
  175. CHudSecondaryAmmo = true,
  176. //CHudWeaponSelection = true,
  177. CHudDeathNotice = true
  178. //CHudWeapon = true
  179. }
  180.  
  181. surface.CreateFont("ImpactBig", {font = "Impact",
  182. size = 45,
  183. weight = 700})
  184. surface.CreateFont("ImpactSmall", {font = "Impact",
  185. size = 30,
  186. weight = 700})
  187.  
  188. surface.CreateFont( "RadioFont", {
  189. font = "Impact",
  190. extended = false,
  191. size = 26,
  192. weight = 7000,
  193. blursize = 0,
  194. scanlines = 0,
  195. antialias = true,
  196. underline = false,
  197. italic = false,
  198. strikeout = false,
  199. symbol = false,
  200. rotary = false,
  201. shadow = false,
  202. additive = false,
  203. outline = false,
  204. } )
  205.  
  206. function GM:DrawDeathNotice( x, y )
  207. end
  208.  
  209. hook.Add( "HUDShouldDraw", "HideHUD", function( name )
  210. if ( hide[ name ] ) then return false end
  211. end )
  212.  
  213. endmessages = {
  214. {
  215. main = clang.lang_end1,
  216. txt = clang.lang_end2,
  217. clr = gteams.GetColor(TEAM_SCP)
  218. },
  219. {
  220. main = clang.lang_end1,
  221. txt = clang.lang_end3,
  222. clr = gteams.GetColor(TEAM_SCP)
  223. }
  224. }
  225.  
  226. function DrawInfo(pos, txt, clr)
  227. pos = pos:ToScreen()
  228. draw.TextShadow( {
  229. text = txt,
  230. pos = { pos.x, pos.y },
  231. font = "HealthAmmo",
  232. color = clr,
  233. xalign = TEXT_ALIGN_CENTER,
  234. yalign = TEXT_ALIGN_CENTER,
  235. }, 2, 255 )
  236. end
  237.  
  238. hook.Add( "Tick", "966check", function()
  239. local hide = true
  240. if LocalPlayer().GTeam == nil then return end
  241. if LocalPlayer():GTeam() == TEAM_SCP then
  242. hide = false
  243. end
  244. if IsValid(LocalPlayer():GetActiveWeapon()) then
  245. if LocalPlayer():GetActiveWeapon():GetClass() == "item_nvg" then
  246. hide = false
  247. end
  248. end
  249. for k,v in pairs(player.GetAll()) do
  250. if not v.GetNClass then
  251. player_manager.RunClass( v, "SetupDataTables" )
  252. end
  253. if v.GetNClass == nil then return end
  254. if v:GetNClass() == ROLES.ROLE_SCP966 then
  255. v:SetNoDraw(hide)
  256. end
  257. end
  258. end )
  259.  
  260. local info1 = Material( "breach/info_mtf.png")
  261. hook.Add( "HUDPaint", "Breach_DrawHUD", function()
  262. //cam.Start3D()
  263. // for id, ply in pairs( player.GetAll() ) do
  264. // if ply:GetNClass() == ROLES.ROLE_SCP966 then
  265. // ply:DrawModel()
  266. // end
  267. // end
  268. //cam.End3D()
  269. if disablehud == true then return end
  270. if POS_914B_BUTTON != nil and isstring(buttonstatus) then
  271. if LocalPlayer():GetPos():Distance(POS_914B_BUTTON) < 200 then
  272. DrawInfo(POS_914B_BUTTON, buttonstatus, Color(255,255,255))
  273. end
  274. end
  275.  
  276. /*
  277. for k,v in pairs(SPAWN_ARMORS) do
  278. DrawInfo(v, "Kamizelka", Color(255,255,255))
  279. end
  280.  
  281. for k,v in pairs(SPAWN_FIREPROOFARMOR) do
  282. DrawInfo(v, "OKamizelka", Color(255,255,255))
  283. end
  284.  
  285.  
  286. if BUTTONS != nil then
  287. for k,v in pairs(BUTTONS) do
  288. DrawInfo(v.pos, v.name, Color(0,255,50))
  289. end
  290.  
  291.  
  292. for k,v in pairs(SPAWN_KEYCARD2) do
  293. for _,v2 in pairs(v) do
  294. DrawInfo(v2, "Karta2", Color(255,255,0))
  295. end
  296. end
  297. for k,v in pairs(SPAWN_KEYCARD3) do
  298. for _,v2 in pairs(v) do
  299. DrawInfo(v2, "Karta3", Color(255,120,0))
  300. end
  301. end
  302. for k,v in pairs(SPAWN_KEYCARD4) do
  303. for _,v2 in pairs(v) do
  304. DrawInfo(v2, "Karta4", Color(255,0,0))
  305. end
  306. end
  307.  
  308.  
  309. for k,v in pairs(SPAWN_SMGS) do
  310. DrawInfo(v, "SMG", Color(255,255,255))
  311. end
  312. for k,v in pairs(SPAWN_RIFLES) do
  313. DrawInfo(v, "KARABIN", Color(0,255,255))
  314. end
  315.  
  316. end
  317. */
  318. /*
  319. if #player.GetAll() < MINPLAYERS then
  320. draw.TextShadow( {
  321. text = "Brak wystarczającej ilości Graczy aby rozpocząć rundę",
  322. pos = { ScrW() / 2, ScrH() / 15 },
  323. font = "ImpactBig",
  324. color = Color(255,255,255),
  325. xalign = TEXT_ALIGN_CENTER,
  326. yalign = TEXT_ALIGN_CENTER,
  327. }, 2, 255 )
  328. draw.TextShadow( {
  329. text = "Brak wystarczającej ilości Graczy na serwerze aby rozpocząć rundę",
  330. pos = { ScrW() / 2, ScrH() / 15 + 45 },
  331. font = "ImpactSmall",
  332. color = Color(255,255,255),
  333. xalign = TEXT_ALIGN_CENTER,
  334. yalign = TEXT_ALIGN_CENTER,
  335. }, 2, 255 )
  336. return
  337.  
  338. elseif gamestarted == false then
  339. draw.TextShadow( {
  340. text = "Gra rozpoczyna siÄ™",
  341. pos = { ScrW() / 2, ScrH() / 15 },
  342. font = "ImpactBig",
  343. color = Color(255,128,70),
  344. xalign = TEXT_ALIGN_CENTER,
  345. yalign = TEXT_ALIGN_CENTER,
  346. }, 2, 255 )
  347. draw.TextShadow( {
  348. text = "Oczekiwanie na start rundy",
  349. pos = { ScrW() / 2, ScrH() / 15 + 45 },
  350. font = "ImpactSmall",
  351. color = Color(255,255,255),
  352. xalign = TEXT_ALIGN_CENTER,
  353. yalign = TEXT_ALIGN_CENTER,
  354. }, 2, 255 )
  355. return
  356. end
  357. */
  358.  
  359. if shoulddrawinfo == true then
  360. local getrl = LocalPlayer():GetNClass()
  361. for k,v in pairs(ROLES) do
  362. if v == getrl then
  363. getrl = k
  364. end
  365. end
  366. for k,v in pairs(clang.starttexts) do
  367. if k == getrl then
  368. getrl = v
  369. break
  370. end
  371. end
  372. local align = 32
  373. local tcolor = gteams.GetColor(LocalPlayer():GTeam())
  374. if LocalPlayer():GTeam() == TEAM_CHAOS then
  375. tcolor = Color(29, 81, 56)
  376. end
  377.  
  378.  
  379.  
  380. if getrl[1] != nil then
  381. draw.TextShadow( {
  382. text = getrl[1],
  383. pos = { ScrW() / 2, ScrH() / 15 },
  384. font = "ImpactBig",
  385. color = tcolor,
  386. xalign = TEXT_ALIGN_CENTER,
  387. yalign = TEXT_ALIGN_CENTER,
  388. }, 2, 255 )
  389. end
  390. for i,txt in ipairs(getrl[2]) do
  391. draw.TextShadow( {
  392. text = txt,
  393. pos = { ScrW() / 2, ScrH() / 15 + 10 + (align * i) },
  394. font = "ImpactSmall",
  395. color = Color(255,255,255),
  396. xalign = TEXT_ALIGN_CENTER,
  397. yalign = TEXT_ALIGN_CENTER,
  398. }, 2, 255 )
  399. end
  400. /*
  401. if roundtype != nil then
  402. draw.TextShadow( {
  403. text = string.Replace( clang.roundtype, "{type}", roundtype ),
  404. pos = { ScrW() / 2, ScrH() - 25 },
  405. font = "ImpactSmall",
  406. color = Color(255, 130, 0),
  407. xalign = TEXT_ALIGN_CENTER,
  408. yalign = TEXT_ALIGN_CENTER,
  409. }, 2, 255 )
  410. end
  411. */
  412. end
  413. if isnumber(drawendmsg) then
  414. local ndtext = clang.lang_end2
  415. if drawendmsg == 2 then
  416. ndtext = clang.lang_end3
  417. end
  418. //if clang.endmessages[drawendmsg] then
  419. shoulddrawinfo = false
  420. draw.TextShadow( {
  421. text = clang.lang_end1,
  422. pos = { ScrW() / 2, ScrH() / 15 },
  423. font = "ImpactBig",
  424. color = Color(0,255,0),
  425. xalign = TEXT_ALIGN_CENTER,
  426. yalign = TEXT_ALIGN_CENTER,
  427. }, 2, 255 )
  428. draw.TextShadow( {
  429. text = ndtext,
  430. pos = { ScrW() / 2, ScrH() / 15 + 45 },
  431. font = "ImpactSmall",
  432. color = Color(255,255,255),
  433. xalign = TEXT_ALIGN_CENTER,
  434. yalign = TEXT_ALIGN_CENTER,
  435. }, 2, 255 )
  436. for i,txt in ipairs(endinformation) do
  437. draw.TextShadow( {
  438. text = txt,
  439. pos = { ScrW() / 2, ScrH() / 8 + (35 * i)},
  440. font = "ImpactSmall",
  441. color = color_white,
  442. xalign = TEXT_ALIGN_CENTER,
  443. yalign = TEXT_ALIGN_CENTER,
  444. }, 2, 255 )
  445. end
  446. //else
  447. // drawendmsg = nil
  448. //end
  449. else
  450. if isnumber(shoulddrawescape) then
  451. if CurTime() > lastescapegot then
  452. shoulddrawescape = nil
  453. end
  454. if clang.escapemessages[shoulddrawescape] then
  455. local tab = clang.escapemessages[shoulddrawescape]
  456. draw.TextShadow( {
  457. text = tab.main,
  458. pos = { ScrW() / 2, ScrH() / 15 },
  459. font = "ImpactBig",
  460. color = tab.clr,
  461. xalign = TEXT_ALIGN_CENTER,
  462. yalign = TEXT_ALIGN_CENTER,
  463. }, 2, 255 )
  464. draw.TextShadow( {
  465. text = string.Replace( tab.txt, "{t}", string.ToMinutesSecondsMilliseconds(esctime) ),
  466. pos = { ScrW() / 2, ScrH() / 15 + 45 },
  467. font = "ImpactSmall",
  468. color = Color(255,255,255),
  469. xalign = TEXT_ALIGN_CENTER,
  470. yalign = TEXT_ALIGN_CENTER,
  471. }, 2, 255 )
  472. draw.TextShadow( {
  473. text = tab.txt2,
  474. pos = { ScrW() / 2, ScrH() / 15 + 75 },
  475. font = "ImpactSmall",
  476. color = Color(255,255,255),
  477. xalign = TEXT_ALIGN_CENTER,
  478. yalign = TEXT_ALIGN_CENTER,
  479. }, 2, 255 )
  480. end
  481. end
  482. end
  483. local ply = LocalPlayer()
  484. if ply:Alive() == false then return end
  485.  
  486. if ply:GTeam() == TEAM_SPEC then
  487. local ent = ply:GetObserverTarget()
  488. if IsValid(ent) then
  489. if ent:IsPlayer() then
  490. local sw = 350
  491. local sh = 35
  492. local sx = ScrW() / 2 - (sw / 2)
  493. local sy = 0
  494. draw.RoundedBox(0, sx, sy, sw, sh, Color(50,50,50,255))
  495. draw.TextShadow( {
  496. text = string.sub(ent:Nick(), 1, 17),
  497. pos = { sx + sw / 2, 15 },
  498. font = "HealthAmmo",
  499. color = Color(255,255,255),
  500. xalign = TEXT_ALIGN_CENTER,
  501. yalign = TEXT_ALIGN_CENTER,
  502. }, 2, 255 )
  503. end
  504. end
  505. //return
  506. end
  507. local wep = nil
  508. local ammo = -1
  509. local ammo2 = -1
  510.  
  511. local width = 400
  512. local height = 130
  513. local role_width = width - 30
  514.  
  515. local x,y
  516. x = 245
  517. y = ScrH() - height - 15
  518. local hl = math.Clamp(LocalPlayer():Health(), 1, LocalPlayer():GetMaxHealth()) / LocalPlayer():GetMaxHealth()
  519. if hl < 0.06 then hl = 0.06 end
  520.  
  521. local r,e
  522. r = 16
  523. e = ScrH() - height - 60
  524.  
  525. local a,q
  526. a = 266
  527. q = ScrH() - height - 65
  528.  
  529. local widthh = 75
  530. local heightt = 40
  531.  
  532. local name = "Nikt"
  533. if not ply.GetNClass then
  534. player_manager.RunClass( ply, "SetupDataTables" )
  535. elseif LocalPlayer():GTeam() != TEAM_SPEC then
  536. name = GetLangRole(ply:GetNClass())
  537. /*
  538. if ply:GTeam() == TEAM_CHAOS then
  539. name = GetLangRole(ROLES.ROLE_CHAOS)
  540. //if ply:GetNClass() == ROLE_MTFNTF then
  541. // name = "MTF NTF (SPY)"
  542. //end
  543. end
  544. */
  545. else
  546. local obs = ply:GetObserverTarget()
  547. if IsValid(obs) then
  548. if obs.GetNClass != nil then
  549. name = GetLangRole(obs:GetNClass())
  550. ply = obs
  551. else
  552. name = GetLangRole(ply:GetNClass())
  553. end
  554. else
  555. name = GetLangRole(ply:GetNClass())
  556. end
  557. end
  558. local color = gteams.GetColor( ply:GTeam() )
  559. if ply:GTeam() == TEAM_CHAOS then
  560. color = Color(29, 81, 56)
  561. end
  562. draw.RoundedBox(0, a, q, widthh, heightt, Color(64,64,64,200))
  563. draw.RoundedBox(0, r, e, role_width - 120, 30, color )
  564.  
  565. draw.TextShadow( {
  566. text = name,
  567. pos = { role_width / 1 - 250, y - 30.5 },
  568. font = "HealthAmmo",
  569. color = Color(255,255,255),
  570. xalign = TEXT_ALIGN_CENTER,
  571. yalign = TEXT_ALIGN_CENTER,
  572. }, 2, 255 )
  573.  
  574. local tclr = Color(255,255,204)
  575. draw.TextShadow( {
  576. text = tostring(string.ToMinutesSeconds( cltime )),
  577. pos = { width - 128, y - 43 },
  578. font = "TimeLeft",
  579. color = tclr,
  580. xalign = TEXT_ALIGN_TOP,
  581. yalign = TEXT_ALIGN_TOP,
  582. }, 2, 255 )
  583.  
  584. // ping
  585. draw.TextShadow( {
  586. text = "Ping: " .. ply:Ping() , Color( 255, 255, 255, 255 ),
  587. pos = { width - 307, y + 2 },
  588. font = "MoneyFont_14",
  589. color = Color(255,255,255),
  590. xalign = TEXT_ALIGN_RIGHT,
  591. yalign = TEXT_ALIGN_RIGHT,
  592. }, 2, 255 )
  593.  
  594. // fps
  595. draw.TextShadow( {
  596. text = "FPS: " .. ( math.floor(1/FrameTime()) ) , MoneyFont_14, Color( 255, 255, 255, 255 ),
  597. pos = { width - 300, y - 12 },
  598. font = "MoneyFont_14",
  599. color = Color(255,255,255),
  600. xalign = TEXT_ALIGN_RIGHT,
  601. yalign = TEXT_ALIGN_RIGHT,
  602. }, 2, 255 )
  603. local w = 512
  604. local h = 256
  605.  
  606. // ranga
  607. draw.TextShadow( {
  608. text = darkrpJob, JobFont, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER,
  609. pos = { width - 180, y - 5 },
  610. font = "MoneyFont_14",
  611. color = Color(255,255,255),
  612. xalign = TEXT_ALIGN_RIGHT,
  613. yalign = TEXT_ALIGN_RIGHT,
  614. }, 2, 255 )
  615.  
  616.  
  617. // Health bar
  618. draw.TextShadow( {
  619. text = ply:Health(),
  620. pos = { width - 205, y + 100 },
  621. font = "HealthAmmo",
  622. color = Color(255,255,255),
  623. xalign = TEXT_ALIGN_RIGHT,
  624. yalign = TEXT_ALIGN_RIGHT,
  625. }, 2, 255 )
  626.  
  627. local ammotext = nil
  628. local wep = nil
  629.  
  630.  
  631.  
  632. if ply:GetActiveWeapon() != nil and #ply:GetWeapons() > 0 then
  633. wep = ply:GetActiveWeapon()
  634. if wep then
  635. if wep.Clip1 == nil then return end
  636. if wep:Clip1() > -1 then
  637. ammo1 = wep:Clip1()
  638. ammo2 = ply:GetAmmoCount( wep:GetPrimaryAmmoType() )
  639. ammotext = ammo1 .. " + ".. ammo2
  640. end
  641. end
  642. end
  643.  
  644. if not ammotext then return end
  645. local am = math.Clamp(wep:Clip1(), 0, wep:GetMaxClip1()) / wep:GetMaxClip1()
  646.  
  647. // Ammo
  648. draw.RoundedBox(0, 18, y + 18, (width - 80) * am, 27, Color(205, 155, 0, 255))
  649. draw.TextShadow( {
  650. text = ammotext,
  651. pos = { width - 286, y + 18 },
  652. font = "HealthAmmo",
  653. color = Color(255,255,255),
  654. xalign = TEXT_ALIGN_RIGHT,
  655. yalign = TEXT_ALIGN_RIGHT,
  656. }, 2, 255 )
  657.  
  658. end )
  659.  
  660. //
  661. // LOADING MATERIALS
  662. //
  663.  
  664.  
  665. local ekg_background = Material( "ekg_hud/ekg_hud.png", "nocull" )
  666.  
  667. local ekg_stencil = Material( "ekg_hud/ekg_hud_stencil.png", "nocull" )
  668.  
  669. local ekg_ammo = Material( "ekg_hud/ekg_ammo.png", "nocull" )
  670.  
  671. local ekg_beep = Material( "ekg_hud/beep.png", "nocull")
  672.  
  673. local ekg_agenda = Material ( "ekg_hud/ekg_agenda.png", "nocull")
  674.  
  675. local ekg_armor_full = Material ( "ekg_hud/ekg_armor_full.png", "nocull")
  676.  
  677. local ekg_armor_mid = Material ( "ekg_hud/ekg_armor_mid.png", "nocull")
  678.  
  679. local ekg_armor_low = Material ( "ekg_hud/ekg_armor_low.png", "nocull")
  680.  
  681. local ekg_hunger_low = Material ( "ekg_hud/ekg_hunger_low.png", "nocull")
  682.  
  683. local ekg_hunger_mid = Material ( "ekg_hud/ekg_hunger_mid.png", "nocull")
  684.  
  685. local ekg_hunger_high = Material ( "ekg_hud/ekg_hunger_high.png", "nocull")
  686.  
  687. //
  688. // FONTS SETUP
  689. //
  690.  
  691. local ekg_size = 1
  692.  
  693. local ekg_height = (ScrH()/4.29)*ekg_size
  694. local ekg_width = (ScrW()/4.29)*ekg_size
  695. local beepXsize = 40*ekg_size
  696.  
  697. if ScrW() >= 1920 then
  698. ekg_size = 0.9
  699. ekg_height = (ScrH()/4.29)*0.75
  700. ekg_width = (ScrW()/4.29)*0.75
  701. beepXsize = 40*ekg_size
  702. elseif ScrW() >= 1600 then
  703. ekg_size = 0.95
  704. ekg_height = (ScrH()/4.29)*ekg_size
  705. ekg_width = (ScrW()/4.29)*ekg_size
  706. beepXsize = 40*ekg_size
  707. elseif ScrW() >= 1280 && ScrW() < 1600 then
  708. ekg_size = 0.8
  709. ekg_height = (ScrH()/4.29)
  710. ekg_width = (ScrW()/4.29)
  711. beepXsize = 35*ekg_size
  712. end
  713.  
  714.  
  715. local ekg_scale = 1.75
  716. local ekg_scale_global = ScrW()/(367*ekg_scale)
  717.  
  718. surface.CreateFont( "ekg_font_ammo",
  719. {
  720. font = "8BIT WONDER",
  721. size = 18/ekg_scale,
  722. weight = 250,
  723. antialias = true,
  724. strikeout = true,
  725. additive = false,
  726. blursize = 0,
  727. } )
  728.  
  729. surface.CreateFont( "ekg_font",
  730. {
  731. font = "8BIT WONDER",
  732. size = (26/ekg_scale)*ekg_size,
  733. weight = 250,
  734. antialias = true,
  735. strikeout = true,
  736. additive = true,
  737. blursize = 0,
  738. } )
  739.  
  740. surface.CreateFont( "ekg_font_primary_ammo",
  741. {
  742. font = "8BIT WONDER",
  743. size = 64/ekg_scale,
  744. weight = 100,
  745. antialias = true,
  746. strikeout = true,
  747. additive = true,
  748. blursize = 1,
  749. } )
  750.  
  751. surface.CreateFont( "ekg_agenda_font",
  752. {
  753. font = "8BIT WONDER",
  754. size = 20/ekg_scale,
  755. weight = 250,
  756. antialias = true,
  757. strikeout = true,
  758. additive = true,
  759. blursize = 0,
  760. } )
  761.  
  762. local currentHealth = 0
  763. local blur = Material( "pp/blurscreen" )
  764. local function blur_kek( x, y, w, h, layers, density, alpha )
  765. surface.SetDrawColor( 255, 255, 255, alpha )
  766. surface.SetMaterial( blur )
  767.  
  768. for i = 1, layers do
  769. blur:SetFloat( "$blur", ( i / layers ) * density )
  770. blur:Recompute()
  771.  
  772. render.UpdateScreenEffectTexture()
  773. render.SetScissorRect( x, y, x + w, y + h, true )
  774. surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
  775. render.SetScissorRect( 0, 0, 0, 0, false )
  776. end
  777. end
  778.  
  779. local function getClip()
  780. if IsValid(LocalPlayer():GetActiveWeapon()) then
  781. if LocalPlayer():GetActiveWeapon():Clip1() >= 0 then
  782. return LocalPlayer():GetActiveWeapon():Clip1() or ""
  783. end
  784. end
  785. return ""
  786. end
  787.  
  788.  
  789. local beepStartPosX = (ScrW() - ScrW() + 15)
  790. local beepEndPosX = (ekg_width-beepXsize)+10*ekg_size
  791. local beepCurPosX = (ScrW() - ScrW() + 15)
  792. local beepStartPosY = ScrH() - ekg_height/2.75
  793. //local beepStartPosY = ScrH() - ekg_height/2.75
  794. local beepEndPosY = ScrH() - ekg_height/1.75
  795. local beepCurPosY = ScrH() - ekg_height/2.75
  796. local testBeepX = 1
  797. local testBeepY = 1
  798.  
  799. //
  800. // BEEP POSITION
  801. //
  802.  
  803. local function beepPositionX()
  804. beepCurPosX = math.Approach( beepCurPosX, beepEndPosX, 0.155 * ( 100 / LocalPlayer():Health() ))
  805.  
  806. if beepCurPosX >= beepEndPosX then
  807. beepCurPosX = beepStartPosX
  808. end
  809. return beepCurPosX
  810. end
  811.  
  812. hook.Add( "HUDPaint", "ekg_hud", function()
  813. if !LocalPlayer():Alive() then return end
  814. LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}
  815. LocalPlayer().DarkRPVars.money = LocalPlayer().DarkRPVars.money or 0
  816. LocalPlayer().DarkRPVars.salary = LocalPlayer().DarkRPVars.salary or 0
  817. //if ekgEnergy then
  818. LocalPlayer().DarkRPVars.Energy = LocalPlayer().DarkRPVars.Energy or 0
  819. //return end
  820. // ekgSize()
  821.  
  822. //gui.MouseX()
  823. //draw.SimpleText( "X- " .. gui.MouseX(), "ekg_font", 25, 25, Color(57, 255, 66, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM )
  824. //draw.SimpleText( "Y- " .. gui.MouseY(), "ekg_font", 25, 45, Color(57, 255, 66, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM )
  825.  
  826.  
  827. //HUD GRAPHICS
  828. //
  829.  
  830. surface.SetDrawColor( 255, 255, 255, 255 )
  831. surface.SetMaterial( ekg_background )
  832. surface.DrawTexturedRect( ScrW() - ScrW() +10, ScrH() - ekg_height -10, ekg_width, ekg_height )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement