function isWalkable(pos) --found: posted by Cyko
pos.stackpos = 0
local tile = getThingfromPos(pos, false)
if tile ~= 0 and not hasProperty(tile.uid, CONST_PROP_BLOCKSOLID) and not isCreature(getTopCreature(pos).uid) then
return true
end
end
local area = {
from = {x=1012,y=1017,z=7},
to = {x=1027,y=1029,z=7}
}
function onStepIn(cid, item, position, fromPosition)
for x = area.from.x, area.to.x do
for y = area.from.y, area.to.y do
local p = {x=x,y=y,z=area.from.z}
if isWalkable(p) then
return doTeleportThing(cid, p) and doSendMagicEffect(getThingPos(cid), 10) and doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You were brought to a free training spot.")
end
end
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "There is no free training spot at the moment.")
return true
end