local cost = 10
local t = {
[lever1UID] = {
tile = {x=100, y=100, z=7},
destination = {x=100, y=100, z=7}
},
[lever2UID] = {
tile = {x=100, y=100, z=7},
destination = {x=100, y=100, z=7}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1946 then return doTransformItem(item.uid, 1945) end
local i = t[item.uid]
local v = getTopCreature(i.tile).uid
if isPlayer(v) then
if doPlayerRemoveMoney(v, cost) then
doTeleportThing(v, i.destination)
doSendMagicEffect(i.tile, CONST_ME_TELEPORT)
doSendMagicEffect(i.destination, CONST_ME_TELEPORT)
doTransformItem(item.uid, 1946)
else
doCreatureSay(cid, 'The player doesn\'t have ' .. cost .. ' gold.', TALKTYPE_ORANGE_1, false, cid)
end
else
doCreatureSay(cid, 'Player not found.', TALKTYPE_ORANGE_1, false, cid)
end
return true
end