local times = 3 --Quantos SQMs o jogador irá se mover.
function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 2 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
function onCastSpell(cid)
local playerPos = getThingPos(cid)
for i = 1, times do
playerPos:getNextPosition(getCreatureLookDirection(cid))
if not isWalkable(playerPos, i == times, i == times, i == times) then
doPlayerSendCancel(cid, "Sorry, destination not possible.")
return false
end
end
doTeleportThing(cid, playerPos)
return true
end







info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea
Erro em getPosByDir