Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.63 KB | None | 0 0
  1. local function HUDPaint()
  2.  
  3. if (LocalPlayer():GetActiveWeapon() == NULL or LocalPlayer():GetActiveWeapon() == "Camera") then return end
  4. if ( !LocalPlayer():Alive() ) then return end
  5. if shouldDraw then
  6. SWEP = LocalPlayer():GetActiveWeapon()
  7. length = LocalPlayer():Health() *2
  8. Alength = LocalPlayer():Armor() *2
  9. ypos = ScrH() - 75
  10. poly = { { },{ },{ },{} }
  11.  
  12. poly[1]["x"] = 150
  13. poly[1]["y"] = ypos
  14. poly[1]["u"] = 1
  15. poly[1]["v"] = 0
  16.  
  17. poly[2]["x"] = length+150
  18. poly[2]["y"] = ypos
  19. poly[2]["u"] =0
  20. poly[2]["v"] = 0
  21.  
  22. poly[3]["x"] = length + 175
  23. poly[3]["y"] = ypos+15
  24. poly[3]["u"] = 0
  25. poly[3]["v"] = 0
  26.  
  27. poly[4]["x"] = 150
  28. poly[4]["y"] = ypos+15
  29. poly[4]["u"] =1
  30. poly[4]["v"] = 1
  31.  
  32. poly2 = { { },{ },{ },{} }
  33.  
  34. poly2[1]["x"] = 150
  35. poly2[1]["y"] = ypos+15
  36. poly2[1]["u"] =1
  37. poly2[1]["v"] = 0
  38.  
  39. poly2[2]["x"] = Alength+175
  40. poly2[2]["y"] = ypos+15
  41. poly2[2]["u"] =0
  42. poly2[2]["v"] = 0
  43.  
  44. poly2[3]["x"] = Alength+150
  45. poly2[3]["y"] = ypos+30
  46. poly2[3]["u"] = 0
  47. poly2[3]["v"] = 0
  48.  
  49. poly2[4]["x"] = 150
  50. poly2[4]["y"] = ypos +30
  51. poly2[4]["u"] =1
  52. poly2[4]["v"] = 1
  53.  
  54.     local CamData = {}
  55.     CamData.angles = Angle(90,90,0)
  56.     CamData.origin = Vector(LocalPlayer():GetPos().x,LocalPlayer():GetPos().y,512)
  57.     CamData.x = 10
  58.     CamData.y = 10
  59.     CamData.w = 200
  60.     CamData.h = 200    
  61.     render.RenderView( CamData )
  62.      
  63.     surface.SetTexture( triangletex ) --set the texture of the triangle
  64.     surface.SetDrawColor( 255, 50, 50, 255 ) --set the additive color
  65.     surface.DrawPoly( poly ) --draw the triangle with our triangle table
  66.     surface.SetDrawColor( 50, 50, 255, 255 ) --set the additive color
  67.     surface.DrawPoly( poly2 ) --draw the triangle with our triangle table
  68.     surface.SetDrawColor( 200, 200, 200, 255 ) --set the additive color
  69.     surface.DrawLine( 150, ypos+14,400, ypos+14 )
  70.     surface.DrawLine( 150, ypos+15,400, ypos+15 )
  71.     surface.DrawLine( 150, ypos+16,400, ypos+16 )
  72.     surface.DrawLine( ScrW()-450, ypos+14,ScrW()-150, ypos+14 )
  73.     surface.DrawLine( ScrW()-450, ypos+15,ScrW()-150, ypos+15 )
  74.     surface.DrawLine( ScrW()-450, ypos+16,ScrW()-150, ypos+16 )
  75.     draw.SimpleText(LocalPlayer():Health(), "BANKGOTHIC", 170, ScrH() - 70, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  76.     draw.SimpleText(LocalPlayer():Armor(), "BANKGOTHIC", 170, ScrH() - 50, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  77.     draw.SimpleText(string.ToMinutesSeconds( CurTime()), "BANKGOTHIC", 80, ScrH() - 150, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  78.    
  79.     local center = Vector( 75, ScrH()-60, 0 )
  80.     local scale = Vector( 75, 75, 0 )
  81.     local segmentdist = 360 / ( 2 * math.pi * math.max( scale.x, scale.y ) / 2 )
  82.     surface.SetDrawColor( 200, 200, 200, 255 )
  83.  
  84.      for a = 0, 130 - segmentdist, segmentdist do
  85.         surface.DrawLine( center.x + math.cos( math.rad( a ) ) * scale.x, center.y - math.sin( math.rad( a ) ) * scale.y, center.x + math.cos( math.rad( a + segmentdist ) ) * scale.x, center.y - math.sin( math.rad( a + segmentdist ) ) * scale.y )
  86.         surface.DrawLine( center.x+1 + math.cos( math.rad( a ) ) * scale.x, center.y - math.sin( math.rad( a ) ) * scale.y, center.x + math.cos( math.rad( a + segmentdist ) ) * scale.x, center.y+1 - math.sin( math.rad( a + segmentdist ) ) * scale.y )
  87.         surface.DrawLine( center.x+2 + math.cos( math.rad( a ) ) * scale.x, center.y - math.sin( math.rad( a ) ) * scale.y, center.x + math.cos( math.rad( a + segmentdist ) ) * scale.x, center.y+2 - math.sin( math.rad( a + segmentdist ) ) * scale.y )
  88.     end
  89.    
  90.      local center = Vector( ScrW()-75, ScrH()-60, 0 )
  91.     local scale = Vector( 75, 75, 0 )
  92.     local segmentdist = 360 / ( 2 * math.pi * math.max( scale.x, scale.y ) / 2 )
  93.    
  94.  
  95.     for a = 0, 180 - segmentdist, segmentdist do
  96.         surface.DrawLine( center.x + math.cos( math.rad( a ) ) * scale.x, center.y - math.sin( math.rad( a ) ) * scale.y, center.x + math.cos( math.rad( a + segmentdist ) ) * scale.x, center.y - math.sin( math.rad( a + segmentdist ) ) * scale.y )
  97.         surface.DrawLine( center.x+1 + math.cos( math.rad( a ) ) * scale.x, center.y - math.sin( math.rad( a ) ) * scale.y, center.x + math.cos( math.rad( a + segmentdist ) ) * scale.x, center.y+1 - math.sin( math.rad( a + segmentdist ) ) * scale.y )
  98.         surface.DrawLine( center.x+2 + math.cos( math.rad( a ) ) * scale.x, center.y - math.sin( math.rad( a ) ) * scale.y, center.x + math.cos( math.rad( a + segmentdist ) ) * scale.x, center.y+2 - math.sin( math.rad( a + segmentdist ) ) * scale.y )
  99.     end
  100.    
  101.     //Ammo
  102.     local bulletNum = SWEP:Clip1()
  103.        draw.SimpleText(bulletNum, "BANKGOTHIC2", ScrW()-185, ScrH() - 75, Color(200,200,200,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  104.    
  105.      if bulletNum <=50  then
  106.         for i = 1,bulletNum do
  107.             surface.DrawLine( ScrW()-200-i*5, ypos-5,ScrW()-200-i*5, ypos+10 )      
  108.             surface.DrawLine( ScrW()-201-i*5, ypos-5,ScrW()-201-i*5, ypos+10 )  
  109.             surface.DrawLine( ScrW()-202-i*5, ypos-5,ScrW()-202-i*5, ypos+10 )        
  110.         end
  111.     else
  112.       local max = LocalPlayer():GetActiveWeapon().Primary.ClipSize
  113.        local BarLength = (bulletNum*240)/max
  114.         surface.DrawRect(ScrW()-210-BarLength, ypos-5, BarLength, 15 )  
  115.     end
  116.  end  
  117. end
  118. hook.Add("HUDPaint","Hud", HUDPaint)
  119.  
  120. function hidehud(name)
  121. if shouldDraw then
  122.     for k, v in pairs{"CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo"} do
  123.         if name == v then return false end
  124.     end
  125.     end
  126. end
  127. hook.Add("HUDShouldDraw", "hidehud", hidehud)
  128. function toggleCodHud()
  129.     shouldDraw = not shouldDraw
  130. end
  131. concommand.Add("toggleCodHud",toggleCodHud)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement