Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ply = LocalPlayer()
- local x = ScrW()
- local y = ScrH()
- local t = CurTime()
- local g = 0
- local p = 0
- local a = 255
- local m = 100
- local ds = 5
- local msr = 2000
- local ut = {}
- local rp = { x = 200, y = 200}
- local lt = 0.5
- local spd = 4
- hook.Add( "HUDPaint", "holohlohlho", function()
- spd = math.Clamp( spd, 3, 8 )
- p = math.Clamp( Lerp( 0.1, p, p+spd ), 0, 100 )
- g = m / 100 * p
- if p > 50 then
- a = math.Clamp( Lerp( 0.45, a, a - spd / 0.8 ), 0, 255 )
- end
- if p < 1 then
- a = 255
- ut = {}
- end
- if a == 0 then
- surface.PlaySound( "HL1/fvox/fuzz.wav" )
- p = 0
- end
- local unit = ents.FindInSphere( ply:GetPos(), msr )
- surface.DrawCircle( rp.x, rp.y, g, Color( 255,255,255,a ) )
- surface.DrawCircle( rp.x, rp.y, m, Color( 255,200,200,255 ) )
- surface.SetDrawColor( 255, 200, 200, 100 )
- surface.DrawLine( rp.x, rp.y, rp.x, rp.y - m )
- local av = ply:GetAimVector()
- for _, u in pairs( unit ) do
- if u:IsNPC() or u:IsPlayer() then
- if not u:IsValid() then continue end
- if u == LocalPlayer() then continue end
- if p < 1 then
- u.rsc = false
- end
- local df = ply:GetPos() - u:GetPos()
- local duva = msr / m
- local gc = { x = df.x / duva, y = df.y / duva }
- local gs = math.sqrt( gc.x*gc.x + gc.y*gc.y )
- local py = math.Deg2Rad( math.Rad2Deg( math.atan2( gc.x, gc.y ) ) - math.Rad2Deg( math.atan2( av.x, av.y ) ) + 90 )
- local go = { x= math.cos( py ) * gs, y= math.sin( py ) * gs }
- local dist = ply:GetPos():Distance( u:GetPos() )
- local drx, dry = rp.x - ds/2 + go.x, rp.y - ds/2 + go.y
- if ( msr / 100 * p ) > dist then
- if !u.rsc then
- surface.PlaySound( "buttons/button16.wav" )
- local col = Color( 0,255,0,255 )
- if u:IsNPC() then
- col = Color( 255,50,0,255 )
- end
- table.insert( ut, { drx, dry, CurTime() + lt, col } )
- u.rsc = true
- end
- end
- end
- end
- for _, data in pairs( ut ) do
- if data[3] > CurTime() then
- 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 ) ) )
- end
- end
- end)
Add Comment
Please, Sign In to add comment