local item_required = 1111
local item_count = 1
local destination = Position(1000,1000,7)
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- check if lever is currently used
if item.itemid == 1946 then
player:say("Wait for switch to reset.",TALKTYPE_MONSTER_SAY)
return false
end
-- check if player has item
if not player:removeItem(item_required,item_count) then
player:say("You do not have the required item to use this lever.",TALKTYPE_MONSTER_SAY)
return false
end
-- remove item, transform lever, and add reset
player:teleportTo(destination,true)
item:transform(1946)
addEvent(function() item:transform(1945) end, 10 * 1000)
return true
end