Ir para conteúdo

Featured Replies

Postado

Bom dia rapaziada, estou com um erro chato aqui e gostaria da ajuda de vocês para solucionar.

Toda vez que o pokémon utiliza a spell EarthQuake aparece vários erros na distro. Não consegui identificar oq pode ser;

 

Spoiler

Erro:

[27/06/2019 14:19:20] [Error - TalkAction Interface] 
[27/06/2019 14:19:20] In a timer event called from: 
[27/06/2019 14:19:20] data/talkactions/scripts/move1.lua:onSay
[27/06/2019 14:19:20] Description: 
[27/06/2019 14:19:21] data/lib/some functions.lua:524: attempt to call global 'CanAttackerInFree' (a nil value)
[27/06/2019 14:19:21] stack traceback:
[27/06/2019 14:19:21]     data/lib/some functions.lua:524: in function 'canAttackOther'
[27/06/2019 14:19:21]     data/lib/newStatusSyst.lua:942: in function 'doMoveDano2'
[27/06/2019 14:19:21]     data/lib/newStatusSyst.lua:911: in function 'doMoveInArea2'
[27/06/2019 14:19:21]     data/lib/pokemon moves.lua:1469: in function <data/lib/pokemon moves.lua:1465>

 

 

Códigos:

Spoiler

Some Functions:

 

function canAttackOther(cid, pid) --Function q verifica se um poke/player pode atacar outro poke/player

if not isCreature(cid) or not isCreature(pid) then return "Cant" end -- sobidi

local master1 = isSummon(cid) and getCreatureMaster(cid) or cid
local master2 = isSummon(pid) and getCreatureMaster(pid) or pid
   
   ----             
        if CanAttackerInDuel(master1, master2) and not isPlayer(cid) then
            return "Can"
         end
        if CanAttackerInFree(master1, master2) then
            return "Can"
         end
   ----              pvp system
   if getPlayerStorageValue(master1, 6598754) >= 1 and getPlayerStorageValue(master2, 6598755) >= 1 then
      return "Can" 
   end
   if getPlayerStorageValue(master1, 6598755) >= 1 and getPlayerStorageValue(master2, 6598754) >= 1 then  ---estar em times diferentes
      return "Can"
   end
   --if getPlayerStorageValue(cid, 321321) >= 1  then  ---pvp libre
   --  return "Can"
   --end
   --if getPlayerStorageValue(getCreatureMaster(cid), 321321) >= 1 and getPlayerStorageValue(getCreatureMaster(pid), 321321) >= 1 then  ---pvp libre
   --   return "Can"
  -- end
   ----
   if ehMonstro(cid) and ehMonstro(pid) then 
     return "Can"
   end

return "Cant" -- sobidi cant

end

 

Spoiler

Poke Move:

 

 

elseif spell == "Earthquake" then

local eff = getSubName(cid, target) == "Shiny Onix" and 175 or 118  --alterado v1.6.1
 
local function doQuake(cid) -- sobidi
if not isCreature(cid) then return true end
if isSleeping(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return false end
if isWithFear(cid) and getPlayerStorageValue(cid, 3644587) >= 1 then return true end
 doMoveInArea2(cid, eff, confusion, GROUNDDAMAGE, min, max, spell)
end

times = {0, 500, 1000, 1500, 2300, 2800, 3300, 3800, 4600, 5100, 5600, 6100, 6900, 7400, 7900, 8400, 9200, 10000}

setPlayerStorageValue(cid, 3644587, 1)
addEvent(setPlayerStorageValue, 10000, cid, 3644587, -1)
for i = 1, #times do                   --alterado v1.4
    addEvent(doQuake, times, cid)
    end

 

Aguardo um suporte. Qualquer sugestão é bem vinda. Obrigado!

Postado

Coloca o move1.lua, pelo que eu percebi é ela que chama a função CanAttackerInFree.

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

Postado
  • Autor
21 horas atrás, Rayo disse:

Coloca o move1.lua, pelo que eu percebi é ela que chama a função CanAttackerInFree.

 

Obrigado pelo suporte. Aqui está o move1 cara.

 

Spoiler

local msgs = {"use ", ""}

function doAlertReady(cid, id, movename, n, cd)
    if not isCreature(cid) then return true end
    local myball = getPlayerSlotItem(cid, ?
    if myball.itemid > 0 and getItemAttribute(myball.uid, cd) == "cd:"..id.."" then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(myball.uid).." - "..movename.." (m"..n..") is ready!")
    return true
    end
    local p = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)
    if not p or #p <= 0 then return true end
    for a = 1, #p do
        if getItemAttribute(p[a], cd) == "cd:"..id.."" then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(p[a]).." - "..movename.." (m"..n..") is ready!")
        return true
        end
    end
end

function onSay(cid, words, param, channel)


    if param ~= "" then return true end
    if string.len(words) > 3 then return true end

    if #getCreatureSummons(cid) == 0 then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need a pokemon to use moves.")
    return 0
    end
                      --alterado v1.5
