Forgee_XenoBot

AntiPush

Aug 5th, 2012
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.69 KB | None | 0 0
  1. local trash = {3031, 3492} -- You can add more items if you want
  2.  
  3. dofile("Forgee.lua")
  4.  
  5. function onSpeak(c, msg)
  6.     c:SendYellowMessage(Self.Name(), msg)
  7.     if msg:lower() == "help" then
  8.         c:SendOrangeMessage("AntiPush", "Type 'start' to activate or 'stop' to deactivate.\nTip: bind those words to an autosend hotkey.")
  9.     elseif msg:lower() == "start" then
  10.         active = true
  11.         c:SendOrangeMessage("AntiPush", "AntiPush has been activated!")
  12.     elseif msg:lower() == "stop" then
  13.         active = false
  14.         c:SendOrangeMessage("AntiPush", "AntiPush has been stopped!")
  15.     end
  16. end
  17.  
  18. function onClose(c, msg) end
  19.  
  20. local c = Channel.Open("AntiPush", onSpeak, onClose)
  21.  
  22. function antiPush(top, ...)
  23.     local trash = {...}
  24.     local top = top or 0
  25.     local item = Map.GetTopMoveItem(Self.Position().x, Self.Position().y, Self.Position().z)
  26.     if item.id ~= top then
  27.         if table.contains(trash, item.id) then
  28.             for i = 1, #trash do
  29.                 if item.id ~= trash[i] then
  30.                     spot, container = getSpotByID(trash[i])
  31.                     if spot then
  32.                         container:MoveItemToGround(spot, Self.Position().x, Self.Position().y, Self.Position().z, 2)
  33.                         return trash[i]
  34.                     end
  35.                 end
  36.             end
  37.         else
  38.             local count = 0
  39.             for i = 1, #trash do
  40.                 spot, container = getSpotByID(trash[i])
  41.                 if spot then
  42.                     container:MoveItemToGround(spot, Self.Position().x, Self.Position().y, Self.Position().z, 2)
  43.                     count = count + 1
  44.                     top = trash[i]
  45.                     if count >= 2 then
  46.                         break
  47.                     end
  48.                 end
  49.                 wait(300, 500)
  50.             end
  51.             return top
  52.         end
  53.     else
  54.         return top
  55.     end
  56. end
  57.  
  58. registerEventListener(TIMER_TICK, "onTimerTick")
  59.  
  60. function onTimerTick()
  61.     if active then
  62.         top = antiPush(top, unpack(trash))
  63.     end
  64.     wait(100, 300)
  65. end
Advertisement
Add Comment
Please, Sign In to add comment