Advertisement
Silverlan

Untitled

Apr 24th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. if(SERVER) then
  2. function SWEP:Deploy()
  3.     local idx = self.Owner:EntIndex()
  4.     local hk = "swepcheckjump" .. idx
  5.     self:CallOnRemove("cleanupswepcheckjump",hook.Remove,"KeyPress",hk)
  6.     hook.Add("KeyPress",hk,function(pl,key)
  7.         if(pl == self.Owner && key == IN_JUMP) then
  8.             self:OnOwnerJumped()
  9.         end
  10.     end)
  11.     return true
  12. end
  13.  
  14. function SWEP:OnOwnerJumped()
  15.     self.Owner:EmitSound("path/to/sound",75,100)
  16. end
  17.  
  18. function SWEP:Holster()
  19.     local idx = self.Owner:EntIndex()
  20.     local hk = "swepcheckjump" .. idx
  21.     self:RemoveCallOnRemove("cleanupswepcheckjump")
  22.     hook.Remove("KeyPress",hk)
  23. end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement