Advertisement
Guest User

Untitled

a guest
May 5th, 2016
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. MOUSEEVENTF_RIGHTDOWN       = 0x0008;
  2. MOUSEEVENTF_RIGHTUP         = 0x0010;
  3.  
  4.  
  5. function TS()
  6.     tg = nil
  7.     for k,v in pairs(GetEnemyHeroes()) do
  8.         if v and GetTeam(v) ~= GetTeam(GetMyHero()) and IsVisible(v) and IsTargetable(v) and IsObjectAlive(v) then
  9.             if not tg then
  10.                 tg = v
  11.             elseif tg then
  12.                 local vp = GetOrigin(v)
  13.                 local tgp = GetOrigin(tg)
  14.                 local mp = GetMousePos()
  15.                 local vDis = GetDistance(mp,vp)
  16.                 local tDis = GetDistance(mp,tgp)
  17.                 if vDis and tDis and vDis < tDis then
  18.                     tg = v
  19.                 end
  20.             end
  21.         end
  22.     end
  23. end
  24.  
  25. OnTick(function(myHero)
  26.     TS()
  27. end)
  28.  
  29. OnWndMsg(function (msg, param)
  30.  
  31.     if msg == 513 and IsObjectAlive(myHero) then
  32.         if (tg and GetDistance(tg) <= GetRange(myHero) + 150) or (tg and GetDistance(tg, GetMousePos()) <= 400) then
  33.             lol = WorldToScreen(0,Vector(tg.x, tg.y, tg.z))
  34.             if (lol.x >= 0 and lol.x <= WINDOW_W) and (lol.y >= 0 and lol.y <= WINDOW_H) then
  35.                 AttackUnit(tg)
  36.             end
  37.         else
  38.             mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
  39.             DelayAction(function() mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0) end, math.random(0.050,0.080))
  40.         end
  41.     end
  42.    
  43. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement