local function f(p)
doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
local teleport = {x=xxx, y=yyy, z=z}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
addEvent(f, 2000, fromPosition)
local v = getThingfromPos({x=xxx, y=yyy, z=z, stackpos=1})
if v.itemid == 2159 then
doRemoveItem(v.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, teleport)
doSendMagicEffect(teleport, CONST_ME_TELEPORT)
else
doCreatureSay(cid, 'You need a scarab coin to pass!', TALKTYPE_ORANGE_1, false, cid, fromPosition)
end
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
end
return true
end