local cityPos = Position(XXXX, YYYY, Z)
local storages = {
['x'] = 15000,
['y'] = 15001,
['z'] = 15002
}
local function telePosition(cid, p, aid)
local player = Player(cid)
if not player then
return false
end
local set = aid == storages.x and true or false
local method = set and setStorageValue or getStorageValue
local newPos = {x = 0, y = 0, z = 0}
for i, value in pairs(storages) do
newPos[i] = player:method(value, p[i])
end
local destination = set and cityPos or newPos
player:teleportTo(destination, true)
destination:sendMagicEffect(CONST_ME_MAGIC_BLUE)
return true
end
function onStepIn(creature, item, position, fromPosition)
return telePosition(creature:getId(), position, item.actionid)
end