local storage = 61894
local exhause_time = 500 -- in milli seconds
local function resetStorage(cid)
if isPlayer(cid) then
setPlayerStorageValue(cid, storage, 0)
end
end
local function doExhaust(cid)
-- exhaust divided by 1000 can be 0 (500 / 1000 = 0), but in onMoveItem(..) we check if time is >= os.time()
setPlayerStorageValue(cid,storage,os.time()+(exhause_time / 1000))
-- so if 'event' does not execute, it won't be a problem (just block for 1 second [not 0.5 sec] IF you relog)
addEvent(resetStorage, exhause_time, cid)
end
function onMoveItem(cid, item, fromPosition, toPosition, fromItem, toItem, fromGround, toGround, status)
-- and here we check time, not 1/0 value
if getPlayerStorageValue(cid,storage) >= os.time() then
doPlayerSendCancel(cid, "You cannot move objects that fast.")
return false
end
doExhaust(cid)
if (getTileInfo(fromPosition).house) then
doPlayerSave(cid)
doSaveHouse(getHouseFromPos(fromPosition))
elseif (getTileInfo(toPosition).house) then
doPlayerSave(cid)
doSaveHouse(getHouseFromPos(toPosition))
end
return true
end