Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local maxItemsPerSecond = 2
- local stor = 19191
- local exhaust = 6
- local cont = false
- local start = 0
- local items = 0
- function Player:onMoveItem(item, count, fromPosition, toPosition)
- local tile = toPosition:getTile()
- if tile then
- if (tile:getTopCreature()) then
- local p = Player(tile:getTopCreature():getId())
- if (p) then
- if (start == 0) then
- start = os.time()
- elseif (start == os.time()) then
- items = items + 1
- elseif(os.time() > start) then
- start = 0
- items = 0
- end
- if (items > maxItemsPerSecond) then
- self:setStorageValue(stor, os.time() + exhaust)
- end
- if (self:getStorageValue(stor) > os.time()) then
- self:sendCancelMessage("You can't do that so fast.")
- return false
- end
- end
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement