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
cr = getThingFromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = STACKPOS_TOP_CREATURE})
if isPlayer(cr.uid) or isMonster(cr.uid) then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 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 onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = fromPosition
local aqui = getPlayerPosition(cid)
local vocs = {300, 301, 303, 304, 305, 306, 307, 308, 309}
local agua = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}
if getDistanceBetween(aqui, toPosition) >= 10 then
return doPlayerSendTextMessage(cid, 27, "This is soo far.")
elseif(not(isSightClear(aqui, toPosition, 1))) then
return doPlayerSendTextMessage(cid, 27, "This is impossible.")
elseif(getTilePzInfo(aqui)) then
return doPlayerSendCancel(cid, "voce nao pode usar quando estiver em protect zone.")
elseif(getTilePzInfo(toPosition)) then
return doPlayerSendCancel(cid, "voce nao pode entra em protec zone.")
elseif(isInArray(agua, itemEx.itemid)) then
return doPlayerSendTextMessage(cid, 27, "voce nao pode usar em agua")
elseif((getTileHouseInfo(toPosition))) then
return doPlayerSendCancel(cid, "You can't enter in a house.")
elseif(not(isInArray(vocs, getPlayerVocation(cid)))) then
return doPlayerSendTextMessage(cid, 27, "Sorry, your vocation don't use it.")
elseif not isWalkable(toPosition) then
return doPlayerSendTextMessage(cid, 27, "Voce nao pode usar aqui.")
end
if(doTeleportThing(cid, toPosition, false)) then
doSendMagicEffect(pos, 134)
doSendMagicEffect(toPosition, 131)
return doSendDistanceShoot(pos, toPosition, 134)
end
return doPlayerSendCancel(cid, "Sorry, not possible.")
end
Tenta esse aqui.






info
Grupo: Infante
Registrado: 27/01/13
Posts: 1.7k
Reputação: +104
Gênero: Masculino
Tem como alguem colocar para nao ir nas paredes
function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = fromPosition local aqui = getPlayerPosition(cid) local vocs = {300, 301, 303, 304, 305, 306, 307, 308, 309} local agua = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825} if getDistanceBetween(aqui, toPosition) >= 10 then return doPlayerSendTextMessage(cid, 27, "This is soo far.") elseif(not(isSightClear(aqui, toPosition, 1))) then return doPlayerSendTextMessage(cid, 27, "This is impossible.") elseif(getTilePzInfo(aqui)) then return doPlayerSendCancel(cid, "voce nao pode usar quando estiver em protect zone.") elseif(getTilePzInfo(toPosition)) then return doPlayerSendCancel(cid, "voce nao pode entra em protec zone.") elseif(isInArray(agua, itemEx.itemid)) then return doPlayerSendTextMessage(cid, 27, "voce nao pode usar em agua") elseif((getTileHouseInfo(toPosition))) then return doPlayerSendCancel(cid, "You can't enter in a house.") elseif(not(isInArray(vocs, getPlayerVocation(cid)))) then return doPlayerSendTextMessage(cid, 27, "Sorry, your vocation don't use it.") end if(doTeleportThing(cid, toPosition, false)) then doSendMagicEffect(pos, 134) doSendMagicEffect(toPosition, 131) return doSendDistanceShoot(pos, toPosition, 134) end return doPlayerSendCancel(cid, "Sorry, not possible.") end