local mypoke = getCreatureSummons(cid)[1]
local item = getPlayerSlotItem(cid, ?

    if getCreatureCondition(cid, CONDITION_EXHAUST) then return true end
    if getCreatureName(mypoke) == "Evolution" then return true end
    local name = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
    local copy = getItemAttribute(item.uid, "copyName") or ""
    
    if isInArray({"ditto", "shiny ditto"}, copy:lower()) then
       return true
    end
    
    if getItemAttribute(item.uid, "copyName") then -- ditto system
        name = getItemAttribute(item.uid, "copyName")
    elseif  isMega(mypoke) then  --alterado v1.9
        name = getPlayerStorageValue(mypoke, storages.isMega)
    end  
    
    --local name = getCreatureName(mypoke) == "Ditto" and getPlayerStorageValue(mypoke, 1010) or getCreatureName(mypoke)

local it = string.sub(words, 2, 3)
if not movestable[name] then 
    doSendMsg(cid, "Este pokémon não tem spell.")
    return true 
end
local move = movestable[name].move1
if getPlayerStorageValue(mypoke, 212123) >= 1 then
   cdzin = "cm_move"..it..""
else
   cdzin = "move"..it..""       --alterado v1.5
end

    if it == "2" then
        move = movestable[name].move2
    elseif it == "3" then
        move = movestable[name].move3
    elseif it == "4" then
        move = movestable[name].move4
    elseif it == "5" then
        move = movestable[name].move5
    elseif it == "6" then
        move = movestable[name].move6
    elseif it == "7" then
        move = movestable[name].move7
    elseif it == "8" then
        move = movestable[name].move8
    elseif it == "9" then
        move = movestable[name].move9
    elseif it == "10" then
        move = movestable[name].move10
    elseif it == "11" then
        move = movestable[name].move11
    elseif it == "12" then
        move = movestable[name].move12
    elseif it == "13" then
        move = movestable[name].move13
    end

    local heldy = getItemAttribute(item.uid, "yHeldItem")
    if not move or (string.find(move.name, "- ") and not (heldy and string.find(heldy, "MEGA"))) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon doesn't recognize this move.")
    return true
    end
    
    if not string.find(move.name, "Mega") then
        if getPlayerLevel(cid) < move.level then
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need be atleast level "..move.level.." to use this move.")
           return true
        end

        if getPlayerGroupId(cid) < 4 and getCD(getPlayerSlotItem(cid, 8).uid, cdzin) > 0 and getCD(getPlayerSlotItem(cid, 8).uid, cdzin) < (move.cd + 2) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to wait "..getCD(getPlayerSlotItem(cid, 8).uid, cdzin).." seconds to use "..move.name.." again.")
        return true
        end

        if getTileInfo(getThingPos(mypoke)).protection then
            doPlayerSendCancel(cid, "Your pokemon cannot use moves while in protection zone.")
        return true
        end
        
       if getPlayerStorageValue(mypoke, 3894) >= 1 then
          return doPlayerSendCancel(cid, "You can't attack because you is with fear") --alterado v1.3
       end
    end
                                  --alterado v1.6                  
    if (move.name == "Team Slice" or move.name == "Team Claw") and #getCreatureSummons(cid) < 2 then       
        doPlayerSendCancel(cid, "Your pokemon need be in a team for use this move!")
    return true
    end
    
    if move.passive and move.passive == "sim" then
        return true
    end
         


if move.target == 1 then

    if not isCreature(getCreatureTarget(cid)) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don\'t have any targets.")
    return 0
    end

    if getCreatureCondition(getCreatureTarget(cid), CONDITION_INVISIBLE) then
    return 0
    end

    if getCreatureHealth(getCreatureTarget(cid)) <= 0 then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your have already defeated your target.")
    return 0
    end

    if not isCreature(getCreatureSummons(cid)[1]) then
    return true
    end

    if getDistanceBetween(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid))) > move.dist then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Get closer to the target to use this move.")
    return 0
    end

    if not isSightClear(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid)), false) then
    return 0
    end
end

    local newid = 0
    
        if isSleeping(mypoke) or isSilence(mypoke) then  --alterado v1.5
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't do that right now.")
            return 0
        else
            newid = setCD(getPlayerSlotItem(cid, 8).uid, cdzin, move.cd)
        end
        
    if string.find(move.name, "- ") then
      doCreatureSay(cid, ""..getPokeName(mypoke)..", mega evolução!", TALKTYPE_ORANGE_1)
    else
      doCreatureSay(cid, ""..getPokeName(mypoke)..", "..msgs[math.random(#msgs)]..""..move.name.."!", TALKTYPE_ORANGE_1)
    end
    
    local summons = getCreatureSummons(cid) --alterado v1.6

    --addEvent(doAlertReady, move.cd * 1000, cid, newid, move.name, it, cdzin)
    
    for i = 2, #summons do
       if isCreature(summons) then
          docastspell(summons, move.name)        --alterado v1.6
       end
    end 

    docastspell(mypoke, move.name)
    doCreatureAddCondition(cid, playerexhaust)

    if useKpdoDlls then
        doUpdateCooldowns(cid)
    end

return 0
end

 

Postado

Então cara, eu analisei ambos os códigos e não há erro.

Quando a distro fala: attempt to call global 'CanAttackerInFree' (a nil value)

Esse "a nil value" quer dizer que aquela função(CanAttackerInFree) não está sendo encontrada na SOURCE(pasta src) da distro.

 

Você terá que procura-lá na source e caso não ache,terá que implementar e compilar novamente.

 

Essa base que você está usando,você tem o link dela para eu baixar e verificar se essa função existe na source?

Editado por Rayo (veja o histórico de edições)

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

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