Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 20th, 2012  |  syntax: Lua  |  size: 1.76 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --[[
  2.         AutoCrit
  3.         v2.0
  4.         Written by PedobearIGER
  5.         Credits: jbman for some basic stuff, Apple for making a script that works for all champions and some other stuff I will add in future updates and Zynox for having the universal-idea as wel
  6. ]]
  7.  
  8. --[[            Config          ]]
  9. HK=32 --hold spacebar to win
  10. --HE=16 --hold shift to win
  11. A=3 --try how many times
  12. local auto = false
  13. B=0
  14.  
  15. function Hotkey( msg, keycode )
  16.     if keycode == HK and msg == KEY_DOWN then
  17.     script.processSpellCallback = "Spell"
  18.         auto = true
  19.     elseif keycode == HK and msg == KEY_UP then
  20.     script.processSpellCallback = nil
  21.         auto = false
  22.         --elseif keycode == HE and msg == KEY_DOWN then
  23.     --auto = true
  24.     --elseif keycode == HE and msg == KEY_UP then
  25.     --auto = false
  26.     end
  27. end
  28.  
  29. function Spell(object,spellName)
  30.     if object ~= nil and object == player then
  31.                 if string.find( spellName, "BasicAttack") and B<A then
  32.         player:MoveTo(player.x,player.z)
  33.                 B = B+1
  34.                 else
  35.                 B = 0  
  36.                 end
  37.     end
  38.        
  39. end
  40.  
  41.  
  42. function Timer(tick)
  43.         if auto then
  44.         local x, y, z = GetMousePosition()
  45.         local closestDistance, closest = math.huge, nil
  46.         for i = 1, GetHeroCount(), 1 do
  47.             local target = GetHero(i)
  48.             if target and target.visible and target.team == TEAM_ENEMY then
  49.                 local currentDistance = math.sqrt((target.x - x) ^ 2 + (target.z - z) ^ 2)
  50.                 if currentDistance < closestDistance then
  51.                     closestDistance = currentDistance
  52.                     closest = target
  53.                 end
  54.             end
  55.         end
  56.         player:Attack(closest)
  57.         end
  58. end
  59.  
  60.  
  61. function Load()
  62.         script.timerCallback = { name = "Timer", interval = 10 }
  63.     script.keyCallback = "Hotkey"
  64.     PrintChat(" >> AutoCrit 2.0 loaded!")
  65. end