Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MOUSEEVENTF_RIGHTDOWN = 0x0008;
- MOUSEEVENTF_RIGHTUP = 0x0010;
- function TS()
- tg = nil
- for k,v in pairs(GetEnemyHeroes()) do
- if v and GetTeam(v) ~= GetTeam(GetMyHero()) and IsVisible(v) and IsTargetable(v) and IsObjectAlive(v) then
- if not tg then
- tg = v
- elseif tg then
- local vp = GetOrigin(v)
- local tgp = GetOrigin(tg)
- local mp = GetMousePos()
- local vDis = GetDistance(mp,vp)
- local tDis = GetDistance(mp,tgp)
- if vDis and tDis and vDis < tDis then
- tg = v
- end
- end
- end
- end
- end
- OnTick(function(myHero)
- TS()
- end)
- OnWndMsg(function (msg, param)
- if msg == 513 and IsObjectAlive(myHero) then
- if (tg and GetDistance(tg) <= GetRange(myHero) + 150) or (tg and GetDistance(tg, GetMousePos()) <= 400) then
- lol = WorldToScreen(0,Vector(tg.x, tg.y, tg.z))
- if (lol.x >= 0 and lol.x <= WINDOW_W) and (lol.y >= 0 and lol.y <= WINDOW_H) then
- AttackUnit(tg)
- end
- else
- mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
- DelayAction(function() mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0) end, math.random(0.050,0.080))
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement