walls = {wallid, wallid bla bla bla}
pos = 0
if getPlayerDir(cid) == NORTH then
pos = getCreaturePosition(cid).y + 2
elseif getPlayerDir(cid) == SOUTH then
pos = getCreaturePosition(cid).y - 2
elseif getPlayerDir(cid) == EAST then
pos = getCreaturePosition(cid).x + 2
elseif getPlayerDir(cid) == WEST then
pos = getCreaturePosition(cid).x - 2
end
if isInArray(walls, getThingfromPos(pos)) == FALSE then
doTeleportThing(cid, pos, 0)
else
doPlayerSendTextMessage(cid, 22, "You cant teleport there.")
end