Kain2030

Auto Carry Plugin - Ziggs Edition - v1.08

Aug 5th, 2013
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.92 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Ziggs Edition
  4.         Author: Kain
  5.         Version: 1.08
  6.         Copyright 2013
  7.  
  8.         Dependency: Sida's Auto Carry: Revamped
  9.  
  10.         How to install:
  11.             Make sure you already have AutoCarry installed.
  12.             Name the script EXACTLY "SidasAutoCarryPlugin - Ziggs.lua" without the quotes.
  13.             Place the plugin in BoL/Scripts/Common folder.
  14.  
  15.         Version History:
  16.             Version: 1.08: http://pastebin.com/ebB89AnC
  17.             Version: 1.07: http://pastebin.com/Mj7i5k9X
  18.                 Added text on screen when Killsteal occurs to make it more noticeable.
  19.                 Added slider variable to set Killsteal hitchance/sensitivity.
  20.             Version: 1.06: http://pastebin.com/5j9W654G (7/23/2013)
  21.                 Fixed Karthus / Kog'maw, etc. bug where script would try to kill their 'ghost' after they were dead, but still present nearby.
  22.                 Added toggle for auto harass.
  23.                 Change range color indicators.
  24.             Version: 1.05: http://pastebin.com/CcgW9n27
  25.                 Added Satchel Jump.
  26.                 Improved "Ultimate Mega Killsteal" calculation. Now operates on a hitchance curve. The further away the target is, the higher the hitchance required to throw the Bomb. Should reduce the number of cross-map misses. Will experiment with the settings after more feedback.
  27.                 Removed Satchel from normal combo.
  28.                 Added a secondary Full Combo option.
  29.             Version: 1.04: http://pastebin.com/z4nTWmkr
  30.                 Fixed Bouncing Bomb for full range prediction. Requires SAC 4.9 or later.
  31.             Version: 1.03 Beta: http://pastebin.com/kZED9bqV
  32.             Version: 1.02 Beta: http://pastebin.com/5CzSRtdL
  33.             Version: 1.01 Beta: http://pastebin.com/hx2RYDaQ
  34.             Version: 1.0 Beta: http://pastebin.com/bGa23bFR
  35. --]]
  36.  
  37. if myHero.charName ~= "Ziggs" then return end
  38.  
  39. local Target
  40.  
  41. -- Prediction
  42. local QRange = 850
  43. local QMaxRange = 1400
  44. local WRange = 1000
  45. local ERange = 900
  46. local RRange = 5300
  47.  
  48. local QSpeed = 1.722 -- Old: 1.2
  49. local WSpeed = 1.727 -- Old: 1.5
  50. local ESpeed = 2.694 -- Old: 1.45
  51. local RSpeed = 1.856 -- Old: 1.5
  52.  
  53. local QWidth = 150
  54. local WWidth = 225
  55. local EWidth = 250
  56. local RWidth = 550
  57.  
  58. local QDelay = 218
  59. local WDelay = 249
  60. local EDelay = 125
  61. local RDelay = 1014
  62.  
  63. local SkillQ = {spellKey = _Q, range = QMaxRange, speed = QSpeed, delay = QDelay, width = QWidth, configName = "bouncingbomb", displayName = "Q (Bouncing Bomb)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  64. local SkillW = {spellKey = _W, range = WRange, speed = WSpeed, delay = WDelay, width = WWidth, configName = "satchelcharge", displayName = "W (Satchel Charge)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = false }
  65. local SkillE = {spellKey = _E, range = ERange, speed = ESpeed, delay = EDelay, width = EWidth, configName = "hexplosiveminefield", displayName = "E (Hexplosive Minefield)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = false }
  66. local SkillR = {spellKey = _R, range = RRange, speed = RSpeed, delay = RDelay, width = RWidth, configName = "megainfernobomb", displayName = "R (Mega Inferno Bomb)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  67. local SkillR = {spellKey = _R, range = RRange, speed = RSpeed, delay = RDelay, width = RWidth, configName = "megainfernobomb", displayName = "R (Mega Inferno Bomb)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  68.  
  69. local KeyQ = string.byte("Q")
  70. local KeyW = string.byte("W")
  71. local KeyE = string.byte("E")
  72. local KeyR = string.byte("R")
  73.  
  74. local tick = nil
  75. local doUlt = false
  76.  
  77. -- Draw
  78. local waittxt = {}
  79. local calculationenemy = 1
  80. local floattext = {"Skills not available", "Able to fight", "Killable", "Murder him!"}
  81. local killable = {}
  82.  
  83. local ignite = nil
  84. local DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil
  85. local QReady, WReady, EReady, RReady, DFGReady, HXGReady, BWCReady, IReady = false, false, false, false, false, false, false, false
  86.  
  87. local satchelChargeExists = false
  88. local pendingSatchelChargeActivation = nil
  89. local debugMode = false
  90.  
  91. -- Main
  92.  
  93. function Menu()
  94.     AutoCarry.PluginMenu:addParam("ZiggsCombo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  95.     AutoCarry.PluginMenu:addParam("FullCombo", "Full Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("Z"))
  96.     AutoCarry.PluginMenu:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("A"))
  97.     AutoCarry.PluginMenu:addParam("SatchelJump", "Satchel Jump", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
  98.     AutoCarry.PluginMenu:addParam("AutoHarass", "Auto Harass (Mana Intensive)", SCRIPT_PARAM_ONOFF, false)
  99.     AutoCarry.PluginMenu:addParam("Ultimate", "Use Ultimate with Combo", SCRIPT_PARAM_ONOFF, true)
  100.     AutoCarry.PluginMenu:addParam("Killsteal", "Ultimate Mega Killsteal", SCRIPT_PARAM_ONOFF, true)
  101.     AutoCarry.PluginMenu:addParam("KillstealMinHitchance", "Killsteal Min. Req. Hitchance", SCRIPT_PARAM_SLICE, 60, 0, 90, 0)
  102.     AutoCarry.PluginMenu:addParam("DrawKillablEenemy", "Draw Killable Enemy", SCRIPT_PARAM_ONOFF, true)
  103.     AutoCarry.PluginMenu:addParam("DrawText", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  104.     AutoCarry.PluginMenu:addParam("DrawPrediction", "Draw Prediction", SCRIPT_PARAM_ONOFF, true)
  105.     AutoCarry.PluginMenu:addParam("Draw", "Draw range circles", SCRIPT_PARAM_ONOFF, true)
  106.     AutoCarry.PluginMenu:addParam("DrawUlt", "Draw Ult range circle", SCRIPT_PARAM_ONOFF, true)
  107. end
  108.  
  109. function PluginOnLoad()
  110.     Menu()
  111.  
  112.     AutoCarry.SkillsCrosshair.range = QMaxRange
  113.  
  114.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  115.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end
  116.     for i=1, heroManager.iCount do waittxt[i] = i*3 end
  117. end
  118.  
  119. function PluginOnTick()
  120.     Target = AutoCarry.GetAttackTarget(true)
  121.  
  122.     SpellCheck()
  123.  
  124.     if tick == nil or GetTickCount()-tick >= 200 then
  125.         tick = GetTickCount()
  126.         CalculateDamage()
  127.     end
  128.  
  129.     if AutoCarry.PluginMenu.SatchelJump then
  130.         SatchelJump()
  131.     end
  132.  
  133.     if (AutoCarry.MainMenu.AutoCarry or AutoCarry.MainMenu.MixedMode) then
  134.         Combo()
  135.     end
  136.    
  137.     if AutoCarry.PluginMenu.FullCombo then
  138.         FullCombo()
  139.     end
  140.  
  141.     if AutoCarry.PluginMenu.Harass then
  142.         Harass()
  143.     end
  144.  
  145.     if AutoCarry.PluginMenu.Killsteal then
  146.         KillSteal()
  147.     end
  148. end
  149.  
  150. function PluginOnCreateObj(obj)
  151.     if obj.name == "ZiggsW_mis_ground.troy" then
  152.         satchelChargeExists = true
  153.         CastWActivate()
  154.     end
  155. end
  156.  
  157. function PluginOnDeleteObj(obj)
  158.     if obj.name == "ZiggsW_mis_ground.troy" then
  159.         satchelChargeExists = false
  160.         pendingSatchelChargeActivation = nil
  161.     end
  162. end
  163.  
  164. function OnAttacked()
  165.     -- AA > Q > AA
  166.     if AutoCarry.PluginMenu.AutoHarass then
  167.         CastQ()
  168.     end
  169. end
  170.  
  171. function SpellCheck()
  172.     DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3128),
  173.     GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057),
  174.     GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  175.  
  176.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  177.     WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
  178.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  179.     RReady = (myHero:CanUseSpell(SkillR.spellKey) == READY)
  180.  
  181.     DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  182.     HXGReady = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  183.     BWCReady = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  184.     IReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  185. end
  186.  
  187. -- Handle SBTW Skill Shots
  188.  
  189. function Combo()
  190.     CastSlots()
  191.     CastE()
  192.     CastQ()
  193.     if AutoCarry.PluginMenu.Ultimate and doUlt then
  194.         CastR()
  195.     end
  196. end
  197.  
  198. function FullCombo()
  199.     CastSlots()
  200.     CastE()
  201.     CastQ()
  202.     CastW()
  203.     CastWActivate()
  204.     if AutoCarry.PluginMenu.Ultimate and doUlt then
  205.         CastR()
  206.     end
  207. end
  208.  
  209. function CastSlots()
  210.     if Target ~= nil and not Target.dead then
  211.         if GetDistance(Target) <= QMaxRange then
  212.             if DFGReady then CastSpell(DFGSlot, Target) end
  213.             if HXGReady then CastSpell(HXGSlot, Target) end
  214.             if BWCReady then CastSpell(BWCSlot, Target) end
  215.         end
  216.     end
  217. end
  218.  
  219. function Harass()
  220.     CastQ()
  221. end
  222.  
  223. function CastQ()
  224.     if Target ~= nil and not Target.dead then
  225.         if QReady and ValidTarget(Target, QRange) then
  226.             AutoCarry.CastSkillshot(SkillQ, Target)
  227.         elseif QReady and ValidTarget(Target, QMaxRange) then
  228.             -- Full Bouncing Bomb three bounce range
  229.             local PredictedPos = AutoCarry.GetPrediction(SkillQ, Target)
  230.  
  231.             if PredictedPos and AutoCarry.IsValidHitChance(SkillQ, Target) then
  232.                 local MyPos = Vector(myHero.x, myHero.y, myHero.z)
  233.                 local EnemyPos = Vector(PredictedPos.x, PredictedPos.y, PredictedPos.z)
  234.                 local CastPos = MyPos - (MyPos - EnemyPos):normalized() * QRange
  235.                 if CastPos then CastSpell(SkillQ.spellKey, CastPos.x, CastPos.z) end
  236.             end
  237.         end
  238.     end
  239. end
  240.  
  241. function CastW(noTarget)
  242.     if noTarget and WReady then
  243.         AutoCarry.CastSkillshot(SkillW, myHero)
  244.     elseif Target ~= nil and ValidTarget(Target, WRange) and not Target.dead then
  245.         if WReady and GetDistance(Target) <= WRange then
  246.             AutoCarry.CastSkillshot(SkillW, Target)
  247.         end
  248.     end
  249. end
  250.  
  251. function CastWActivate()
  252.     if satchelChargeExists and pendingSatchelChargeActivation ~= nil then
  253.         if pendingSatchelChargeActivation == "satcheljump" then
  254.             local delayTime = 75
  255.             local endClockTime = GetTickCount() + delayTime
  256.             while (GetTickCount() < endClockTime) do
  257.                 -- Sleep
  258.             end
  259.  
  260.             CastSpell(SkillW.spellKey)
  261.             CastE()
  262.             pendingSatchelChargeActivation = nil
  263.         end
  264.     end
  265. end
  266.  
  267. function CastE()
  268.     if Target ~= nil and ValidTarget(Target, ERange) and not Target.dead then
  269.         if EReady and GetDistance(Target) <= ERange then
  270.             AutoCarry.CastSkillshot(SkillE, Target)
  271.         end
  272.     end
  273. end
  274.  
  275. function CastR()
  276.     if Target ~= nil and ValidTarget(Target, RRange) and not Target.dead then
  277.         if RReady and GetDistance(Target) <= RRange then
  278.             AutoCarry.CastSkillshot(SkillR, Target)
  279.         end
  280.     end
  281. end
  282.  
  283. function KillSteal()
  284.     for _, enemy in pairs(AutoCarry.EnemyTable) do
  285.         if ValidTarget(enemy, RRange) and not enemy.dead then
  286.             if (enemy.health + 20) < getDmg("R", enemy, myHero) and IsValidHitChanceCustom(SkillR, enemy) then
  287.                 if RReady then
  288.                     Message.AddMessage("Killsteal!", ColorARGB.Green, myHero)
  289.                     if debugMode then PrintChat("Killsteal") end
  290.                     AutoCarry.CastSkillshot(SkillR, enemy)
  291.                 end
  292.             end
  293.         end
  294.     end
  295. end
  296.  
  297. function SatchelJump()
  298.     -- E is cast before and after jump to insure that a target near either location can be hit.
  299.     pendingSatchelChargeActivation = "satcheljump"
  300.     CastW(true)
  301.     CastE()
  302. end
  303.  
  304. -- Sliding scale hitchance based on target distance.
  305. function getScalingHitChanceFromDistance(SkillRange, Target)
  306.     local minHitChance = AutoCarry.PluginMenu.KillstealMinHitchance
  307.     local maxHitChance = 95
  308.  
  309.     hitChance = minHitChance + ((1 - (SkillRange - GetDistance(Target)) / (SkillRange - 0))) * (maxHitChance - minHitChance)
  310.     if debugMode then PrintChat("HitChance Info: skillrange="..SkillRange..", targetdistance="..GetDistance(Target)..", hitchance:"..hitChance) end
  311.     return hitChance
  312. end
  313.  
  314. function IsValidHitChanceCustom(skill, target)
  315.     if VIP_USER then
  316.         pred = TargetPredictionVIP(skill.range, skill.speed*1000, skill.delay/1000, skill.width)
  317.         return pred:GetHitChance(target) > getScalingHitChanceFromDistance(skill.range, target)/100 and true or false
  318.     elseif not VIP_USER then
  319.         local nonVIPMaxHitChance = 70
  320.         return getScalingHitChanceFromDistance(skill.range, target) < nonVIPMaxHitChance and true or false
  321.     end
  322. end
  323.  
  324. --[[
  325. function satchelChargeExistsDelete()
  326.     for i=1, objManager.maxObjects do
  327.         local obj = objManager:getObject(i)
  328.  
  329.         if obj ~= nil and obj.name:find("Satchel Charge") then
  330.             return true
  331.         end
  332.     end
  333.     return false
  334. end
  335. --]]
  336.  
  337. -- Handle Manual Skill Shots
  338.  
  339. function PluginOnWndMsg(msg,key)
  340.     Target = AutoCarry.GetAttackTarget()
  341.     if Target ~= nil then
  342.         if msg == KEY_DOWN and key == KeyQ then CastQ() end
  343.         if msg == KEY_DOWN and key == KeyW then CastW() end
  344.         if msg == KEY_DOWN and key == KeyE then CastE() end
  345.         if msg == KEY_DOWN and key == KeyR then CastR() end
  346.     end
  347. end
  348.  
  349. -- Drawing
  350.  
  351. function PluginOnDraw()
  352.     if AutoCarry.PluginMenu.Draw then
  353.         DrawCircle(myHero.x, myHero.y, myHero.z, AutoCarry.SkillsCrosshair.range, 0x808080) -- Gray
  354.  
  355.         if myHero:CanUseSpell(SkillQ.spellKey) then
  356.             DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0x0099CC) -- Blue
  357.         end
  358.        
  359.         if myHero:CanUseSpell(SkillW.spellKey) then
  360.             DrawCircle(myHero.x, myHero.y, myHero.z, WRange, 0xFFFF00) -- Yellow
  361.         end
  362.        
  363.         if myHero:CanUseSpell(SkillE.spellKey) then
  364.             DrawCircle(myHero.x, myHero.y, myHero.z, ERange, 0x00FF00) -- Green
  365.         end
  366.  
  367.         if AutoCarry.PluginMenu.DrawUlt then
  368.             if myHero:CanUseSpell(SkillR.spellKey) then
  369.                 DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000) -- Red
  370.             end
  371.         end
  372.  
  373.         Target = AutoCarry.GetAttackTarget()
  374.         if Target ~= nil then
  375.             for j=0, 10 do
  376.                 DrawCircle(Target.x, Target.y, Target.z, 40 + j*1.5, 0x00FF00) -- Green
  377.             end
  378.         end
  379.     end
  380.    
  381.     DrawKillable()
  382. end
  383.  
  384. function CalculateDamage()
  385.         if ValidTarget(Target) then
  386.                 local dfgdamage, hxgdamage, bwcdamage, ignitedamage, Sheendamage, Trinitydamage, LichBanedamage  = 0, 0, 0, 0, 0, 0, 0
  387.                 local pdamage = getDmg("P",Target,myHero)
  388.                 local qdamage = getDmg("Q",Target,myHero)
  389.                 local wdamage = getDmg("W",Target,myHero)
  390.                 local edamage = getDmg("E",Target,myHero)
  391.                 local rdamage = getDmg("R",Target,myHero)
  392.                 local hitdamage = getDmg("AD",Target,myHero)
  393.                 local dfgdamage = (DFGSlot and getDmg("DFG",Target,myHero) or 0)
  394.                 local hxgdamage = (HXGSlot and getDmg("HXG",Target,myHero) or 0)
  395.                 local bwcdamage = (BWCSlot and getDmg("BWC",Target,myHero) or 0)
  396.                 local ignitedamage = (ignite and getDmg("IGNITE",Target,myHero) or 0)
  397.                 local Sheendamage = (SheenSlot and getDmg("SHEEN",Target,myHero) or 0)
  398.                 local Trinitydamage = (TrinitySlot and getDmg("TRINITY",Target,myHero) or 0)
  399.                 local LichBanedamage = (LichBaneSlot and getDmg("LICHBANE",Target,myHero) or 0)
  400.                 local combo1 = hitdamage + qdamage + wdamage + edamage + rdamage + Sheendamage + Trinitydamage + LichBanedamage --0 cd
  401.                 local combo2 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  402.                 local combo3 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  403.                 local combo4 = 0
  404.                
  405.                 if QREADY then
  406.                         combo2 = combo2 + qdamage
  407.                         combo3 = combo3 + qdamage
  408.                         --combo4 = combo4 + qdamage
  409.                 end
  410.                 if WREADY then
  411.                         combo2 = combo2 + wdamage
  412.                         combo3 = combo3 + wdamage
  413.                 end
  414.                 if EREADY then
  415.                         combo2 = combo2 + edamage
  416.                         combo3 = combo3 + edamage
  417.                         --combo4 = combo4 + edamage
  418.                 end
  419.                 if RREADY then
  420.                         combo2 = combo2 + rdamage
  421.                         combo3 = combo3 + rdamage
  422.                         combo4 = combo4 + rdamage
  423.                 end
  424.                 if DFGREADY then        
  425.                         combo1 = combo1 + dfgdamage            
  426.                         combo2 = combo2 + dfgdamage
  427.                         combo3 = combo3 + dfgdamage
  428.                         --combo4 = combo4 + dfgdamage
  429.                 end
  430.                 if HXGREADY then              
  431.                         combo1 = combo1 + hxgdamage    
  432.                         combo2 = combo2 + hxgdamage
  433.                         combo3 = combo3 + hxgdamage
  434.                         --combo4 = combo4 + hxgdamage
  435.                 end
  436.                 if BWCREADY then
  437.                         combo1 = combo1 + bwcdamage
  438.                         combo2 = combo2 + bwcdamage
  439.                         combo3 = combo3 + bwcdamage
  440.                         combo4 = combo4 + bwcdamage
  441.                 end
  442.                 if IREADY then
  443.                         combo1 = combo1 + ignitedamage
  444.                         combo2 = combo2 + ignitedamage
  445.                         combo3 = combo3 + ignitedamage
  446.                 end
  447.                 if combo4 >= Target.health then killable[calculationenemy] = 4 doUlt = true
  448.                 elseif combo3 >= Target.health then killable[calculationenemy] = 3 doUlt = false
  449.                 elseif combo2 >= Target.health then killable[calculationenemy] = 2 doUlt = false
  450.                 elseif combo1 >= Target.health then killable[calculationenemy] = 1  doCombo = true doUlt = false
  451.                 else killable[calculationenemy] = 0 doCombo = false doUlt = false end
  452.         end
  453.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  454.         else calculationenemy = calculationenemy-1 end
  455. end
  456.  
  457. function DrawKillable()
  458.     if 1 == 2 and Target ~= nil and AutoCarry.PluginMenu.DrawPrediction then
  459.         if VIP_USER then
  460.             pred = TargetPredictionVIP(SkillQ.range, SkillQ.speed*1000, SkillQ.delay/1000, SkillQ.width)
  461.         elseif not VIP_USER then
  462.             pred = TargetPrediction(SkillQ.range, SkillQ.speed, SkillQ.delay, SkillQ.width)
  463.         end
  464.         predPos = pred:GetPrediction(Target)
  465.         DrawCircle(predPos.x, Target.y, predPos.z, 200, 0x0000FF)
  466.     end
  467.     for i=1, heroManager.iCount do
  468.         local enemydraw = heroManager:GetHero(i)
  469.         if ValidTarget(enemydraw) then
  470.             if AutoCarry.PluginMenu.DrawKillablEenemy then
  471.                 if killable[i] == 1 then
  472.                     for j=0, 20 do
  473.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  474.                     end
  475.                 elseif killable[i] == 2 then
  476.                     for j=0, 10 do
  477.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  478.                     end
  479.                 elseif killable[i] == 3 then
  480.                     for j=0, 10 do
  481.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  482.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  483.                     end
  484.                 elseif killable[i] == 4 then
  485.                     for j=0, 10 do
  486.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  487.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  488.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  489.                     end
  490.                 end
  491.             end
  492.             if AutoCarry.PluginMenu.DrawText and waittxt ~= nil and waittxt[i] == 1 and killable ~= nil and killable[i] ~= 0 then
  493.                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  494.             end
  495.         end
  496.         if waittxt ~= nil then
  497.             if waittxt[i] == 1 then waittxt[i] = 30
  498.             else waittxt[i] = waittxt[i]-1 end
  499.         end
  500.     end
  501. end
  502.  
  503. class 'ColorARGB' -- {
  504.  
  505.     function ColorARGB:__init(red, green, blue, alpha)
  506.         self.R = red or 255
  507.         self.G = green or 255
  508.         self.B = blue or 255
  509.         self.A = alpha or 255
  510.     end
  511.  
  512.     function ColorARGB.FromArgb(red, green, blue, alpha)
  513.         return Color(red,green,blue, alpha)
  514.     end
  515.  
  516.     function ColorARGB:ToARGB()
  517.         return ARGB(self.A, self.R, self.G, self.B)
  518.     end
  519.  
  520.     ColorARGB.Red = ColorARGB(255, 0, 0, 255)
  521.     ColorARGB.Yellow = ColorARGB(255, 255, 0, 255)
  522.     ColorARGB.Green = ColorARGB(0, 255, 0, 255)
  523.     ColorARGB.Aqua = ColorARGB(0, 255, 255, 255)
  524.     ColorARGB.Blue = ColorARGB(0, 0, 255, 255)
  525.     ColorARGB.Fuchsia = ColorARGB(255, 0, 255, 255)
  526.     ColorARGB.Black = ColorARGB(0, 0, 0, 255)
  527.     ColorARGB.White = ColorARGB(255, 255, 255, 255)
  528. -- }
  529.  
  530. --Notification class
  531. class 'Message' -- {
  532.  
  533.     Message.instance = ""
  534.  
  535.     function Message:__init()
  536.         self.notifys = {}
  537.  
  538.         AddDrawCallback(function(obj) self:OnDraw() end)
  539.     end
  540.  
  541.     function Message.Instance()
  542.         if Message.instance == "" then Message.instance = Message() end return Message.instance
  543.     end
  544.  
  545.     function Message.AddMessage(text, color, target)
  546.         return Message.Instance():PAddMessage(text, color, target)
  547.     end
  548.  
  549.     function Message:PAddMessage(text, color, target)
  550.         local x = 0
  551.         local y = 200
  552.         local tempName = "Screen"
  553.         local tempcolor = color or ColorARGB.Red
  554.  
  555.         if target then  
  556.             tempName = target.networkID
  557.         end
  558.  
  559.         self.notifys[tempName] = { text = text, color = tempcolor, duration = GetGameTimer() + 2, object = target}
  560.     end
  561.  
  562.     function Message:OnDraw()
  563.         for i, notify in pairs(self.notifys) do
  564.             if notify.duration < GetGameTimer() then notify = nil
  565.             else
  566.                 notify.color.A = math.floor((255/2)*(notify.duration - GetGameTimer()))
  567.  
  568.                 if i == "Screen" then  
  569.                     local x = 0
  570.                     local y = 200
  571.                     local gameSettings = GetGameSettings()
  572.                     if gameSettings and gameSettings.General then
  573.                         if gameSettings.General.Width then x = gameSettings.General.Width/2 end
  574.                         if gameSettings.General.Height then y = gameSettings.General.Height/4 - 100 end
  575.                     end  
  576.                     --PrintChat(tostring(notify.color))
  577.                     local p = GetTextArea(notify.text, 40).x
  578.                     self:DrawTextWithBorder(notify.text, 40, x - p/2, y, notify.color:ToARGB(), ARGB(notify.color.A, 0, 0, 0))
  579.                 else    
  580.                     local pos = WorldToScreen(D3DXVECTOR3(notify.object.x, notify.object.y, notify.object.z))
  581.                     local x = pos.x
  582.                     local y = pos.y - 25
  583.                     local p = GetTextArea(notify.text, 40).x
  584.  
  585.                     self:DrawTextWithBorder(notify.text, 30, x- p/2, y, notify.color:ToARGB(), ARGB(notify.color.A, 0, 0, 0))
  586.                 end
  587.             end
  588.         end
  589.     end
  590.  
  591.     function Message:DrawTextWithBorder(textToDraw, textSize, x, y, textColor, backgroundColor)
  592.         DrawText(textToDraw, textSize, x + 1, y, backgroundColor)
  593.         DrawText(textToDraw, textSize, x - 1, y, backgroundColor)
  594.         DrawText(textToDraw, textSize, x, y - 1, backgroundColor)
  595.         DrawText(textToDraw, textSize, x, y + 1, backgroundColor)
  596.         DrawText(textToDraw, textSize, x , y, textColor)
  597.     end
  598. -- }
Advertisement
Add Comment
Please, Sign In to add comment