Postado Abril 4, 2020 5 anos eu uso o server The OTX Server Global - Version: (3.10) Compiled with: Microsoft Visual C++ version 14.0 Compiled on Nov 18 2018 17:46:29 for platform x64 e queria saber como que eu posso colocar cooldown de 10 minutos nas foods magicas como o blueberry cupcake: function onUse(player, item, fromPosition, target, toPosition, isHotkey) player:addMana(math.max(1,player:getMaxMana() - player:getMana())) player:say("Yum.", TALKTYPE_MONSTER_SAY) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your mana was refilled completely.") item:remove(1) return true end ele funciona certinho mas nao sei por cooldown se alguem souber por favor me manda como q faz obrigado
Postado Abril 4, 2020 5 anos Spoiler function onUse(player, item, fromPosition, target, toPosition, isHotkey) if exhaustion.get(cid, 3306) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sorry, you need wait 10 minutes to use food again.") return false else exhaustion.set(cid, 3306, 600) end player:addMana(math.max(1,player:getMaxMana() - player:getMana())) player:say("Yum.", TALKTYPE_MONSTER_SAY) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your mana was refilled completely.") item:remove(1) return trueend n sei se vai funcionar, mas testa ai :0
Postado Abril 4, 2020 5 anos Autor acabei de tentar, nao funcionou, nao esta dando pra comer mais a comida Lua Script Error: [Action Interface] data/actions/scripts/other/blueberrycupcake.lua:onUse data/actions/scripts/other/blueberrycupcake.lua:3: attempt to index global 'exhaustion' (a nil value) stack traceback: [C]: in function '__index' data/actions/scripts/other/blueberrycupcake.lua:3: in function <data/actions/scripts/other/blueberrycupcake.lua:1> Editado Abril 4, 2020 5 anos por ADM Tibia Baiak Mast (veja o histórico de edições)
Postado Abril 4, 2020 5 anos Spoiler function onUse(player, item, fromPosition, target, toPosition, isHotkey) if getPlayerStorageValue(cid, 3306) > os.time() then doCreatureSay(cid, "EXAUSTH: "..getPlayerStorageValue(cid, config.storage) - os.time()..".", TALKTYPE_ORANGE_1) doPlayerSendCancel(cid, "Você tem que esperar "..getPlayerStorageValue(cid, config.storage) - os.time().." segundos para usar esse food novamente.") return false else setPlayerStorageValue(cid, 3306, os.time() + 600) end player:addMana(math.max(1,player:getMaxMana() - player:getMana())) player:say("Yum.", TALKTYPE_MONSTER_SAY) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your mana was refilled completely.") item:remove(1) return trueend entao tenta esse
Postado Abril 4, 2020 5 anos Autor 1 minuto atrás, poko360 disse: Ocultar conteúdo function onUse(player, item, fromPosition, target, toPosition, isHotkey) if getPlayerStorageValue(cid, 3306) > os.time() then doCreatureSay(cid, "EXAUSTH: "..getPlayerStorageValue(cid, config.storage) - os.time()..".", TALKTYPE_ORANGE_1) doPlayerSendCancel(cid, "Você tem que esperar "..getPlayerStorageValue(cid, config.storage) - os.time().." segundos para usar esse food novamente.") return false else setPlayerStorageValue(cid, 3306, os.time() + 600) end player:addMana(math.max(1,player:getMaxMana() - player:getMana())) player:say("Yum.", TALKTYPE_MONSTER_SAY) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your mana was refilled completely.") item:remove(1) return trueend entao tenta esse tambem nao foi, aparece isso Lua Script Error: [Action Interface] data/actions/scripts/other/blueberrycupcake.lua:onUse data/actions/scripts/other/blueberrycupcake.lua:3: attempt to compare number with boolean stack traceback: [C]: in function '__lt' data/actions/scripts/other/blueberrycupcake.lua:3: in function <data/actions/scripts/other/blueberrycupcake.lua:1>
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.