Guest User

Untitled

a guest
Jun 23rd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1.  
  2. local ply = LocalPlayer()
  3. local x = ScrW()
  4. local y = ScrH()
  5. local t = CurTime()
  6. local g = 0
  7. local p = 0
  8. local a = 255
  9. local m = 100
  10. local ds = 5
  11. local msr = 2000
  12. local ut = {}
  13. local rp = { x = 200, y = 200}
  14. local lt = 0.5
  15. local spd = 4
  16.  
  17. hook.Add( "HUDPaint", "holohlohlho", function()
  18.  
  19. spd = math.Clamp( spd, 3, 8 )
  20. p = math.Clamp( Lerp( 0.1, p, p+spd ), 0, 100 )
  21.  
  22. g = m / 100 * p
  23.  
  24. if p > 50 then
  25. a = math.Clamp( Lerp( 0.45, a, a - spd / 0.8 ), 0, 255 )
  26. end
  27.  
  28. if p < 1 then
  29. a = 255
  30. ut = {}
  31. end
  32. if a == 0 then
  33. surface.PlaySound( "HL1/fvox/fuzz.wav" )
  34. p = 0
  35. end
  36.  
  37. local unit = ents.FindInSphere( ply:GetPos(), msr )
  38.  
  39. surface.DrawCircle( rp.x, rp.y, g, Color( 255,255,255,a ) )
  40. surface.DrawCircle( rp.x, rp.y, m, Color( 255,200,200,255 ) )
  41.  
  42. surface.SetDrawColor( 255, 200, 200, 100 )
  43. surface.DrawLine( rp.x, rp.y, rp.x, rp.y - m )
  44.  
  45. local av = ply:GetAimVector()
  46.  
  47. for _, u in pairs( unit ) do
  48. if u:IsNPC() or u:IsPlayer() then
  49.  
  50. if not u:IsValid() then continue end
  51. if u == LocalPlayer() then continue end
  52. if p < 1 then
  53. u.rsc = false
  54. end
  55.  
  56. local df = ply:GetPos() - u:GetPos()
  57. local duva = msr / m
  58. local gc = { x = df.x / duva, y = df.y / duva }
  59. local gs = math.sqrt( gc.x*gc.x + gc.y*gc.y )
  60. local py = math.Deg2Rad( math.Rad2Deg( math.atan2( gc.x, gc.y ) ) - math.Rad2Deg( math.atan2( av.x, av.y ) ) + 90 )
  61. local go = { x= math.cos( py ) * gs, y= math.sin( py ) * gs }
  62. local dist = ply:GetPos():Distance( u:GetPos() )
  63.  
  64. local drx, dry = rp.x - ds/2 + go.x, rp.y - ds/2 + go.y
  65.  
  66. if ( msr / 100 * p ) > dist then
  67. if !u.rsc then
  68. surface.PlaySound( "buttons/button16.wav" )
  69.  
  70. local col = Color( 0,255,0,255 )
  71.  
  72. if u:IsNPC() then
  73. col = Color( 255,50,0,255 )
  74. end
  75.  
  76. table.insert( ut, { drx, dry, CurTime() + lt, col } )
  77. u.rsc = true
  78. end
  79. end
  80.  
  81. end
  82.  
  83. end
  84.  
  85. for _, data in pairs( ut ) do
  86.  
  87. if data[3] > CurTime() then
  88. draw.RoundedBox( 0, data[1], data[2], ds, ds, Color( data[4].r, data[4].g, data[4].b, 255 * math.Clamp( data[3] - CurTime(), 0, lt ) ) )
  89. end
  90. end
  91. end)
Add Comment
Please, Sign In to add comment