Python1320

Python1320

Jun 5th, 2010
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. local function NilJump(ply)
  2.     --print("-JUMP",ply)
  3.     ply.SuperJumpVelocity=nil
  4.     --ply:SetMoveType(MOVETYPE_WALK)
  5. end
  6.  
  7. hook.Add( "KeyRelease", "a", function ( ply, key )
  8.         if !ply:KeyDown(IN_DUCK)  then return end
  9.         if key!=IN_JUMP then return end
  10.        
  11.         --if !IsFirstTimePredicted() then return end
  12.         NilJump(ply)
  13.        
  14. end )
  15.  
  16.  
  17.  
  18. hook.Add( "KeyPress", "a", function (ply, key)
  19.     if !ply:KeyDown(IN_DUCK)  then return end
  20.     if key!=IN_JUMP then return end
  21.    
  22.     if !IsFirstTimePredicted() then return end
  23.        
  24.     if ply:OnGround() then
  25.  
  26.         ply.SuperJumpVelocity=500
  27.         --ply:SetMoveType(MOVETYPE_FLY)
  28.     end
  29.    
  30. end )
  31.  
  32. local factor=1
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. hook.Add("Move", "a", function (ply, mv)
  42.  
  43. if !ply:KeyDown(IN_JUMP) or !ply:KeyDown(IN_DUCK) or !ply.SuperJumpVelocity then return end
  44.    
  45.     if ply:OnGround() and ply.SuperJumpVelocity<0 then
  46.         ply.SuperJumpVelocity=nil
  47.         return
  48.     end
  49.    
  50.     ply:SetGroundEntity()
  51.    
  52.     if ply.SuperJumpVelocity < 50 then
  53.         NilJump(ply)
  54.         return
  55.     end
  56.    
  57.     local aimdir=ply:GetAimVector()
  58.     aimdir.z=0
  59.     aimdir:Normalize()
  60.    
  61.     local vel=mv:GetVelocity()
  62.     vel.z=0
  63.     --print(ply,ply.SuperJumpVelocity*FrameTime()*70)
  64.     mv:SetVelocity(  vel+Vector(0,0,ply.SuperJumpVelocity*FrameTime()*70) )
  65.     --if !IsFirstTimePredicted() then return end
  66.  
  67.     ply.SuperJumpVelocity = ply.SuperJumpVelocity * ( 0.98 - FrameTime() * 0.1 )  
  68.    
  69.     return --true  
  70.  
  71.  
  72.  
  73.    
  74. end)
Add Comment
Please, Sign In to add comment