stoneharry

Untitled

Nov 13th, 2012
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. function ZG.VAR.KnockbackPlayerArchi(pUnit)
  2.  
  3.     local plr = pUnit:GetRandomPlayer(0)
  4.     if not plr then
  5.         return;
  6.     end
  7.    
  8.     local x2 = pUnit:GetX()
  9.     local y2 = pUnit:GetY()
  10.     local x1 = plr:GetX()
  11.     local y1 = plr:GetY()
  12.  
  13.     local x = x2 - x1
  14.     local y = y2 - y1
  15.    
  16.     local angle = math.pi + math.atan2(-y, -x)
  17.  
  18.     -- 30 = distance
  19.     local x = x1 - (30 * math.cos(angle))
  20.     local y = y1 - (30 * math.sin(angle))
  21.    
  22.     local z = pUnit:GetLandHeight(x, u)
  23.     if z > 200 or z < 20 then
  24.         z = plr:GetZ()
  25.     end
  26.    
  27.     plr:MoveKnockback(x, y, z, 2, 9)
  28.  
  29. end
Advertisement
Add Comment
Please, Sign In to add comment