Postado Maio 1, 2023 2 anos Autor 12 minutos atrás, L3K0T disse: Vc quer usar semprea cada certo tempo, agora entendi amigo local config = { lifeGain = 5.5, lifeGainMax = 8, manaGain = 5.5, manaGainMax = 8, exhaustionSeconds = 0.9, effectChar = 212 } function onUse(cid, item, fromPosition, itemEx, toPosition) if exhaustion.check(cid, item.itemid) then local timeLeft = exhaustion.get(cid, item.itemid) if timeLeft > 0 then doPlayerSendCancel(cid, "You are exhausted. You need to wait " .. timeLeft .. " seconds before using this item again.") return true end end doRemoveItem(item.uid, 1) local health = getCreatureMaxHealth(cid) * (config.lifeGain/100) local mana = getCreatureMaxMana(cid) * (config.manaGain/100) local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100) local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100) doCreatureAddHealth(cid, math.random(health, healthmax)) doCreatureAddMana(cid, math.random(mana, manamax)) doSendMagicEffect(getPlayerPosition(cid), config.effectChar) exhaustion.set(cid, item.itemid, config.exhaustionSeconds) return true end ainda criou o storage no sqlite e não funcionou, "you cannot use this object"
Postado Maio 1, 2023 2 anos Diretor 1 minuto atrás, Marceneiro disse: ainda criou o storage no sqlite e não funcionou, "you cannot use this object" local config = { lifeGain = 5.5, lifeGainMax = 8, manaGain = 5.5, manaGainMax = 8, exhaustionSeconds = 0.9, effectChar = 212, itemExhaustion = 10 -- adicione o tempo de espera em segundos aqui } function onUse(cid, item, fromPosition, itemEx, toPosition) if exhaustion.check(cid, config.itemExhaustion) then local timeLeft = exhaustion.get(cid, config.itemExhaustion) if timeLeft > 0 then doPlayerSendCancel(cid, "You are exhausted. You need to wait " .. timeLeft .. " seconds before using this item again.") return true end end doRemoveItem(item.uid, 1) local health = getCreatureMaxHealth(cid) * (config.lifeGain/100) local mana = getCreatureMaxMana(cid) * (config.manaGain/100) local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100) local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100) doCreatureAddHealth(cid, math.random(health, healthmax)) doCreatureAddMana(cid, math.random(mana, manamax)) doSendMagicEffect(getPlayerPosition(cid), config.effectChar) exhaustion.set(cid, config.itemExhaustion, config.exhaustionSeconds) return true end
Postado Maio 1, 2023 2 anos Autor 6 minutos atrás, L3K0T disse: local config = { lifeGain = 5.5, lifeGainMax = 8, manaGain = 5.5, manaGainMax = 8, exhaustionSeconds = 0.9, effectChar = 212, itemExhaustion = 10 -- adicione o tempo de espera em segundos aqui } function onUse(cid, item, fromPosition, itemEx, toPosition) if exhaustion.check(cid, config.itemExhaustion) then local timeLeft = exhaustion.get(cid, config.itemExhaustion) if timeLeft > 0 then doPlayerSendCancel(cid, "You are exhausted. You need to wait " .. timeLeft .. " seconds before using this item again.") return true end end doRemoveItem(item.uid, 1) local health = getCreatureMaxHealth(cid) * (config.lifeGain/100) local mana = getCreatureMaxMana(cid) * (config.manaGain/100) local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100) local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100) doCreatureAddHealth(cid, math.random(health, healthmax)) doCreatureAddMana(cid, math.random(mana, manamax)) doSendMagicEffect(getPlayerPosition(cid), config.effectChar) exhaustion.set(cid, config.itemExhaustion, config.exhaustionSeconds) return true end o erro persiste, não criou mais o storage 34538, mas criou o storage 10 com o mesmo valor que o outro gerava.. 13 minutos atrás, L3K0T disse: local config = { lifeGain = 5.5, lifeGainMax = 8, manaGain = 5.5, manaGainMax = 8, exhaustionSeconds = 0.9, effectChar = 212, itemExhaustion = 10 -- adicione o tempo de espera em segundos aqui } function onUse(cid, item, fromPosition, itemEx, toPosition) if exhaustion.check(cid, config.itemExhaustion) then local timeLeft = exhaustion.get(cid, config.itemExhaustion) if timeLeft > 0 then doPlayerSendCancel(cid, "You are exhausted. You need to wait " .. timeLeft .. " seconds before using this item again.") return true end end doRemoveItem(item.uid, 1) local health = getCreatureMaxHealth(cid) * (config.lifeGain/100) local mana = getCreatureMaxMana(cid) * (config.manaGain/100) local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100) local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100) doCreatureAddHealth(cid, math.random(health, healthmax)) doCreatureAddMana(cid, math.random(mana, manamax)) doSendMagicEffect(getPlayerPosition(cid), config.effectChar) exhaustion.set(cid, config.itemExhaustion, config.exhaustionSeconds) return true end Spoiler [18:49:27.941] [Error - Action Interface] [18:49:27.942] data/actions/scripts/potions/soldier pill.lua:onUse [18:49:27.942] Description: [18:49:27.943] data/lib/034-exhaustion.lua:8: attempt to compare number with string [18:49:27.943] stack traceback: [18:49:27.943] data/lib/034-exhaustion.lua:8: in function 'check' [18:49:27.944] data/actions/scripts/potions/soldier pill.lua:11: in function <data/actions/scripts/potions/soldier pill.lua:10>
Postado Maio 1, 2023 2 anos Diretor 6 minutos atrás, Marceneiro disse: o erro persiste, não criou mais o storage 34538, mas criou o storage 10 com o mesmo valor que o outro gerava.. Deixei sem tempo pra nos testar local config = { lifeGain = 5.5, lifeGainMax = 8, manaGain = 5.5, manaGainMax = 8, effectChar = 212 } function onUse(cid, item, fromPosition, itemEx, toPosition) doRemoveItem(item.uid, 1) local health = getCreatureMaxHealth(cid) * (config.lifeGain/100) local mana = getCreatureMaxMana(cid) * (config.manaGain/100) local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100) local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100) doCreatureAddHealth(cid, math.random(health, healthmax)) doCreatureAddMana(cid, math.random(mana, manamax)) doSendMagicEffect(getPlayerPosition(cid), config.effectChar) return true end
Postado Maio 1, 2023 2 anos Autor 5 minutos atrás, L3K0T disse: Deixei sem tempo pra nos testar local config = { lifeGain = 5.5, lifeGainMax = 8, manaGain = 5.5, manaGainMax = 8, effectChar = 212 } function onUse(cid, item, fromPosition, itemEx, toPosition) doRemoveItem(item.uid, 1) local health = getCreatureMaxHealth(cid) * (config.lifeGain/100) local mana = getCreatureMaxMana(cid) * (config.manaGain/100) local healthmax = getCreatureMaxHealth(cid) * (config.lifeGainMax/100) local manamax = getCreatureMaxMana(cid) * (config.manaGainMax/100) doCreatureAddHealth(cid, math.random(health, healthmax)) doCreatureAddMana(cid, math.random(mana, manamax)) doSendMagicEffect(getPlayerPosition(cid), config.effectChar) return true end posso usar varias vezes agora, mas muito rápido, sem tempo como vc disse.
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.