Ir para conteúdo

Featured Replies

Postado

Qual o motivo deste tópico? 

spell de buff dando erro na distro

Está surgindo algum erro? Se sim coloque-o aqui. 

 

[25/08/2024 21:14:12] [Error - Spell Interface] 
[25/08/2024 21:14:12] In a timer event called from: 
[25/08/2024 21:14:12] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:14:12] Description: 
[25/08/2024 21:14:12] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:14:12] [Error - Spell Interface] 
[25/08/2024 21:14:12] In a timer event called from: 
[25/08/2024 21:14:12] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:14:12] Description: 
[25/08/2024 21:14:12] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:14:42] [Error - Spell Interface] 
[25/08/2024 21:14:42] In a timer event called from: 
[25/08/2024 21:14:42] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:14:42] Description: 
[25/08/2024 21:14:42] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:15:22] [Error - Spell Interface] 
[25/08/2024 21:15:22] In a timer event called from: 
[25/08/2024 21:15:22] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:15:22] Description: 
[25/08/2024 21:15:22] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:16:12] [Error - Spell Interface] 
[25/08/2024 21:16:12] In a timer event called from: 
[25/08/2024 21:16:12] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:16:12] Description: 
[25/08/2024 21:16:12] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:17:12] [Error - Spell Interface] 
[25/08/2024 21:17:12] In a timer event called from: 
[25/08/2024 21:17:12] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:17:12] Description: 
[25/08/2024 21:17:12] (luaDoCreatureSetStorage) Creature not found

 

Citar

 

 

Você tem o código disponível? Se tiver publique-o aqui: 

 function onCastSpell(cid, var)
    local storage = 55512 -- Storage para controlar a spell
    local stage = getPlayerStorageValue(cid, storage) or 0 -- Obtém o estágio atual da spell, se não houver nenhum, assume 0
    local waittimes = {30, 30, 40, 50, 60} -- Tempos de espera para cada estágio em segundos
    local storage2 = 55513
	local waittime3 = 310
  
	if exhaustion.check(cid, storage2) then
	doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage2) .. " segundos para usar a spell novamente.")
	return false
	end
  
      if not isCreature(cid) then
        return false
    end
  
    if stage > 0 then
        doPlayerSendCancel(cid, "Você já está sob o efeito da spell.")
        return false
    end 

    -- Definir o estágio inicial da spell
    setPlayerStorageValue(cid, storage, 1)
    stage = 1

    -- Função para avançar para o próximo estágio após o término do atual
    local function advanceStage()
        if stage < #waittimes then
            stage = stage + 1
            setPlayerStorageValue(cid, storage, stage)
            -- Programar o próximo avanço de estágio
            addEvent(advanceStage, waittimes[stage] * 1000)
        else
            -- Resetar a storage quando todos os estágios terminarem
            setPlayerStorageValue(cid, storage, -1)
        end
    end

    -- Iniciar o avanço de estágio
    addEvent(advanceStage, waittimes[stage] * 1000)


    -- Definir a exhaustion e aplicar os efeitos iniciais da spell
    local waittime = waittimes[1] -- Definir o tempo de exhaustion baseado no primeiro estágio
    exhaustion.set(cid, storage2, waittime3)
    OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1)
    
    -- Definir a storage de volta para -1 após o término do efeito da spell
    addEvent(function()
        setPlayerStorageValue(cid, storage, -1)
    end, waittime * 1000) -- Convertendo segundos para milissegundos
    
    return true
end

 

o erro começou depois que eu coloquei uma função no creaturescript para deixar todos os player com essa storage 55512, quando relogasse para -1.

a spell não da nenhum erro na distro se o player ficar logado e completar ela inteira, mas quando o player desloga da esses erros na distro, mesmo se o player tiver deslogado continua dando o erro na distro...

alguem da uma força por favor, deixei o outro topico em que me ajudaram a acertar a spell certinho porem começou a dar este erro agora...

 

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

  • Gabrielxxxxx mudou o título para Setando -1 na storage quando desloga e dando erro na distro
  • Respostas 11
  • Visualizações 1.9k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Boa noite @Gabrielxxxxx, essa função advanceStage é chamada algumas vezes num intervalo de tempo e ela tenta setar a storage no player, se ele estiver deslogado vai dar esse erro, pois o servidor não

  • O que o rapaz acima falou pode ser usado também. mas, teste assim também:   function onCastSpell(cid, var) local storage = 55512 local storage2 = 55513 -- Exhaust local waittimes

  • ta faltando stopEvent(eventName) ao deslogar  

Postado

Boa noite @Gabrielxxxxx, essa função advanceStage é chamada algumas vezes num intervalo de tempo e ela tenta setar a storage no player, se ele estiver deslogado vai dar esse erro, pois o servidor não encontra o player. É só adicionar um check nela, assim:

 

    -- Função para avançar para o próximo estágio após o término do atual
    local function advanceStage()
        -- checa se o player/creature existe 
        if not isCreature(cid) then 
            return false
        end

        if stage < #waittimes then
            stage = stage + 1
            setPlayerStorageValue(cid, storage, stage)
            -- Programar o próximo avanço de estágio
            addEvent(advanceStage, waittimes[stage] * 1000)
        else
            -- Resetar a storage quando todos os estágios terminarem
            setPlayerStorageValue(cid, storage, -1)
        end
    end

 

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

Postado
Em 25/08/2024 em 21:41, Gabrielxxxxx disse:

Qual o motivo deste tópico? 

spell de buff dando erro na distro

Está surgindo algum erro? Se sim coloque-o aqui. 

 

[25/08/2024 21:14:12] [Error - Spell Interface] 
[25/08/2024 21:14:12] In a timer event called from: 
[25/08/2024 21:14:12] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:14:12] Description: 
[25/08/2024 21:14:12] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:14:12] [Error - Spell Interface] 
[25/08/2024 21:14:12] In a timer event called from: 
[25/08/2024 21:14:12] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:14:12] Description: 
[25/08/2024 21:14:12] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:14:42] [Error - Spell Interface] 
[25/08/2024 21:14:42] In a timer event called from: 
[25/08/2024 21:14:42] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:14:42] Description: 
[25/08/2024 21:14:42] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:15:22] [Error - Spell Interface] 
[25/08/2024 21:15:22] In a timer event called from: 
[25/08/2024 21:15:22] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:15:22] Description: 
[25/08/2024 21:15:22] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:16:12] [Error - Spell Interface] 
[25/08/2024 21:16:12] In a timer event called from: 
[25/08/2024 21:16:12] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:16:12] Description: 
[25/08/2024 21:16:12] (luaDoCreatureSetStorage) Creature not found

[25/08/2024 21:17:12] [Error - Spell Interface] 
[25/08/2024 21:17:12] In a timer event called from: 
[25/08/2024 21:17:12] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[25/08/2024 21:17:12] Description: 
[25/08/2024 21:17:12] (luaDoCreatureSetStorage) Creature not found

 

 

Você tem o código disponível? Se tiver publique-o aqui: 


 function onCastSpell(cid, var)
    local storage = 55512 -- Storage para controlar a spell
    local stage = getPlayerStorageValue(cid, storage) or 0 -- Obtém o estágio atual da spell, se não houver nenhum, assume 0
    local waittimes = {30, 30, 40, 50, 60} -- Tempos de espera para cada estágio em segundos
    local storage2 = 55513
	local waittime3 = 310
  
	if exhaustion.check(cid, storage2) then
	doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage2) .. " segundos para usar a spell novamente.")
	return false
	end
  
      if not isCreature(cid) then
        return false
    end
  
    if stage > 0 then
        doPlayerSendCancel(cid, "Você já está sob o efeito da spell.")
        return false
    end 

    -- Definir o estágio inicial da spell
    setPlayerStorageValue(cid, storage, 1)
    stage = 1

    -- Função para avançar para o próximo estágio após o término do atual
    local function advanceStage()
        if stage < #waittimes then
            stage = stage + 1
            setPlayerStorageValue(cid, storage, stage)
            -- Programar o próximo avanço de estágio
            addEvent(advanceStage, waittimes[stage] * 1000)
        else
            -- Resetar a storage quando todos os estágios terminarem
            setPlayerStorageValue(cid, storage, -1)
        end
    end

    -- Iniciar o avanço de estágio
    addEvent(advanceStage, waittimes[stage] * 1000)


    -- Definir a exhaustion e aplicar os efeitos iniciais da spell
    local waittime = waittimes[1] -- Definir o tempo de exhaustion baseado no primeiro estágio
    exhaustion.set(cid, storage2, waittime3)
    OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1)
    
    -- Definir a storage de volta para -1 após o término do efeito da spell
    addEvent(function()
        setPlayerStorageValue(cid, storage, -1)
    end, waittime * 1000) -- Convertendo segundos para milissegundos
    
    return true
end

 

o erro começou depois que eu coloquei uma função no creaturescript para deixar todos os player com essa storage 55512, quando relogasse para -1.

a spell não da nenhum erro na distro se o player ficar logado e completar ela inteira, mas quando o player desloga da esses erros na distro, mesmo se o player tiver deslogado continua dando o erro na distro...

alguem da uma força por favor, deixei o outro topico em que me ajudaram a acertar a spell certinho porem começou a dar este erro agora...

 

O que o rapaz acima falou pode ser usado também. mas, teste assim também:

 

function onCastSpell(cid, var)
    local storage = 55512 
    local storage2 = 55513 -- Exhaust
    local waittimes = {30, 30, 40, 50, 60} 
    local waittime3 = 310 

    if not isCreature(cid) or exhaustion.check(cid, storage2) then
        doPlayerSendCancel(cid, "Aguarde " .. (exhaustion.get(cid, storage2) or 0) .. " segundos para usar a spell novamente.")
        return false
    end

   
    if getPlayerStorageValue(cid, storage) > 0 then
        doPlayerSendCancel(cid, "Você já está sob o efeito da spell.")
        return false
    end

    setPlayerStorageValue(cid, storage, 1)
    exhaustion.set(cid, storage2, waittime3)
    OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1)

    local function advanceStage()
        if not isCreature(cid) then
            return false
        end

        local stage = getPlayerStorageValue(cid, storage)
        if stage < #waittimes then
            stage = stage + 1
            setPlayerStorageValue(cid, storage, stage)
            addEvent(advanceStage, waittimes[stage] * 1000)
        else
            setPlayerStorageValue(cid, storage, -1) -- Reseta a storage ao final dos estágios
        end
    end

    addEvent(advanceStage, waittimes[1] * 1000)
    addEvent(function()
        if isCreature(cid) then
            setPlayerStorageValue(cid, storage, -1)
        end
    end, waittimes[1] * 1000)

    return true
end

 

aka aka

 

monki-flip-monkey.gif

Postado
  • Autor
Em 28/08/2024 em 20:24, Rusherzin disse:

Boa noite @Gabrielxxxxx, essa função advanceStage é chamada algumas vezes num intervalo de tempo e ela tenta setar a storage no player, se ele estiver deslogado vai dar esse erro, pois o servidor não encontra o player. É só adicionar um check nela, assim:

 



    -- Função para avançar para o próximo estágio após o término do atual
    local function advanceStage()
        -- checa se o player/creature existe 
        if not isCreature(cid) then 
            return false
        end

        if stage < #waittimes then
            stage = stage + 1
            setPlayerStorageValue(cid, storage, stage)
            -- Programar o próximo avanço de estágio
            addEvent(advanceStage, waittimes[stage] * 1000)
        else
            -- Resetar a storage quando todos os estágios terminarem
            setPlayerStorageValue(cid, storage, -1)
        end
    end

 

deu esse erro na distro quando o player ta deslogado

 

[31/08/2024 14:01:56] [Error - Spell Interface] 
[31/08/2024 14:01:56] In a timer event called from: 
[31/08/2024 14:01:56] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[31/08/2024 14:01:56] Description: 
[31/08/2024 14:01:56] (luaDoCreatureSetStorage) Creature not found

Em 29/08/2024 em 01:39, Nolangg disse:

O que o rapaz acima falou pode ser usado também. mas, teste assim também:

 



