Ir para conteúdo

Featured Replies

Postado

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.

  • Respostas 5
  • Visualizações 947
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • 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, stackp

Postado

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
  • 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

@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  

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo