Skip to content

Instantly share code, notes, and snippets.

@Geczy
Created December 28, 2014 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Geczy/10f5b7a6aed5f59a2028 to your computer and use it in GitHub Desktop.
Save Geczy/10f5b7a6aed5f59a2028 to your computer and use it in GitHub Desktop.
--<< 100% critical strike (not for items) >>
--===================--
-- LIBRARIES --
--===================--
require("libs.ScriptConfig")
function Set (list)
local set = {}
for _, l in ipairs(list) do set[l] = true end
return set
end
--===================--
-- CONFIG --
--===================--
config = ScriptConfig.new()
config:SetParameter("Hotkey", "F", config.TYPE_HOTKEY)
config:Load()
local x = 50
local y = 0
--===================--
-- CODE --
--===================--
local activated = false
local wait = false
local stwait = true
local font = drawMgr:CreateFont("critfont","Arial",14,500)
local defaultText = "Critscript: Disabled"
local text = drawMgr:CreateText(x,y,-1,defaultText,font)
local validHeroes = Set{"npc_dota_hero_juggernaut", "npc_dota_hero_phantom_assassin", "npc_dota_hero_brewmaster", "npc_dota_hero_skeleton_king", "npc_dota_hero_chaos_knight"}
function Key(msg,code)
if msg ~= KEY_DOWN or not client.connected or client.loading or client.console then
return
end
if not IsKeyDown(config.Hotkey) then
return
end
mh = entityList:GetMyHero()
if not validHeroes[mh.name] then
script:Disable()
Close()
return
end
if not activated then
me = entityList:GetMyPlayer()
text.text = "Critscript: Enabled"
else
text.text = defaultText
end
activated = not activated
end
function Tick(tick)
if not activated then
return
end
if mh.activity == LuaEntityNPC.ACTIVITY_ATTACK and not wait then
stwait = false
wait = true
me:HoldPosition()
end
if mh.activity == LuaEntityNPC.ACTIVITY_IDLE and not stwait then
wait = false
me:AttackMove(client.mousePosition)
stwait = true
end
end
script:RegisterEvent(EVENT_TICK,Tick)
script:RegisterEvent(EVENT_KEY,Key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment