Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require("libs.Utils")
- require("libs.SideMessage")
- require("libs.ScriptConfig")
- config = ScriptConfig.new()
- config:SetParameter("hotkey", "T", config.TYPE_HOTKEY)
- config:Load()
- toggleKey = config.hotkey
- local me = nil local play = false local activated = false local work = nil
- function Tick(tick)
- if not PlayingGame() then return end
- me = entityList:GetMyHero() if not me then return end
- if SleepCheck() and activated then
- if me then
- local cour = entityList:FindEntities({classId = CDOTA_Unit_Courier,team = me.team,alive = true})[1]
- local fount = entityList:FindEntities({classId = CDOTA_Unit_Fountain,team = me.team})[1]
- if cour then
- if cour:GetAbility(6).state == LuaEntityAbility.STATE_READY then
- cour:CastAbility(cour:GetAbility(6))
- end
- if not work then
- local notsafedistance = GetDistance2D(cour,fount)
- if SleepCheck("two") and cour.visibleToEnemy and notsafedistance < 6900 and notsafedistance > 4500 and not cour:GetProperty("CDOTA_Unit_Courier","m_bFlyingCourier") then
- cour:CastAbility(cour:GetAbility(1)) Sleep(1000,"two")
- work = nil
- activated = false
- end
- local player = entityList:GetMyPlayer()
- local phys = entityList:GetEntities(function (bl) return bl.type==LuaEntity.TYPE_ITEM_PHYSICAL and bl.itemHolds.name== "item_bottle" end)[1]
- local bot = me:FindItem("item_bottle")
- if cour then
- local distance = GetDistance2D(cour,me)
- if SleepCheck("one") then
- cour:Follow(me) Sleep(1000,"one")
- end
- if distance < 200 and bot and not phys then
- player:Select(me)
- player:DropItem(bot,me.position)
- elseif phys then
- player:Select(cour)
- player:TakeItem(phys)
- player:Select(me)
- work = 1
- end
- end
- elseif work == 1 then
- local CourerB = cour:FindItem("item_bottle")
- if CourerB then
- if CourerB.charges ~= 3 then
- if cour.courState ~= LuaEntityCourier.STATE_B2BASE then
- cour:CastAbility(cour:GetAbility(1))
- end
- elseif cour.courState ~= LuaEntityCourier.STATE_DELIVER then
- client:ExecuteCmd("dota_courier_deliver")
- cour:CastAbility(cour:GetAbility(5))
- entityList:GetMyPlayer():Select(me)
- work = nil
- activated = false
- end
- end
- end
- end
- end
- Sleep(500)
- end
- end
- function Key()
- if client.chat then return end
- if IsKeyDown(toggleKey) then
- activated = not activated
- CourerSideMessage()
- end
- end
- function CourerSideMessage()
- local test = sideMessage:CreateMessage(200,60)
- test:AddElement(drawMgr:CreateRect(5,5,80,50,0xFFFFFFFF,drawMgr:GetTextureId("NyanUI/spellicons/courier_take_stash_items")))
- test:AddElement(drawMgr:CreateText(90,13,-1,"Wait!",drawMgr:CreateFont("defaultFont","Tahoma",25,500)))
- end
- function Load()
- if PlayingGame() then
- play = true
- script:RegisterEvent(EVENT_KEY,Key)
- script:RegisterEvent(EVENT_FRAME,Tick)
- script:UnregisterEvent(Load)
- end
- end
- function GameClose()
- if play then
- me = nil
- work = nil
- script:UnregisterEvent(Tick)
- script:UnregisterEvent(Key)
- script:RegisterEvent(EVENT_TICK,Load)
- play = false
- end
- end
- script:RegisterEvent(EVENT_TICK,Load)
- script:RegisterEvent(EVENT_CLOSE,GameClose)
- require("libs.Utils")
- require("libs.SideMessage")
- require("libs.ScriptConfig")
- config = ScriptConfig.new()
- config:SetParameter("hotkey", "T", config.TYPE_HOTKEY)
- config:Load()
- toggleKey = config.hotkey
- local me = nil local play = false local activated = false local work = nil
- function Tick(tick)
- if not PlayingGame() then return end
- me = entityList:GetMyHero() if not me then return end
- if SleepCheck() and activated then
- if me then
- local cour = entityList:FindEntities({classId = CDOTA_Unit_Courier,team = me.team,alive = true})[1]
- local fount = entityList:FindEntities({classId = CDOTA_Unit_Fountain,team = me.team})[1]
- if cour then
- if cour:GetAbility(6).state == LuaEntityAbility.STATE_READY then
- cour:CastAbility(cour:GetAbility(6))
- end
- if not work then
- local notsafedistance = GetDistance2D(cour,fount)
- if SleepCheck("two") and cour.visibleToEnemy and notsafedistance < 6900 and notsafedistance > 4500 and not cour:GetProperty("CDOTA_Unit_Courier","m_bFlyingCourier") then
- cour:CastAbility(cour:GetAbility(1)) Sleep(1000,"two")
- work = nil
- activated = false
- end
- local player = entityList:GetMyPlayer()
- local phys = entityList:GetEntities(function (bl) return bl.type==LuaEntity.TYPE_ITEM_PHYSICAL and bl.itemHolds.name== "item_bottle" end)[1]
- local bot = me:FindItem("item_bottle")
- if cour then
- local distance = GetDistance2D(cour,me)
- if SleepCheck("one") then
- cour:Follow(me) Sleep(1000,"one")
- end
- if distance < 200 and bot and not phys then
- player:Select(me)
- player:DropItem(bot,me.position)
- elseif phys then
- player:Select(cour)
- player:TakeItem(phys)
- player:Select(me)
- work = 1
- end
- end
- elseif work == 1 then
- local CourerB = cour:FindItem("item_bottle")
- if CourerB then
- if CourerB.charges ~= 3 then
- if cour.courState ~= LuaEntityCourier.STATE_B2BASE then
- cour:CastAbility(cour:GetAbility(1))
- end
- elseif cour.courState ~= LuaEntityCourier.STATE_DELIVER then
- client:ExecuteCmd("dota_courier_deliver")
- cour:CastAbility(cour:GetAbility(5))
- entityList:GetMyPlayer():Select(me)
- work = nil
- activated = false
- end
- end
- end
- end
- end
- Sleep(500)
- end
- end
- function Key()
- if client.chat then return end
- if IsKeyDown(toggleKey) then
- activated = not activated
- CourerSideMessage()
- end
- end
- function CourerSideMessage()
- local test = sideMessage:CreateMessage(200,60)
- test:AddElement(drawMgr:CreateRect(5,5,80,50,0xFFFFFFFF,drawMgr:GetTextureId("NyanUI/spellicons/courier_take_stash_items")))
- test:AddElement(drawMgr:CreateText(90,13,-1,"Wait!",drawMgr:CreateFont("defaultFont","Tahoma",25,500)))
- end
- function Load()
- if PlayingGame() then
- play = true
- script:RegisterEvent(EVENT_KEY,Key)
- script:RegisterEvent(EVENT_FRAME,Tick)
- script:UnregisterEvent(Load)
- end
- end
- function GameClose()
- if play then
- me = nil
- work = nil
- script:UnregisterEvent(Tick)
- script:UnregisterEvent(Key)
- script:RegisterEvent(EVENT_TICK,Load)
- play = false
- end
- end
- script:RegisterEvent(EVENT_TICK,Load)
- script:RegisterEvent(EVENT_CLOSE,GameClose)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement