local item_required = 9020
local item_count = 1
local destination = { x = 1473, y = 1046, z = 7 }
local function reset(pos)
doTransformItem(getTileItemById(pos, 1946).uid, 1945)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- check if lever is currently used
if item.itemid == 1946 then
return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset.")
end
-- check if player has item
if getPlayerItemCount(cid, item_required) < item_count then
return doPlayerSendTextMessage(cid, 22, "You do not have the required item to use this lever.")
end
-- remove item, transform lever, and add reset
doTeleportThing(cid, {x = 1473, y = 1046, z = 7})
doPlayerRemoveItem(cid, item_required, item_count)
doTransformItem(item.uid, item.itemid + 1)
addEvent(reset, 10 * 1000, toPosition)
return true
end