Advertisement
CREONIX

ATTACKING PUSHING PLAYER DARKRP

Dec 5th, 2016
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. --[[
  2. ПРИ НАЖАТИЕ НА ИГРОКА ТОЛКАЕТ ЕГО
  3. --]]
  4.  
  5. local curTime = 0
  6.  
  7. hook.Add( "KeyPress", "KeyAttackPlayer", function(ply,key)
  8.  
  9.     local player = ply:GetEyeTrace().Entity
  10.  
  11.     if ( key == IN_USE ) then
  12.    
  13.     if CurTime() < curTime then return end
  14.  
  15.         if IsValid(player) and player:IsPlayer() and ply:GetPos():Distance(player:GetPos()) < 60 then
  16.  
  17.             --player_ent:TakeDamage(math.random(2,6))
  18.  
  19.             player:SetVelocity(ply:GetAimVector() * 130)
  20.  
  21.             player:EmitSound("player/kevlar2.wav",65,90)
  22.            
  23.             curTime = CurTime() + 2
  24.            
  25.         end
  26.  
  27.     end
  28.  
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement