local t = {
cfg = {
[1] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
[2] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
[3] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 },
[4] = { pos = { x = 100, y = 100, z = 7}, itemid = 2500 }
},
destination = { x = 100, y = 100, z = 7 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
for _, v in ipairs(t.cfg) do
if getTileItemById(v.pos, v.itemid).uid < 1 then
return TRUE, doPlayerSendCancel(cid, "Wrong items.")
end
end
for _, v in ipairs(t.cfg) do
doRemoveItem(getTileItemById(v.pos, v.itemid).uid)
end
doTeleportThing(cid, t.destination)
doSendMagicEffect(t.destination, CONST_ME_TELEPORT)
doTransformItem(item.uid, 1946)
elseif item.itemid == 1946 then
doTransformItem(item.uid, 1945)
end
return TRUE
end