stoneharry

Untitled

Nov 12th, 2012
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 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 x1 = pUnit:GetX()
  9.     local y1 = pUnit:GetY()
  10.     local x2 = plr:GetX()
  11.     local y2 = plr:GetY()
  12.  
  13.     local x = x1 < x2 and x2 - x1 or x1 - x2
  14.     local y = y1 < y2 and y2 - y1 or y1 - y2
  15.  
  16.     local angle = 180 + (math.atan2(-x, -y) * (180 / math.pi))
  17.     angle = angle * (math.pi / 180)
  18.  
  19.     -- 25 = amount of yards past point
  20.     local x3 = x + (2 * math.cos(angle))
  21.     local y3 = y + (2 * math.sin(angle))
  22.    
  23.     local z3 = pUnit:GetLandHeight(x3, y3)
  24.    
  25.     plr:MoveKnockback(x3, y3, z3, 4, 6)
  26.    
  27.     pUnit:SendChatMessage(14,0,"FLYYYY!!!")
  28.  
  29. end
Advertisement
Add Comment
Please, Sign In to add comment