Python1320

Untitled

Jan 28th, 2011
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local times = 2
  2. local power = 80
  3.  
  4. local function CalcDoubleJump(ply, move)
  5.  
  6.     if ply:KeyPressed(IN_JUMP) then
  7.         --print("key pressed")
  8.         if ply:IsOnGround() then
  9.             --print("on ground")
  10.             ply.double_jump_stage = 0
  11.         else
  12.             --print("increasing")
  13.             ply.double_jump_stage = (ply.double_jump_stage or 0) + 1
  14.  
  15.             if ply.double_jump_stage < times then
  16.                 ply.double_jump_boost = CurTime() + 0.5
  17.                 --print("boosting")
  18.             else
  19.                 ply.double_jump_stage = 0
  20.                 --print("resetting")
  21.             end
  22.         end
  23.     end
  24.  
  25.     if (ply.double_jump_boost or 0) > CurTime() then
  26.         --print("DOUBLE")
  27.        
  28.         if SERVER then
  29.             power = power * 1
  30.         end
  31.        
  32.         ply:SetGroundEntity(NULL)
  33.         move:SetVelocity(move:GetVelocity() + (vector_up * power))
  34.         ply.double_jump_boost = false
  35.     end
  36.    
  37. end
  38.  
  39. if SinglePlayer() then
  40.     hook.Add("SetupMove", "jump", CalcDoubleJump)
  41. else
  42.     hook.Add("Move", "jump", CalcDoubleJump)
  43. end
Advertisement
Add Comment
Please, Sign In to add comment