function onCastSpell(cid, var)
    local storage = 55512 
    local storage2 = 55513 -- Exhaust
    local waittimes = {30, 30, 40, 50, 60} 
    local waittime3 = 310 

    if not isCreature(cid) or exhaustion.check(cid, storage2) then
        doPlayerSendCancel(cid, "Aguarde " .. (exhaustion.get(cid, storage2) or 0) .. " segundos para usar a spell novamente.")
        return false
    end

   
    if getPlayerStorageValue(cid, storage) > 0 then
        doPlayerSendCancel(cid, "Você já está sob o efeito da spell.")
        return false
    end

    setPlayerStorageValue(cid, storage, 1)
    exhaustion.set(cid, storage2, waittime3)
    OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1)

    local function advanceStage()
        if not isCreature(cid) then
            return false
        end

        local stage = getPlayerStorageValue(cid, storage)
        if stage < #waittimes then
            stage = stage + 1
            setPlayerStorageValue(cid, storage, stage)
            addEvent(advanceStage, waittimes[stage] * 1000)
        else
            setPlayerStorageValue(cid, storage, -1) -- Reseta a storage ao final dos estágios
        end
    end

    addEvent(advanceStage, waittimes[1] * 1000)
    addEvent(function()
        if isCreature(cid) then
            setPlayerStorageValue(cid, storage, -1)
        end
    end, waittimes[1] * 1000)

    return true
end

 

o unico erro que deu na distro foi enquanto o player estava no meio da spell

 

[31/08/2024 14:07:08] [Error - Spell Interface] 
[31/08/2024 14:07:08] In a timer event called from: 
[31/08/2024 14:07:08] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[31/08/2024 14:07:08] Description: 
[31/08/2024 14:07:08] data/spells/scripts/maito gai/hachimon_tonkou.lua:212: attempt to perform arithmetic on field '?' (a nil value)
[31/08/2024 14:07:08] stack traceback:
[31/08/2024 14:07:08]     data/spells/scripts/maito gai/hachimon_tonkou.lua:212: in function <data/spells/scripts/maito gai/hachimon_tonkou.lua:203>

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

Postado
Agora, Gabrielxxxxx disse:

deu esse erro na distro quando o player ta deslogado

 

[31/08/2024 14:01:56] [Error - Spell Interface] 
[31/08/2024 14:01:56] In a timer event called from: 
[31/08/2024 14:01:56] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[31/08/2024 14:01:56] Description: 
[31/08/2024 14:01:56] (luaDoCreatureSetStorage) Creature not found

o unico erro que deu na distro foi enquanto o player estava no meio da spell

 

[31/08/2024 14:07:08] [Error - Spell Interface] 
[31/08/2024 14:07:08] In a timer event called from: 
[31/08/2024 14:07:08] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell
[31/08/2024 14:07:08] Description: 
[31/08/2024 14:07:08] data/spells/scripts/maito gai/hachimon_tonkou.lua:212: attempt to perform arithmetic on field '?' (a nil value)
[31/08/2024 14:07:08] stack traceback:
[31/08/2024 14:07:08]     data/spells/scripts/maito gai/hachimon_tonkou.lua:212: in function <data/spells/scripts/maito gai/hachimon_tonkou.lua:203>


tenta assim agora:

 

function onCastSpell(cid, var)
    local storage = 55512 
    local storage2 = 55513 -- Exhaust
    local waittimes = {30, 30, 40, 50, 60} 
    local waittime3 = 310 

    if not isCreature(cid) or exhaustion.check(cid, storage2) then
        doPlayerSendCancel(cid, "Aguarde " .. (exhaustion.get(cid, storage2) or 0) .. " segundos para usar a spell novamente.")
        return false
    end

    if getPlayerStorageValue(cid, storage) > 0 then
        doPlayerSendCancel(cid, "Você já está sob o efeito da spell.")
        return false
    end

    setPlayerStorageValue(cid, storage, 1)
    exhaustion.set(cid, storage2, waittime3)
    OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1)

    local function advanceStage()
        if not isCreature(cid) then
            return false
        end

        local stage = getPlayerStorageValue(cid, storage)
        if stage and stage < #waittimes then
            stage = stage + 1
            setPlayerStorageValue(cid, storage, stage)
            addEvent(advanceStage, waittimes[stage] * 1000)
        else
            setPlayerStorageValue(cid, storage, -1) -- Reseta a storage ao final dos estágios
        end
    end

    addEvent(advanceStage, waittimes[1] * 1000)

    addEvent(function()
        if isCreature(cid) then
            setPlayerStorageValue(cid, storage, -1)
        end
    end, (waittimes[#waittimes] + waittimes[1]) * 1000)

    return true
end


caso apareça algum erro retorne aqui.

aka aka

 

monki-flip-monkey.gif

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo