Advertisement
alexdubovyck

Если неудача то таблицей скастовать

Mar 13th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. table_spell_1 = { }
  2. print(#table_spell_1)
  3. --[[---------------------------------------------
  4. OnEvent
  5. ]]-----------------------------------------------
  6. local f = CreateFrame("Frame")
  7. f:RegisterEvent("UNIT_SPELLCAST_FAILED"); --2
  8. f:SetScript("OnEvent", function(self, event, ...)
  9. local arg = {...}
  10. if event == "UNIT_SPELLCAST_FAILED"
  11. and arg[1] == "player"
  12. and arg[2] ~= ""
  13. then
  14. table.insert(table_spell_1, arg[2])
  15. print(arg[2])
  16. print(#table_spell_1)
  17. print(#table_spell_1[1])
  18. print(#table_spell_1[2])
  19. -- wipe(table_spell_1)
  20. end
  21. end)
  22. --[[---------------------------------------------
  23. OnUpdate
  24. ]]-----------------------------------------------
  25. f:SetScript("OnUpdate", function()
  26. if #table_spell_1 >= 1 then
  27. CastSpellByName(table_spell_1[1])
  28. -- Cast(table_spell_1[1])
  29. -- wipe(table_spell_1)
  30. -- table.remove(table_spell_1, arg[2])
  31. end
  32. if #table_spell_1 >= 4 then
  33. table.remove(table_spell_1, 1)
  34. -- wipe(table_spell_1)
  35. end
  36. end)
  37.  
  38. local f = CreateFrame("Frame")
  39. f:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED");
  40. f:SetScript("OnEvent", function(self, event, ...)
  41. local arg = {...}
  42. if event == "UNIT_SPELLCAST_SUCCEEDED"
  43. and arg[1] == "player"
  44. and arg[2] == table_spell_1[1]
  45. then
  46. print("true")
  47. table.remove(table_spell_1, 1)
  48. wipe(table_spell_1)
  49. -- table.remove(table_spell_1, 1)
  50. -- table.insert(table_spell_1, arg[2])
  51. -- print(arg[2])
  52. -- print(#table_spell_1)
  53. -- wipe(table_spell_1)
  54. end
  55. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement