Advertisement
jangeldev

Anti Anti-Push Bot 1.1+

Dec 8th, 2015
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local maxItemsPerSecond = 2
  2. local stor = 19191
  3. local exhaust = 6
  4. local cont = false
  5. local start = 0
  6. local items = 0
  7.  
  8. function Player:onMoveItem(item, count, fromPosition, toPosition)
  9.     local tile = toPosition:getTile()
  10.     if tile then
  11.         if (tile:getTopCreature()) then
  12.             local p = Player(tile:getTopCreature():getId())
  13.  
  14.             if (p) then
  15.                 if (start == 0) then
  16.                     start = os.time()
  17.                 elseif (start == os.time()) then
  18.                     items = items + 1
  19.                 elseif(os.time() > start) then
  20.                     start = 0
  21.                     items = 0
  22.                 end
  23.  
  24.                 if (items > maxItemsPerSecond) then
  25.                     self:setStorageValue(stor, os.time() + exhaust)
  26.                 end
  27.  
  28.                 if (self:getStorageValue(stor) > os.time()) then
  29.                     self:sendCancelMessage("You can't do that so fast.")
  30.                     return false
  31.                 end
  32.             end
  33.         end
  34.     end
  35.     return true
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement