Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. local hudEnabled = false --Default setting for whether the HUD is on or not
  2.  
  3. local function hideViralHUD() --When this function is called, stop drawing the custom HUD
  4. hook.Remove("HUDPaint", "DrawMyHud")
  5. hook.Add("HUDShouldDraw","HUDShouldDraw",function( name )
  6. return true
  7. end)
  8. end
  9.  
  10. local function toggleHUD() --Toggle the HUD on and off with this function
  11. if hudEnabled == false then
  12. print("Viral's HUD has been enabled")
  13. hudEnabled = true
  14. elseif hudEnabled == true then
  15. print("Viral's HUD has been disabled")
  16. hudEnabled = false
  17. end
  18. end
  19.  
  20. concommand.Add("viral_hud_toggle", toggleHUD) --Add a console command which calls the toggleHUD function written above
  21.  
  22. // you cheeky cunt you why are you in here YOU VIOLATING ME
  23. surface.CreateFont( "HUDFont", {
  24. font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  25. extended = false,
  26. size = 50,
  27. weight = 500,
  28. blursize = 0,
  29. scanlines = 0,
  30. antialias = true,
  31. underline = false,
  32. italic = false,
  33. strikeout = false,
  34. symbol = false,
  35. rotary = false,
  36. shadow = false,
  37. additive = true,
  38. outline = false,
  39. } )
  40. surface.CreateFont( "SmallHUDFont", {
  41. font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  42. extended = false,
  43. size = 30,
  44. weight = 500,
  45. blursize = 0,
  46. scanlines = 0,
  47. antialias = true,
  48. underline = false,
  49. italic = false,
  50. strikeout = false,
  51. symbol = false,
  52. rotary = false,
  53. shadow = false,
  54. additive = true,
  55. outline = false,
  56. } )
  57. local hide = {
  58. CHudHealth = true,
  59. CHudBattery = true,
  60. CHudCrosshair = false,
  61. }
  62.  
  63. hook.Add( "HUDShouldDraw", "HideHUD", function( name )
  64. if hudEnabled == true then
  65. if ( hide[ name ] ) then
  66. return false
  67. end
  68. -- Don't return anything here, it may break other addons that rely on this hook.
  69. end
  70. end)
  71.  
  72. hook.Add("HUDPaint","DrawMyHud",function()
  73. if hudEnabled == true then
  74.  
  75. PLY_SPEED = LocalPlayer():GetVelocity():Length()
  76.  
  77. if LocalPlayer():InVehicle() then
  78. if LocalPlayer():GetVehicle():GetParent():IsValid() then
  79. speed = (LocalPlayer():InVehicle() and (LocalPlayer():GetVehicle():GetParent():GetVelocity():Length())) or (LocalPlayer():GetVelocity():Length())
  80. else
  81. speed = (LocalPlayer():InVehicle() and (LocalPlayer():GetVehicle():GetVelocity():Length())) or (LocalPlayer():GetVelocity():Length())
  82. end
  83. else speed = PLY_SPEED end
  84.  
  85. MPH = speed/17.6
  86. KPH = MPH*1.609344
  87. local health = LocalPlayer():Health()
  88. local armor = LocalPlayer():Armor()
  89. local name = LocalPlayer():GetName()
  90. --[
  91. draw.RoundedBox(0,ScrW()*0.002,ScrH()*0.95,200,50,Color(0,0,0,180))//HP
  92. draw.RoundedBox(0,ScrW()*0.002,ScrH()*0.90,200,50,Color(0,0,0,180))//ARMOR
  93. draw.RoundedBox(0,ScrW()*0.11,ScrH()*0.95,300,50,Color(0,0,0,180))//SPEEDBOX
  94. draw.RoundedBox(0,ScrW()*0.4985,ScrH()*0.499,5,5,Color(0,0,0,255))//CROSSHAIR
  95. draw.RoundedBox(0,ScrW()*0.112,ScrH()*0.9823,math.Clamp(MPH+5,0,250),12,Color(0,63,255,255))//SPEEDO
  96. draw.SimpleText(math.floor(math.Clamp(MPH,0,2048)),"SmallHUDFont",ScrW()*0.112,ScrH()*0.9523,Color(180,180,180,255),0,0)
  97. draw.SimpleText("MPH |","SmallHUDFont",ScrW()*0.135,ScrH()*0.9523,Color(180,180,180,255),0,0)
  98. draw.SimpleText(math.floor(math.Clamp(KPH,0,2048)),"SmallHUDFont",ScrW()*0.180,ScrH()*0.9523,Color(180,180,180,255),0,0)
  99. draw.SimpleText("KPH","SmallHUDFont",ScrW()*0.203,ScrH()*0.9523,Color(180,180,180,255),0,0)
  100. draw.SimpleText(math.Clamp(health,0,9999),"HUDFont",ScrW()*0.04,ScrH()*0.950,Color(180,180,180,255),0,0)
  101. draw.SimpleText("HP:","SmallHUDFont",ScrW()*0.005,ScrH()*0.950,Color(255,0,0,255),0,0)
  102. draw.SimpleText(math.Clamp(armor,0,9999),"HUDFont",ScrW()*0.045,ScrH()*0.900,Color(180,180,180,255),0,0)
  103. draw.SimpleText("AMR:","SmallHUDFont",ScrW()*0.005,ScrH()*0.900,Color(0,63,255,255),0,0)
  104. end
  105. end)
  106. //LATER USE
  107. --hook.Add("HUDPaint", "hookname123", test)
  108. --if hudEnabled == true then
  109. -- function HoveringNames()
  110.  
  111. -- for _, target in pairs(player.GetAll()) do
  112. -- if target:Alive() and target != LocalPlayer() then
  113. --
  114. -- local targetPos = target:GetPos() + Vector(0,0,84)
  115. -- local targetDistance = math.floor((LocalPlayer():GetPos():Distance( targetPos ))/40)
  116. -- local targetScreenpos = targetPos:ToScreen()
  117. -- draw.SimpleText(target:Nick(), "Trebuchet18", tonumber(targetScreenpos.x), tonumber(targetScreenpos.y), Color(0,63,255,255), TEXT_ALIGN_CENTER)
  118.  
  119. -- end
  120. -- end
  121. -- end
  122. --end
  123. --hook.Add("HUDPaint", "HoveringNames", HoveringNames)--
  124. //255,0,0, RED
  125. //0,63,255, BLUE
  126. //33,255,0 GREEN
  127. //36,36,36 DARK GRAY
  128. //0,0,0, black you idiot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement