Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado
  • Diretor
3 horas atrás, Gabrielxxxxx disse:

vai chegando no final da spell da esse erro não consigo identificar ele no script

 

a spell funciona perfeitamente e quando esta deslogado não da mais erros na distro, porem da esse erro na distro no finalzinho da spell enquanto o player esta online com a spell em andamento...

 

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

 

acabei de ver tambem que as storage que a spell daria não estão corretas, o primeiro stage seta a storage 1 porem o resto seta a storage 0, o certo seria a sequencia 1,2,3,4, e 5

function onCastSpell(cid, var)

    if not isCreature(cid) then
        return false
    end


    local storage, storage2 = 55512, 55513
    local stage = getPlayerStorageValue(cid, storage) or 0
    local waittimes = {30, 30, 40, 50, 60}
    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 stage > 0 then
        doPlayerSendCancel(cid, "Você já está sob o efeito da spell.")
        return false
    end


    setPlayerStorageValue(cid, storage, 1)


    local function advanceStage()

        if not isCreature(cid) then
            return
        end


        local currentStage = getPlayerStorageValue(cid, storage)
        if currentStage == nil or currentStage < 0 then
            currentStage = 0
        end


        if currentStage < #waittimes then
            setPlayerStorageValue(cid, storage, currentStage + 1)

            addEvent(advanceStage, (waittimes[currentStage + 1] or 30) * 1000)
        else

            setPlayerStorageValue(cid, storage, -1)
        end
    end


    addEvent(advanceStage, waittimes[1] * 1000)


    exhaustion.set(cid, storage2, waittime3)

)
    if OpenGate then
        OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1)
    else
        print("Função OpenGate não encontrada.")
    end


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

    return true
end

 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

  • Respostas 11
  • Visualizações 1.6k
  • 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
  • Autor
23 horas atrás, L3K0T disse:

function onCastSpell(cid, var)

    if not isCreature(cid) then
        return false
    end


    local storage, storage2 = 55512, 55513
    local stage = getPlayerStorageValue(cid, storage) or 0
    local waittimes = {30, 30, 40, 50, 60}
    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 stage > 0 then
        doPlayerSendCancel(cid, "Você já está sob o efeito da spell.")
        return false
    end


    setPlayerStorageValue(cid, storage, 1)


    local function advanceStage()

        if not isCreature(cid) then
            return
        end


        local currentStage = getPlayerStorageValue(cid, storage)
        if currentStage == nil or currentStage < 0 then
            currentStage = 0
        end


        if currentStage < #waittimes then
            setPlayerStorageValue(cid, storage, currentStage + 1)

            addEvent(advanceStage, (waittimes[currentStage + 1] or 30) * 1000)
        else

            setPlayerStorageValue(cid, storage, -1)
        end
    end


    addEvent(advanceStage, waittimes[1] * 1000)


    exhaustion.set(cid, storage2, waittime3)

)
    if OpenGate then
        OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1)
    else
        print("Função OpenGate não encontrada.")
    end


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

    return true
end

 

sem nenhum erro na distro meu amigo, porem as storages não estão funcionando corretamente, ela funciona perfeitamente até o 2 depois volta pro 1 e fica indo pro 2, fica setando storage 1 e 2 somente, sendo q o certo iria ate a storage 5.

 

dependo desse sistema de storage pois tenho spell que são modificadas para essas storages de acordo com a transformação.

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