local teleports = {
-- uid = {position={}, level=x, effect=x}
[5548] = { -- Depot to Shops
position = {x= 1279, y=1026, z=7}, --- th eplace where the item with this unique id will send players to
level = 1, -- make it 1 if you want like all lvs to eneter
effect = 47, -- remove this line to ignore effect
group = 1 -- set to 1 if you want all kinds of player use the tp ( check groups numbers in group.xml)
},
[5549] = { --Shops to Depot
position = {x= 1033, y=1025, z=7},
level = 1,
effect = 47,
group = 1
},
}
function onStepIn(cid, item, position, fromPosition)
-- get table with attributes from 'teleports' table by unique id
local options = teleports[item.uid]
if(not options) then -- check if positions exists (this is not really required - just in case you declare something wrong in movements.xml)
return TRUE -- just exit script, it won't continue executing
end
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
if(getPlayerLevel(cid) < options.level) then -- check if player have level
doPlayerSendCancel(cid, "Sorry, your level is to low for this teleport.")
doMoveCreature(cid, newdir)
return TRUE
end
if(getPlayerGroupId(cid) < options.group) then -- check if player have level
doPlayerSendCancel(cid, "Sorry, your group is to low for this teleport.")
doMoveCreature(cid, newdir)
return TRUE
end
doTeleportThing(cid, options.position) -- teleport player to dest
if(options.effect) then -- check if effect is specified
doSendMagicEffect(getCreaturePosition(cid), options.effect)
end
return TRUE
end