Postado Setembro 1, 2024 Set 1 Autor 9 horas atrás, Nolangg disse: 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. [01/09/2024 01:19:01] [Error - Spell Interface] [01/09/2024 01:19:01] In a timer event called from: [01/09/2024 01:19:01] data/spells/scripts/maito gai/hachimon_tonkou.lua:onCastSpell [01/09/2024 01:19:01] Description: [01/09/2024 01:19:01] data/spells/scripts/maito gai/hachimon_tonkou.lua:211: attempt to perform arithmetic on field '?' (a nil value) [01/09/2024 01:19:01] stack traceback: [01/09/2024 01:19:01] data/spells/scripts/maito gai/hachimon_tonkou.lua:211: in function <data/spells/scripts/maito gai/hachimon_tonkou.lua:202> surge o erro quando esta quase no final da spell Editado Setembro 1, 2024 Set 1 por Gabrielxxxxx (veja o histórico de edições)
Postado Setembro 7, 2024 Set 7 ta faltando stopEvent(eventName) ao deslogar 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
Postado Setembro 8, 2024 Set 8 Autor 19 horas atrás, L3K0T disse: ta faltando stopEvent(eventName) ao deslogar não consegui de nenhum jeito, consegue dar uma força no script lekot?
Postado Setembro 8, 2024 Set 8 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 < #waittimes then setPlayerStorageValue(cid, storage, currentStage + 1) addEvent(advanceStage, waittimes[currentStage + 1] * 1000) else setPlayerStorageValue(cid, storage, -1) end end addEvent(advanceStage, waittimes[1] * 1000) exhaustion.set(cid, storage2, waittime3) OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1) addEvent(function() if isCreature(cid) then setPlayerStorageValue(cid, storage, -1) end end, waittimes[1] * 1000) return true end 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
Postado Setembro 9, 2024 Set 9 Autor 18 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 < #waittimes then setPlayerStorageValue(cid, storage, currentStage + 1) addEvent(advanceStage, waittimes[currentStage + 1] * 1000) else setPlayerStorageValue(cid, storage, -1) end end addEvent(advanceStage, waittimes[1] * 1000) exhaustion.set(cid, storage2, waittime3) OpenGate(cid, Select_Stages(getCreatureOutfit(cid).lookType), 1) addEvent(function() if isCreature(cid) then setPlayerStorageValue(cid, storage, -1) end end, waittimes[1] * 1000) return true end 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 Editado Setembro 9, 2024 Set 9 por Gabrielxxxxx informaçoes (veja o histórico de edições)
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.