Postado Maio 30, 2018 7 anos Olá, preciso de uma spell tipo o comando "/a" ao usar essa spell o player pula de 1 a 10 sqm na direção que ele estiver olhando e que se tiver alguma coisa tipo uma house ou uma parede ele não consiga usar pra evitar de alguma forma que ele entre em houses de outros players, paredes, águas e etc. obs: ele pula 10 sqm de vez, ele não pode configurar quantos sqm quer que pule.
Postado Maio 30, 2018 7 anos Bom , acho que vai ficar apelão um servidor com esse comando , mas ok local 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 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 onCastSpell(cid, var) local a = {x = getCreaturePosition(cid).x, y = getCreaturePosition(cid).y - 10, z = getCreaturePosition(cid).z} -- North local b = {x = getCreaturePosition(cid).x, y = getCreaturePosition(cid).y + 10, z = getCreaturePosition(cid).z} -- South local c = {x = getCreaturePosition(cid).x - 10, y = getCreaturePosition(cid).y, z = getCreaturePosition(cid).z} -- West local d = {x = getCreaturePosition(cid).x + 10, y = getCreaturePosition(cid).y, z = getCreaturePosition(cid).z} -- East if getCreatureLookDirection(cid) == NORTH then if isWalkable(a, false, false, false) and not getHouseFromPos(a) then return doTeleportThing(cid, a) else doPlayerSendTextMessage(cid, 27, "A posição onde você quer ir não é andavel") return doSendMagicEffect(getCreaturePosition(cid), 2) end elseif getCreatureLookDirection(cid) == SOUTH then if isWalkable(b, false, false, false) and not getHouseFromPos(b) then return doTeleportThing(cid, b) else doPlayerSendTextMessage(cid, 27, "A posição onde você quer ir não é andavel") return doSendMagicEffect(getCreaturePosition(cid), 2) end elseif getCreatureLookDirection(cid) == EAST then if isWalkable(d, false, false, false) and not getHouseFromPos(d) then return doTeleportThing(cid, d) else doPlayerSendTextMessage(cid, 27, "A posição onde você quer ir não é andavel") return doSendMagicEffect(getCreaturePosition(cid), 2) end elseif getCreatureLookDirection(cid) == WEST then if isWalkable(c, false, false, false) and not getHouseFromPos(c) then return doTeleportThing(cid, c) else doPlayerSendTextMessage(cid, 27, "A posição onde você quer ir não é andavel") return doSendMagicEffect(getCreaturePosition(cid), 2) end end end
Postado Maio 30, 2018 7 anos Autor @Sttorm funcionou corretamente +rep agora só pra finalizar, teria como colocar pra não ser possivel teleportar onde tem protect zone, pvp, house e eu queria tb um effect ao usar a spell e outro onde o player acabou de teleportar
Postado Maio 30, 2018 7 anos @TrafalgarLaw local 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 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 onCastSpell(cid, var) local effect = 13 -- Efeito ao teleportar local a = {x = getCreaturePosition(cid).x, y = getCreaturePosition(cid).y - 10, z = getCreaturePosition(cid).z} -- North local b = {x = getCreaturePosition(cid).x, y = getCreaturePosition(cid).y + 10, z = getCreaturePosition(cid).z} -- South local c = {x = getCreaturePosition(cid).x - 10, y = getCreaturePosition(cid).y, z = getCreaturePosition(cid).z} -- West local d = {x = getCreaturePosition(cid).x + 10, y = getCreaturePosition(cid).y, z = getCreaturePosition(cid).z} -- East local pos = getCreaturePosition(cid) if getCreatureLookDirection(cid) == NORTH then if isWalkable(a, true, true, true) and not getHouseFromPos(a) then doSendMagicEffect(pos, effect) doSendMagicEffect(a, effect) return doTeleportThing(cid, a) else doPlayerSendTextMessage(cid, 27, "A posição onde você quer ir não é andavel") return doSendMagicEffect(getCreaturePosition(cid), 2) end elseif getCreatureLookDirection(cid) == SOUTH then if isWalkable(b, true, true, true) and not getHouseFromPos(b) then doSendMagicEffect(pos, effect) doSendMagicEffect(b, effect) return doTeleportThing(cid, b) else doPlayerSendTextMessage(cid, 27, "A posição onde você quer ir não é andavel") return doSendMagicEffect(getCreaturePosition(cid), 2) end elseif getCreatureLookDirection(cid) == EAST then if isWalkable(d, true, true, true) and not getHouseFromPos(d) then doSendMagicEffect(pos, effect) doSendMagicEffect(b, effect) return doTeleportThing(cid, d) else doPlayerSendTextMessage(cid, 27, "A posição onde você quer ir não é andavel") return doSendMagicEffect(getCreaturePosition(cid), 2) end elseif getCreatureLookDirection(cid) == WEST then if isWalkable(c, true, true, true) and not getHouseFromPos(c) then doSendMagicEffect(pos, effect) doSendMagicEffect(b, effect) return doTeleportThing(cid, c) else doPlayerSendTextMessage(cid, 27, "A posição onde você quer ir não é andavel") return doSendMagicEffect(getCreaturePosition(cid), 2) end end end
Postado Maio 31, 2018 7 anos Autor @Sttorm funcionou corretamente, apenas o effect que não está saindo
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.