CapsAdmin

Untitled

Oct 11th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. local mat = Material("sprites/light_ignorez")
  2. local duration = 1
  3. local delay = 3.75
  4. local max_speed = 5000
  5. local sound_played = false
  6.  
  7. hook.Add("HUDPaint", "teamrocket", function()
  8.     local time = RealTime()
  9.     local size = math.sin(time * 5) * 10
  10.     local rotation = time * 100
  11.    
  12.     surface.SetMaterial(mat)
  13.     surface.SetDrawColor(255, 255, 255, 255)
  14.     for k,v in pairs(ents.GetAll()) do
  15.         if v:GetClass() ~= "class C_HL2MPRagdoll" then continue end
  16.  
  17.         local len = v:GetPhysicsObjectNum(1):GetVelocity():Length()
  18.        
  19.         if not v.star_time and len > max_speed then
  20.             v.star_start = time + delay
  21.         end
  22.        
  23.         if v.star_start and v.star_start < time then
  24.             if not v.star_time then
  25.                 v.star_time = time + duration
  26.             end
  27.             if v.star_time > time then
  28.                 local pos = v:EyePos():ToScreen()
  29.                 local delta = (v.star_time - time) / duration
  30.                 if pos.visible then
  31.                     surface.DrawTexturedRectRotated(pos.x, pos.y, delta * 128 + size, delta * 128 + size, rotation)
  32.                 end
  33.                 if not v.star_sound_played then
  34.                     surface.PlaySound("chatsounds/autoadd/misc/jtechsfx/asdasd.wav")
  35.                     v.star_sound_played = true
  36.                 end
  37.             elseif len < max_speed then
  38.                 v.star_time = nil          
  39.                 v.star_sound_played = true
  40.                 v.star_start = nil
  41.             end
  42.         end
  43.     end
  44.  
  45.  
  46. end)
Advertisement
Add Comment
Please, Sign In to add comment