Advertisement
Guest User

cl_rolleffect

a guest
Jul 29th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1. // Falling & Roll Effect for Climb SWEP2
  2. CreateClientConVar("climbswep2_windsound", 1, true, false)
  3. CreateClientConVar("climbswep2_falleffect_allweps", 0, true, false)
  4. local PrevCurT = 0
  5. local CurAngles = nil
  6. local Rot = 0
  7. local Random
  8. local Snd
  9. local Snd2
  10. hook.Add("CreateMove", "ClimbFall", function(cmd)
  11.  
  12.     local Ply = LocalPlayer()
  13.     if !Snd then
  14.  
  15.         Snd = CreateSound(Ply, Sound("player/heartbeat1.wav"))
  16.         Snd:Play()
  17.         Snd:ChangeVolume(0, 0)
  18.         Snd:ChangePitch(100, 0)
  19.  
  20.         Snd2 = CreateSound(Ply, Sound("ambient/ambience/Wind_Light02_loop.wav"))
  21.         Snd2:Play()
  22.         Snd2:ChangeVolume(0, 0)
  23.  
  24.     end
  25.     if !IsValid(Ply) or !IsValid(Ply:GetActiveWeapon()) then return
  26.     elseif Ply:GetVelocity().z > -900 or (GetConVarNumber("climbswep2_falleffect_allweps") == 0 and Ply:GetActiveWeapon():GetClass() != "climb_swep2") or !Ply:Alive() or Ply:GetMoveType() != MOVETYPE_WALK then
  27.  
  28.         if PrevCurT > 0 then
  29.  
  30.             cmd:SetViewAngles(Angle(CurAngles.p, CurAngles.y, 0))
  31.             CurAngles = nil
  32.             Snd:ChangeVolume(0, 0)
  33.             Snd:ChangePitch(100, 0)
  34.             Snd2:ChangeVolume(0, 0)
  35.             hook.Remove("RenderScreenspaceEffects", "ClimbFallBlur")
  36.             PrevCurT = 0
  37.  
  38.         end    
  39.         return
  40.  
  41.     end
  42.     if PrevCurT == 0 then
  43.  
  44.         PrevCurT = CurTime()
  45.         local function DrawEffect()
  46.             --DrawMotionBlur(0.1, Time/5, 0.01)
  47.             local Time = CurTime() - PrevCurT
  48.             local Colour = {}
  49.             Colour[ "$pp_colour_addr" ] = 0
  50.             Colour[ "$pp_colour_addg" ] = 0
  51.             Colour[ "$pp_colour_addb" ] = 0
  52.             Colour[ "$pp_colour_brightness" ] = 0
  53.             Colour[ "$pp_colour_contrast" ] = (1 - Time/7.5)
  54.             Colour[ "$pp_colour_colour" ] = (1 - Time/7.5)
  55.             Colour[ "$pp_colour_mulr" ] = 0
  56.             Colour[ "$pp_colour_mulg" ] = 0
  57.             Colour[ "$pp_colour_mulb" ] = 0
  58.             DrawColorModify(Colour)
  59.             DrawMotionBlur(math.Clamp(0.75-Time/100, 0.25, 1), math.Clamp(Time/10, 0, 0.75), 0.05)
  60.  
  61.         end
  62.         hook.Add("RenderScreenspaceEffects", "ClimbFallBlur", DrawEffect)
  63.  
  64.     end
  65.  
  66.     if !IsValid(CurAngles) then CurAngles = cmd:GetViewAngles(); end
  67.    
  68.  
  69.    
  70.     local Time = (CurTime() - PrevCurT) * (8 + (CurTime() - PrevCurT) * 2)
  71.     if Time/25 < 1 then Snd:ChangeVolume(math.Clamp(Time/25, 0, 1), 0) end
  72.     if Time < 101 then Snd:ChangePitch(100 + Time, 0); if GetConVarNumber("climbswep2_windsound") == 1 then Snd2:ChangeVolume(Time/100, 0) else Snd2:ChangeVolume(0, 0) end end
  73.  
  74.     CurAngles.p = math.Round(CurAngles.p) < 75 and math.Round(CurAngles.p) + 0.5 or math.Round(CurAngles.p) - 0.5
  75.  
  76.     cmd:SetViewAngles(Angle(CurAngles.p, CurAngles.y + math.sin(Time) * 1.25, 0))
  77.  
  78. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement