Advertisement
CREONIX

HUD LEAK | DARKRP| VISCAGAMING.COM

Jan 29th, 2017
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 30.40 KB | None | 0 0
  1. /*---------------------------------------------------------------------------
  2.  
  3. SmurfRP by j0rpi  
  4. File: hud.lua
  5. Purpose: Handles everything on the screen
  6. ---------------------------------------------------------------------------*
  7. /*--------------------------------------------------------------------------
  8. HUD ConVars
  9. ---------------------------------------------------------------------------*/
  10. local ConVars = {}
  11. local HUDWidth
  12. local HUDHeight
  13.  
  14. local Color = Color
  15. local cvars = cvars
  16. local draw = draw
  17. local GetConVar = GetConVar
  18. local Lerp = Lerp
  19. local localplayer
  20. local pairs = pairs
  21. local SortedPairs = SortedPairs
  22. local string = string
  23. local surface = surface
  24. local table = table
  25. local tostring = tostring
  26.  
  27. local version = ""
  28.  
  29. CreateClientConVar("weaponhud", 0, true, false)
  30.  
  31. local useIsAdminCheck = false -- Disable this if you want to use custom admin groups
  32. local adminGroups = {
  33.     ["superadmin"] = true,
  34.     ["senior-admin"] = true,
  35.     ["admin"] = true,
  36.     ["moderator"] = true,
  37. }
  38.  
  39. local function ReloadConVars()
  40.     ConVars = {
  41.         background = {0,0,0,100},
  42.         Healthbackground = {0,0,0,200},
  43.         Healthforeground = {140,0,0,180},
  44.         HealthText = {255,255,255,200},
  45.         Job1 = {0,0,150,200},
  46.         Job2 = {0,0,0,255},
  47.         salary1 = {0,150,0,200},
  48.         salary2 = {0,0,0,255}
  49.     }
  50.  
  51.     for name, Colour in pairs(ConVars) do
  52.         ConVars[name] = {}
  53.         for num, rgb in SortedPairs(Colour) do
  54.             local CVar = GetConVar(name..num) or CreateClientConVar(name..num, rgb, true, false)
  55.             table.insert(ConVars[name], CVar:GetInt())
  56.  
  57.             if not cvars.GetConVarCallbacks(name..num, false) then
  58.                 cvars.AddChangeCallback(name..num, function() timer.Simple(0,ReloadConVars) end)
  59.             end
  60.         end
  61.         ConVars[name] = Color(unpack(ConVars[name]))
  62.     end
  63.  
  64.  
  65.     HUDWidth = (GetConVar("HudW") or  CreateClientConVar("HudW", 240, true, false)):GetInt()
  66.     HUDHeight = (GetConVar("HudH") or CreateClientConVar("HudH", 115, true, false)):GetInt()
  67.  
  68.     if not cvars.GetConVarCallbacks("HudW", false) and not cvars.GetConVarCallbacks("HudH", false) then
  69.         cvars.AddChangeCallback("HudW", function() timer.Simple(0,ReloadConVars) end)
  70.         cvars.AddChangeCallback("HudH", function() timer.Simple(0,ReloadConVars) end)
  71.     end
  72. end
  73. ReloadConVars()
  74.  
  75.  
  76. local function formatNumber(n)
  77.     if not n then return "" end
  78.     if n >= 1e14 then return tostring(n) end
  79.     n = tostring(n)
  80.     local sep = sep or ","
  81.     local dp = string.find(n, "%.") or #n+1
  82.     for i=dp-4, 1, -3 do
  83.         n = n:sub(1, i) .. sep .. n:sub(i+1)
  84.     end
  85.     return n
  86. end
  87.  
  88.  
  89. local Scrw, Scrh, RelativeX, RelativeY
  90. /*---------------------------------------------------------------------------
  91. HUD Seperate Elements
  92. ---------------------------------------------------------------------------*/
  93. local tblFonts = { }
  94. tblFonts["DebugFixed"] = {
  95.     font = "Courier New",
  96.     size = 10,
  97.     weight = 500,
  98.     antialias = true,
  99. }
  100.  
  101. tblFonts["DebugFixedSmall"] = {
  102.     font = "Courier New",
  103.     size = 7,
  104.     weight = 500,
  105.     antialias = true,
  106. }
  107.  
  108. tblFonts["DefaultFixedOutline"] = {
  109.     font = "Lucida Console",
  110.     size = 10,
  111.     weight = 0,
  112.     outline = true,
  113. }
  114.  
  115. tblFonts["MenuItem"] = {
  116.     font = "Tahoma",
  117.     size = 12,
  118.     weight = 500,
  119. }
  120.  
  121. tblFonts["Default"] = {
  122.     font = "Tahoma",
  123.     size = 13,
  124.     weight = 500,
  125. }
  126.  
  127. tblFonts["TabLarge"] = {
  128.     font = "Tahoma",
  129.     size = 13,
  130.     weight = 700,
  131.     shadow = true,
  132. }
  133.  
  134. tblFonts["DefaultBold"] = {
  135.     font = "Tahoma",
  136.     size = 13,
  137.     weight = 1000,
  138. }
  139.  
  140. tblFonts["DefaultUnderline"] = {
  141.     font = "Tahoma",
  142.     size = 13,
  143.     weight = 500,
  144.     underline = true,
  145. }
  146.  
  147. tblFonts["DefaultSmall"] = {
  148.     font = "Tahoma",
  149.     size = 1,
  150.     weight = 0,
  151. }
  152.  
  153. tblFonts["DefaultSmallDropShadow"] = {
  154.     font = "Tahoma",
  155.     size = 11,
  156.     weight = 0,
  157.     shadow = true,
  158. }
  159.  
  160. tblFonts["DefaultVerySmall"] = {
  161.     font = "Tahoma",
  162.     size = 12,
  163.     weight = 600,
  164.     outline = true,
  165. }
  166.  
  167. tblFonts["DefaultLarge"] = {
  168.     font = "Tahoma",
  169.     size = 16,
  170.     weight = 0,
  171. }
  172.  
  173. tblFonts["UiBold"] = {
  174.     font = "Tahoma",
  175.     size = 12,
  176.     weight = 1000,
  177. }
  178.  
  179. tblFonts["MenuLarge"] = {
  180.     font = "Verdana",
  181.     size = 15,
  182.     weight = 600,
  183.     antialias = true,
  184. }
  185.  
  186. tblFonts["ConsoleText"] = {
  187.     font = "Lucida Console",
  188.     size = 10,
  189.     weight = 500,
  190. }
  191.  
  192. tblFonts["Marlett"] = {
  193.     font = "Marlett",
  194.     size = 13,
  195.     weight = 0,
  196.     symbol = true,
  197. }
  198.  
  199. tblFonts["Trebuchet24"] = {
  200.     font = "Trebuchet MS",
  201.     size = 24,
  202.     weight = 900,
  203. }
  204.  
  205. tblFonts["Trebuchet22"] = {
  206.     font = "Trebuchet MS",
  207.     size = 22,
  208.     weight = 900,
  209. }
  210.  
  211. tblFonts["Trebuchet20"] = {
  212.     font = "Trebuchet MS",
  213.     size = 20,
  214.     weight = 900,
  215. }
  216.  
  217. tblFonts["Trebuchet19"] = {
  218.     font = "Trebuchet MS",
  219.     size = 19,
  220.     weight = 900,
  221. }
  222.  
  223. tblFonts["Trebuchet18"] = {
  224.     font = "Trebuchet MS",
  225.     size = 18,
  226.     weight = 900,
  227. }
  228.  
  229. tblFonts["HUDNumber"] = {
  230.     font = "Trebuchet MS",
  231.     size = 40,
  232.     weight = 900,
  233. }
  234.  
  235. tblFonts["HUDNumber1"] = {
  236.     font = "Trebuchet MS",
  237.     size = 41,
  238.     weight = 900,
  239. }
  240.  
  241. tblFonts["HUDNumber2"] = {
  242.     font = "Trebuchet MS",
  243.     size = 42,
  244.     weight = 900,
  245. }
  246.  
  247. tblFonts["HUDNumber3"] = {
  248.     font = "Trebuchet MS",
  249.     size = 43,
  250.     weight = 900,
  251. }
  252.  
  253. tblFonts["HUDNumber4"] = {
  254.     font = "Trebuchet MS",
  255.     size = 44,
  256.     weight = 900,
  257. }
  258.  
  259. tblFonts["HUDNumber5"] = {
  260.     font = "Trebuchet MS",
  261.     size = 45,
  262.     weight = 900,
  263. }
  264.  
  265. tblFonts["HudHintTextLarge"] = {
  266.     font = "Verdana",
  267.     size = 14,
  268.     weight = 1000,
  269.     antialias = true,
  270.     additive = true,
  271. }
  272.  
  273. tblFonts["HudHintTextSmall"] = {
  274.     font = "Verdana",
  275.     size = 11,
  276.     weight = 0,
  277.     antialias = true,
  278.     additive = true,
  279. }
  280.  
  281. tblFonts["CenterPrintText"] = {
  282.     font = "Trebuchet MS",
  283.     size = 18,
  284.     weight = 900,
  285.     antialias = true,
  286.     additive = true,
  287. }
  288.  
  289. tblFonts["DefaultFixed"] = {
  290.     font = "Lucida Console",
  291.     size = 10,
  292.     weight = 0,
  293. }
  294.  
  295. tblFonts["DefaultFixedDropShadow"] = {
  296.     font = "Lucida Console",
  297.     size = 10,
  298.     weight = 0,
  299.     shadow = true,
  300. }
  301.  
  302. tblFonts["CloseCaption_Normal"] = {
  303.     font = "Tahoma",
  304.     size = 16,
  305.     weight = 500,
  306. }
  307.  
  308. tblFonts["CloseCaption_Italic"] = {
  309.     font = "Tahoma",
  310.     size = 16,
  311.     weight = 500,
  312.     italic = true,
  313. }
  314.  
  315. tblFonts["CloseCaption_Bold"] = {
  316.     font = "Tahoma",
  317.     size = 16,
  318.     weight = 900,
  319. }
  320.  
  321. tblFonts["CloseCaption_BoldItalic"] = {
  322.     font = "Tahoma",
  323.     size = 16,
  324.     weight = 900,
  325.     italic = true,
  326. }
  327.  
  328. tblFonts["TargetID"] = {
  329.     font = "Trebuchet MS",
  330.     size = 22,
  331.     weight = 900,
  332.     antialias = true,
  333. }
  334.  
  335. tblFonts["TargetIDSmall"] = {
  336.     font = "Trebuchet MS",
  337.     size = 18,
  338.     weight = 900,
  339.     antialias = true,
  340. }
  341.  
  342. tblFonts["BudgetLabel"] = {
  343.     font = "Courier New",
  344.     size = 14,
  345.     weight = 400,
  346.     outline = true,
  347. }
  348.  
  349. tblFonts["j0rpi"] = {
  350.     font = "Tahoma",
  351.     size = 23,
  352.     weight = 200,
  353.     antialias = false,
  354.     shadow = false,
  355.     outline = true,
  356. }
  357.  
  358. tblFonts["j0rpi2"] = {
  359.     font = "Tahoma",
  360.     size = 14,
  361.     weight = 200,
  362.     antialias = false,
  363.     shadow = false,
  364.     outline = true,
  365. }
  366.  
  367. tblFonts["j0rpi3"] = {
  368.     font = "Tahoma",
  369.     size = 14,
  370.     weight = 900,
  371.     antialias = true,
  372.     shadow = false,
  373.     outline = false,
  374. }
  375.  
  376. tblFonts["j0rpi4"] = {
  377.     font = "Tahoma",
  378.     size = 18,
  379.     weight = 600,
  380.     antialias = false,
  381.     shadow = false,
  382.     outline = true,
  383. }
  384.  
  385. tblFonts["j0rpi5"] = {
  386.     font = "Tahoma",
  387.     size = 12,
  388.     weight = 600,
  389.     antialias = true,
  390.     shadow = false,
  391.     outline = true,
  392. }
  393.  
  394.  
  395.  
  396. tblFonts["j0rpi6"] = {
  397.     font = "Tahoma",
  398.     size = 16,
  399.     weight = 600,
  400.     antialias = false,
  401.     shadow = false,
  402.     outline = true,
  403. }
  404.  
  405. tblFonts["j0rpi7"] = {
  406.     font = "Tahoma",
  407.     size = 16,
  408.     weight = 600,
  409.     antialias = false,
  410.     shadow = false,
  411.     outline = false,
  412. }
  413.  
  414. tblFonts["j0rpi8"] = {
  415.     font = "Verdana",
  416.     size = 12,
  417.     weight = 100,
  418.     antialias = false,
  419.     shadow = false,
  420.     outline = true,
  421. }
  422.  
  423. tblFonts["j0rpiAA"] = {
  424.     font = "Segoe UI Light",
  425.     size = 19,
  426.     weight = 100,
  427.     antialias = true,
  428.     shadow = false,
  429.     outline = false,
  430. }
  431.  
  432. tblFonts["j0rpiAA2"] = {
  433.     font = "Segoe UI Light",
  434.     size = 18,
  435.     weight = 100,
  436.     antialias = true,
  437.     shadow = false,
  438.     outline = false,
  439. }
  440.  
  441. tblFonts["j0rpiAA3"] = {
  442.     font = "Segoe UI Light",
  443.     size = 24,
  444.     weight = 200,
  445.     antialias = true,
  446.     shadow = true,
  447.     outline = false,
  448. }
  449.  
  450.  
  451. for k,v in SortedPairs( tblFonts ) do
  452.     surface.CreateFont( k, tblFonts[k] );
  453.  
  454.     --print( "Added font '"..k.."'" );
  455. end
  456. --local function DrawInfo()
  457. --  local wep = localplayer:GetActiveWeapon()
  458.  
  459. --  if IsValid(wep) and GAMEMODE.Config.weaponhud then
  460. --        local name = wep:GetPrintName();
  461. --      draw.DrawText("Weapon: "..name, "UiBold", RelativeX + 5, RelativeY - HUDHeight - 18, Color(255, 255, 255, 255), 0)
  462. --  end
  463. ----end
  464.  
  465. local Page = Material("icon16/application_view_list.png")
  466. local function GunLicense()
  467.     if localplayer:getDarkRPVar("HasGunlicense") then
  468.         surface.SetMaterial(Page)
  469.         surface.SetDrawColor(255, 255, 255, 255)
  470.         surface.DrawTexturedRect(505, ScrH() - 60, 25, 25)
  471.     end
  472. end
  473.  
  474. local WantedIcon = Material( "icon16/exclamation.png" )
  475. local function DrawWantedIcon()
  476.     if LocalPlayer():getDarkRPVar("wanted") then
  477.         surface["SetMaterial"]( WantedIcon )
  478.         surface["SetDrawColor"]( 255, 255, 255, 255 )
  479.         surface["DrawTexturedRect"]( 505, ScrH() - 92, 23, 23 )
  480.     end
  481. end
  482.  
  483.  
  484.  
  485. /*---------------------------------------------------------------------------
  486. Drawing the HUD elements such as Health etc.
  487. ---------------------------------------------------------------------------*/
  488. local playersIcon = Material("icon16/group.png")
  489. local adminsIcon = Material("icon16/shield.png")
  490.  
  491. local name = Material("icon16/user_suit.png")
  492. local job = Material("icon16/wrench.png")
  493. local salarr = Material("icon16/money_add.png")
  494. local banii = Material("icon16/money_dollar.png")
  495. local played = Material("icon16/time.png")
  496. local gradient = Material("materials/darkrp/j0rpihpgradient6.png")
  497. local hpgradient = Material("materials/darkrp/j0rpihpgradient2.png")
  498. local star = Material("icon16/star.png")
  499. local heart = Material("icon16/heart.png")
  500. local heart_add = Material("icon16/heart_add.png")
  501. local shield = Material("icon16/shield.png")
  502. local contributor = Material("icon16/add.png")
  503. local heart = Material("icon16/heart.png")
  504. local donator = Material("icon16/asterisk_orange.png")
  505. local smiley = Material("icon16/emoticon_smile.png")
  506. local developer = Material("icon16/wrench.png")
  507. local owner = Material("icon16/rosette.png")
  508. local princess = Material("icon16/user_female.png")
  509. local vip = Material("icon16/accept.png")
  510. local mod = Material("icon16/emoticon_grin.png")
  511. local OwnerIcon = Material("icon16/shield.png")
  512. local SuperAdminIcon = Material("icon16/shield.png")
  513. local AdminIcon = Material("icon16/award_star_gold_1.png")
  514. local ModIcon = Material("icon16/emoticon_grin.png")
  515. local DevIcon = Material("icon16/wrench.png")
  516. local TrialModIcon = Material("icon16/emoticon_smile.png")
  517. local DonatorIcon = Material("icon16/heart.png")
  518. local RespectedIcon = Material("icon16/heart_add.png")
  519. local UserIcon = Material("icon16/user.png")
  520. local ErrorIcon = Material("icon16/error.png")
  521.  
  522. local function timeToStr( time )
  523.     local tmp = time
  524.     local s = tmp % 60
  525.     tmp = math.floor( tmp / 60 )
  526.     local m = tmp % 60
  527.     tmp = math.floor( tmp / 60 )
  528.     local h = tmp % 24
  529.     tmp = math.floor( tmp / 24 )
  530.     local d = tmp % 7
  531.     local w = math.floor( tmp / 7 )
  532.  
  533.     return string.format( "%02i:%02i:%02i", h, m, s )
  534. end
  535.  
  536. local health   = 0
  537. local armour = 0
  538. surface.CreateFont("RankFont",{font = "akbar", size = 30, weight = 400, antialias = 0})
  539. local function DrawHUD()
  540.     localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
  541.     if not IsValid(localplayer) then return end
  542.  
  543.     Scrw, Scrh = ScrW(), ScrH()
  544.     RelativeX, RelativeY = 0, Scrh
  545.  
  546.     local Salary =  "Salary: " .. GAMEMODE.Config.currency .. (localplayer:getDarkRPVar("salary") or 0)
  547.     local Job = localplayer:getDarkRPVar("job") or ""
  548.     local Wallet = "Wallet: " .. GAMEMODE.Config.currency .. (formatNumber(localplayer:getDarkRPVar("money") or 0) or 0)
  549.    
  550.     local lowammo = Color(120,0,0,200)
  551.     if LocalPlayer():Alive() && LocalPlayer():GetActiveWeapon():IsValid() then
  552.     if LocalPlayer():GetActiveWeapon():Clip1() < 0 then
  553.    
  554.     elseif LocalPlayer():GetActiveWeapon():GetClass() == "weapon_physcannon" or LocalPlayer():GetActiveWeapon():GetClass() == "weapon_physgun" then
  555.    
  556.     else
  557.    
  558.     if LocalPlayer():GetActiveWeapon():Clip1() < 6 then
  559.         draw.SimpleText("Press R To Reload!", "j0rpi3", ScrW() - 170, ScrH() - 70, Color(0,0,0,255))
  560.         draw.SimpleText("Press R To Reload!", "j0rpi3", ScrW() - 171, ScrH() - 71, Color(255,0,0,255))
  561.         draw.RoundedBox(0, ScrW() - 200, ScrH() - 50, 180, 45, lowammo)
  562.         surface.SetDrawColor(255,255,255,150)
  563.         surface.DrawOutlinedRect( ScrW() - 200, ScrH() - 50, 180, 45 )
  564.     else
  565.         lowammo = Color(0,0,0,200)
  566.         draw.RoundedBox(0, ScrW() - 200, ScrH() - 50, 180, 45, lowammo)
  567.         surface.SetDrawColor(255,255,255,150)
  568.         surface.DrawOutlinedRect( ScrW() - 200, ScrH() - 50, 180, 45 )
  569.     end
  570.     end
  571.    
  572.    
  573.     -- Magazine Size
  574.     if LocalPlayer():GetActiveWeapon():Clip1() < 0  then
  575.     -- Do nada.
  576.     elseif LocalPlayer():GetActiveWeapon():GetClass() == "weapon_physcannon" or LocalPlayer():GetActiveWeapon():GetClass() == "weapon_physgun" then
  577.     -- Do nada.
  578.     else
  579.     draw.SimpleText(LocalPlayer():GetActiveWeapon():Clip1(), "j0rpi", ScrW() - 145, ScrH() - 28, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  580.     -- Ammo Seperator
  581.     draw.SimpleText("|", "j0rpi", ScrW() - 111, ScrH() - 28, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  582.    
  583.     -- Total Ammo
  584.     draw.SimpleText(LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetPrimaryAmmoType()) or "0", "j0rpi", ScrW() - 74, ScrH() - 28, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  585.     end
  586.    
  587.     end
  588.    
  589.    
  590.     draw.RoundedBox(0, 0 + 10, ScrH() - 94 + 1 - 27 - 8, 240, 25, team.GetColor(LocalPlayer():Team()))
  591.     draw.RoundedBox(0, 0 + 10, ScrH() - 94 + 1 - 27 - 8, 240, 10, Color(255,255,255,20))
  592.     surface.SetDrawColor(0,0,0,255)
  593.     surface.DrawOutlinedRect( 0 + 10, ScrH() - 94 + 1 - 27 - 8, 240, 25 )
  594.     surface.SetMaterial(job)
  595.     surface.SetDrawColor(255, 255, 255, 255)
  596.     surface.DrawTexturedRect(0 + 15, ScrH() - 89 + 1 - 27 - 8, 16, 16)
  597.     draw.SimpleText(Job, "j0rpiAA2", 0 + 135, ScrH() - 81 + 1 - 27 - 8, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  598.    
  599.     -- session
  600.     draw.RoundedBox(0, 0 + 260, ScrH() - 94 + 1 - 27 - 8, 240, 25, Color(0,0,0,200))
  601.     draw.RoundedBox(0, 0 + 260, ScrH() - 94 + 1 - 27 - 8, 240, 10, Color(255,255,255,10))
  602.     surface.SetDrawColor(0,0,0,255)
  603.     surface.DrawOutlinedRect( 0 + 260, ScrH() - 94 + 1 - 27 - 8, 240, 25 )
  604.     surface.SetMaterial(played)
  605.     surface.SetDrawColor(255, 255, 255, 255)
  606.     surface.DrawTexturedRect(0 + 265, ScrH() - 89 + 1 - 27 - 8, 16, 16)
  607.     draw.SimpleText("Session: " .. timeToStr(CurTime()),"j0rpiAA2", 0 + 385, ScrH() - 81 + 1 - 27 - 8, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  608.  
  609.     -- Wallet
  610.     draw.RoundedBox(0, 0 + 260, ScrH() - 63 + 1 - 27 - 8, 240, 25, Color(0,0,0,200))
  611.     draw.RoundedBox(0, 0 + 260, ScrH() - 63 + 1 - 27 - 8, 240, 10, Color(255,255,255,10))
  612.     surface.SetDrawColor(0,0,0,255)
  613.     surface.DrawOutlinedRect( 0 + 260, ScrH() - 63 + 1 - 27 - 8, 240, 25 )
  614.     surface.SetMaterial(banii)
  615.     surface.SetDrawColor(255, 255, 255, 255)
  616.     surface.DrawTexturedRect(0 + 265, ScrH() - 59 + 1 - 27 - 8, 16, 16)
  617.     draw.SimpleText(Wallet, "j0rpiAA2", 0 + 382,ScrH() - 50 + 1 - 27 - 8, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  618.  
  619.     -- Salary
  620.     draw.RoundedBox(0, 0 + 10, ScrH() - 63 + 1 - 27 - 8, 240, 25, Color(0,0,0,200))
  621.     draw.RoundedBox(0, 0 + 10, ScrH() - 63 + 1 - 27 - 8, 240, 10, Color(255,255,255,10))
  622.     surface.SetDrawColor(0,0,0,255)
  623.     surface.DrawOutlinedRect( 0 + 10, ScrH() - 63 + 1 - 27 - 8, 240, 25 )
  624.     surface.SetMaterial(salarr)
  625.     surface.SetDrawColor(255, 255, 255, 255)
  626.     surface.DrawTexturedRect(0 + 15, ScrH() - 59 + 1 - 27 - 8, 16, 16)
  627.     draw.SimpleText(Salary, "j0rpiAA2", 0 + 135,ScrH() - 50 + 1 - 27 - 8, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  628.  
  629.    
  630.     --Health = math.min(100, (Health == localplayer:Health() and Health) or Lerp(0.1, Health, localplayer:Health()))
  631.     local drawWidth = 490
  632.     health = Lerp( FrameTime()*2, health,(LocalPlayer():Health()/LocalPlayer():GetMaxHealth())* drawWidth )
  633.  
  634.     draw.RoundedBox(0, 0 + 10, ScrH() - 32 - 3 - 31, 490, 25, Color(0,0,0,200))
  635.    
  636.     if health != 0 then
  637.         surface.SetDrawColor(Color(200, 0, 0, 255))
  638.         surface.DrawRect(0 + 10, ScrH() - 32 - 3 - 31,  math.Clamp(health,0,drawWidth), 25)
  639.     end
  640.  
  641.     surface.SetDrawColor(Color(255, 255, 255, 10))
  642.     surface.DrawRect(0 + 10, ScrH() - 32 - 3 - 31, 490, 10)
  643.  
  644.     surface.SetDrawColor(0,0,0,255)
  645.     surface.DrawOutlinedRect( 0 + 10, ScrH() - 32 - 3 - 31, 490, 25 )
  646.     surface.SetMaterial(heart)
  647.     surface.SetDrawColor(255,255,255,255)
  648.     surface.DrawTexturedRect(0 + 15, RelativeY - 28 - 3 - 31, 16, 16)
  649.  
  650.     draw.SimpleText("HP: " .. math.Max(0, math.Round(LocalPlayer():Health())).."%","j0rpiAA2", 0 + 255, RelativeY - 19 - 3 - 31, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  651.    
  652.  
  653.    
  654.    
  655.     --Armor = math.min(100, (Armor == localplayer:Armor() and Armor) or Lerp(0.1, Armor, localplayer:Armor()))
  656.     --local drawWidth = 490
  657.     armour = Lerp( FrameTime()*2, armour,(LocalPlayer():Armor()/100)* drawWidth )
  658.  
  659.     --Armor = localplayer:Armor()
  660.     --local DrawArmor = math.Min(Armor / 100, 1)
  661.  
  662.     draw.RoundedBox(0, 0 + 10, ScrH() - 32 - 3, 490, 25, Color(0,0,0,200))
  663.     if armour != 0 then
  664.         surface.SetDrawColor(Color(0, 0, 255, 255))
  665.         surface.DrawRect(0 + 10, ScrH() - 32 - 3, math.Clamp(armour,0, drawWidth), 25)
  666.     end
  667.  
  668.     surface.SetDrawColor(Color(255, 255, 255, 10))
  669.     surface.DrawRect(0 + 10, ScrH() - 32 - 3, 490, 10)
  670.    
  671.     surface.SetDrawColor(0,0,0,255)
  672.     surface.DrawOutlinedRect( 0 + 10, ScrH() - 32 - 3, 490, 25 )
  673.     surface.SetMaterial(shield)
  674.     surface.SetDrawColor(255,255,255,255)
  675.     surface.DrawTexturedRect(0 + 15, RelativeY - 28 - 3, 16, 16)
  676.    
  677.     draw.SimpleText("AP: " .. math.Max(0, math.Round(LocalPlayer():Armor())).."%","j0rpiAA2", 0 + 255, RelativeY - 19 - 3, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  678.  
  679.     -- Players
  680.     local players = player.GetAll()
  681.     local playerCount = #player.GetAll()
  682.     surface.SetDrawColor(Color(0,0,0,200))
  683.     surface.DrawRect(500 + 11, ScrH() - 35 - 31, 120, 25, Color(0,0,0,200))
  684.  
  685.     surface.SetDrawColor(Color(255,255,255,10))
  686.     surface.DrawRect(500 + 11, ScrH() - 35 - 31, 120, 10, Color(255,255,255,10))
  687.  
  688.     surface.SetDrawColor(0,0,0,255)
  689.     surface.DrawOutlinedRect(500 + 11, ScrH() - 35 - 31, 120, 25)
  690.     surface.SetMaterial(playersIcon)
  691.     surface.SetDrawColor(255, 255, 255, 255)
  692.     surface.DrawTexturedRect(505 + 11, ScrH() - 31 - 31, 16, 16)
  693.     draw.SimpleText("Players: " .. playerCount, "j0rpiAA2", 570, ScrH() - 22 - 31, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  694.  
  695.     -- Admins
  696.     local adminCount = 0
  697.     for i, ply in ipairs(players) do
  698.         if not IsValid(ply) then continue end
  699.         if useIsAdminCheck then
  700.             if not ply:IsAdmin() then continue end
  701.         else
  702.             if not adminGroups[ply:GetUserGroup()] then continue end
  703.         end
  704.  
  705.         adminCount = adminCount + 1
  706.     end
  707.     surface.SetDrawColor(Color(0,0,0,200))
  708.     surface.DrawRect(500 + 11, ScrH() - 35, 120, 25)
  709.  
  710.     surface.SetDrawColor(Color(255,255,255,10))
  711.     surface.DrawRect(500 + 11, ScrH() - 35, 120, 10)
  712.  
  713.     surface.SetDrawColor(0,0,0,255)
  714.     surface.DrawOutlinedRect(500 + 11, ScrH() - 35, 120, 25)
  715.     surface.SetMaterial(adminsIcon)
  716.     surface.SetDrawColor(255, 255, 255, 255)
  717.     surface.DrawTexturedRect(505 + 11, ScrH() - 31, 16, 16)
  718.     draw.SimpleText("Admins: " .. adminCount, "j0rpiAA2", 570, ScrH() - 22, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  719.  
  720. end
  721. local colors = {}
  722. colors.black = Color(0, 0, 0, 255)
  723. colors.blue = Color(0, 0, 255, 255)
  724. colors.brightred = Color(200, 30, 30, 255)
  725. colors.darkred = Color(0, 0, 70, 100)
  726. colors.darkblack = Color(0, 0, 0, 200)
  727. colors.gray1 = Color(0, 0, 0, 155)
  728. colors.gray2 = Color(51, 58, 51,100)
  729. colors.red = Color(255, 0, 0, 255)
  730. colors.white = Color(255, 255, 255, 255)
  731. colors.white1 = Color(255, 255, 255, 200)  
  732. /*---------------------------------------------------------------------------
  733. Entity HUDPaint things
  734. ----------------------------------------------------------------------------*/
  735. function DrawPlayerInfo(ply)
  736.  
  737.     local pos = ply:EyePos()
  738.  
  739.     pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
  740.     pos = pos:ToScreen()
  741.     if not ply:getDarkRPVar("wanted") then
  742.         -- Move the text up a few pixels to compensate for the height of the text
  743.         pos.y = pos.y - 50
  744.     end
  745.  
  746.     if GAMEMODE.Config.showname then
  747.         local nick, plyTeam = ply:Nick(), ply:Team()
  748.         draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  749.         draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
  750.     end
  751.  
  752.     if GAMEMODE.Config.showhealth then
  753.         local health = DarkRP.getPhrase("health", ply:Health())
  754.         draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
  755.         draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
  756.     end
  757.  
  758.     if GAMEMODE.Config.showjob then
  759.         local teamname = ply:getDarkRPVar("job") or team.GetName(ply:Team())
  760.         draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
  761.         draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 1)
  762.     end
  763.  
  764.     if self:getDarkRPVar("HasGunlicense") then
  765.         surface.SetMaterial(Page)
  766.         surface.SetDrawColor(255,255,255,255)
  767.         surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
  768.     end
  769. end
  770.  
  771. -- Draw wanted information above a player's head
  772. -- This syntax allows for easy overriding
  773. local plyMeta = FindMetaTable("Player")
  774. plyMeta.drawPlayerInfo = plyMeta.drawPlayerInfo or function(self)
  775.     local pos = self:EyePos()
  776.  
  777.     pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
  778.     pos = pos:ToScreen()
  779.     if not self:getDarkRPVar("wanted") then
  780.         -- Move the text up a few pixels to compensate for the height of the text
  781.         pos.y = pos.y - 50
  782.     end
  783.  
  784.     if GAMEMODE.Config.showname then
  785.         local nick, plyTeam = self:Nick(), self:Team()
  786.         draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  787.         draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
  788.     end
  789.  
  790.     if GAMEMODE.Config.showhealth then
  791.         local health = DarkRP.getPhrase("health", self:Health())
  792.         draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
  793.         draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
  794.     end
  795.  
  796.     if GAMEMODE.Config.showjob then
  797.         local teamname = self:getDarkRPVar("job") or team.GetName(self:Team())
  798.         draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
  799.         draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 1)
  800.     end
  801.  
  802.     if self:getDarkRPVar("HasGunlicense") then
  803.         surface.SetMaterial(Page)
  804.         surface.SetDrawColor(255,255,255,255)
  805.         surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
  806.     end
  807. end
  808.  
  809. -- Draw wanted information above a player's head
  810. -- This syntax allows for easy overriding
  811. plyMeta.drawWantedInfo = plyMeta.drawWantedInfo or function(self)
  812.     if not self:Alive() then return end
  813.  
  814.     local pos = self:EyePos()
  815.     if not pos:isInSight({localplayer, self}) then return end
  816.  
  817.     pos.z = pos.z + 10
  818.     pos = pos:ToScreen()
  819.  
  820.     if GAMEMODE.Config.showname then
  821.         local nick, plyTeam = self:Nick(), self:Team()
  822.         draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  823.         draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
  824.     end
  825.  
  826.     local wantedText = DarkRP.getPhrase("wanted", tostring(self:getDarkRPVar("wantedReason")))
  827.  
  828.     draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x, pos.y - 40, colors.white1, 1)
  829.     draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x + 1, pos.y - 41, colors.red, 1)
  830. end
  831.  
  832. /*---------------------------------------------------------------------------
  833. The Entity display: draw HUD information about entities
  834. ---------------------------------------------------------------------------*/
  835. local function DrawEntityDisplay()
  836.     local shouldDraw, players = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_EntityDisplay")
  837.     if shouldDraw == false then return end
  838.  
  839.     local shootPos = localplayer:GetShootPos()
  840.     local aimVec = localplayer:GetAimVector()
  841.  
  842.     for k, ply in pairs(players or player.GetAll()) do
  843.         if ply == localplayer or not ply:Alive() or ply:GetNoDraw() then continue end
  844.         local hisPos = ply:GetShootPos()
  845.         if ply:getDarkRPVar("wanted") then ply:drawWantedInfo() end
  846.  
  847.         if GAMEMODE.Config.globalshow then
  848.             ply:drawPlayerInfo()
  849.         -- Draw when you're (almost) looking at him
  850.         elseif hisPos:DistToSqr(shootPos) < 160000 then
  851.             local pos = hisPos - shootPos
  852.             local unitPos = pos:GetNormalized()
  853.             if unitPos:Dot(aimVec) > 0.95 then
  854.                 local trace = util.QuickTrace(shootPos, pos, localplayer)
  855.                 if trace.Hit and trace.Entity ~= ply then break end
  856.                 ply:drawPlayerInfo()
  857.             end
  858.         end
  859.     end
  860.  
  861.     local tr = localplayer:GetEyeTrace()
  862.  
  863.     if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():DistToSqr(localplayer:GetPos()) < 40000 then
  864.         tr.Entity:drawOwnableInfo()
  865.     end
  866. end
  867.  
  868. local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl")
  869. local function DrawVoiceChat()
  870.     if localplayer.DRPIsTalking then
  871.         local chbxX, chboxY = chat.GetChatBoxPos()
  872.  
  873.         local Rotating = math.sin(CurTime()*3)
  874.         local backwards = 0
  875.         if Rotating < 0 then
  876.             Rotating = 1-(1+Rotating)
  877.             backwards = 180
  878.         end
  879.         surface.SetTexture(VoiceChatTexture)
  880.         surface.SetDrawColor(ConVars.Healthforeground)
  881.         surface.DrawTexturedRectRotated(ScrW() - 100, chboxY, Rotating*96, 96, backwards)
  882.     end
  883. end
  884.  
  885. local function LockDown()
  886.     local chbxX, chboxY = chat.GetChatBoxPos()
  887.     if util.tobool(GetConVarNumber("DarkRP_LockDown")) then
  888.         local cin = (math.sin(CurTime()) + 1) / 2
  889.         local chatBoxSize = math.floor(ScrH() / 4)
  890.         draw.DrawText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
  891.     end
  892. end
  893.  
  894. local Arrested = function() end
  895.  
  896. usermessage.Hook("GotArrested", function(msg)
  897.     local StartArrested = CurTime()
  898.     local ArrestedUntil = msg:ReadFloat()
  899.  
  900.     Arrested = function()
  901.         if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then
  902.         draw.DrawText(DarkRP.getPhrase("youre_arrested", math.ceil(ArrestedUntil - (CurTime() - StartArrested))), "DarkRPHUD1", ScrW()/2, ScrH() - ScrH()/12, Color(255,255,255,255), 1)
  903.         elseif not localplayer:getDarkRPVar("Arrested") then
  904.             Arrested = function() end
  905.         end
  906.     end
  907. end)
  908.  
  909. local AdminTell = function() end
  910.  
  911. usermessage.Hook("AdminTell", function(msg)
  912.     local Message = msg:ReadString()
  913.  
  914.     AdminTell = function()
  915.         draw.RoundedBox(4, 10, 10, ScrW() - 20, 100, Color(0, 0, 0, 200))
  916.         draw.DrawText(DarkRP.getPhrase("listen_up"), "GModToolName", ScrW() / 2 + 10, 10, Color(255, 255, 255, 255), 1)
  917.         draw.DrawText(Message, "ChatFont", ScrW() / 2 + 10, 80, Color(200, 30, 30, 255), 1)
  918.     end
  919.  
  920.     timer.Simple(10, function()
  921.         AdminTell = function() end
  922.     end)
  923. end)
  924. /*---------------------------------------------------------------------------
  925. Actual HUDPaint hook
  926. ---------------------------------------------------------------------------*/
  927. function DisableDrawInfo()
  928.     return false
  929. end
  930. hook.Add("HUDDrawTargetID", "DisableDrawInfo", DisableDrawInfo)
  931.  
  932. function paintHUD()
  933.    
  934.     --DrawZombieInfo()
  935.    
  936.     --self.BaseClass:HUDPaint()
  937.     --DrawWantedIcon()
  938.    
  939.     --DrawInfo()
  940.     DrawHUD()
  941.     --GunLicense()
  942.     DrawEntityDisplay()
  943.     --Agenda()
  944.     DrawVoiceChat()
  945.     LockDown()
  946.  
  947.     Arrested()
  948.     AdminTell()
  949. end
  950. hook.Add( "HUDPaint", "paintHUD", paintHUD )
  951.  
  952. local function DisplayNotify(msg)
  953.     local txt = msg:ReadString()
  954.     GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
  955.     surface.PlaySound("buttons/lightswitch2.wav")
  956.  
  957.     MsgC(Color(255, 20, 20, 255), "[ViscaGaming] ", Color(200, 200, 200, 255), txt, "\n")
  958. end
  959. usermessage.Hook("_Notify", DisplayNotify)
  960.  
  961. local hideHUDElements = {
  962.     ["DarkRP_HUD"]                  = true,
  963.     ["DarkRP_EntityDisplay"]        = false,
  964.     ["DarkRP_ZombieInfo"]           = true,
  965.     ["DarkRP_LocalPlayerHUD"]       = true,
  966.     ["DarkRP_Hungermod"]            = true,
  967.     ["DarkRP_Agenda"]               = true,
  968. }
  969.  
  970. /*-- Hide HUD Elements --*/
  971. local function hideElements(name)
  972.  
  973.     if name == "CHudHealth" or name == "CHudBattery" or name == "CHudSuitPower" or name == "CHudAmmo" or name == "CHudSecondaryAmmo" then
  974.         return false
  975.     end
  976.    
  977.     if hideHUDElements[name] then
  978.         return false
  979.     end
  980.    
  981. end
  982. hook.Add("HUDShouldDraw", "hideElements", hideElements)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement