• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

put it to take effect every 5 seconds while the potion is active

pisquila

Member
Joined
Nov 14, 2023
Messages
48
Reaction score
5
put it to take effect every 5 seconds while the potion is active (exp2x)

local expfinal = 1 --Não mude, isso é para a experiencia voltar ao normal.
local textoPotionUsada = "[EGG DE EXP] Voce ja esta sobre o efeito de uma EGG DE EXP. Espere o efeito acabar."

local potions = {
-- [ID_POTION] = { tempo = DURAÇÃO, experiencia = EXPERIENCIA, quantidade = QUANTIDADE_DE_POTIONS, texto = 'Voce Ganhou 30 Minutos de Exp [3x]', textofinal = 'Bonus de Exp [3x] Finalizada', storage = STORAGE_UNICO_PARA_CADA_POTION, textoClasse = 22, efeito = 1 },
[6541] = { tempo = 1800, experiencia = 2.0, quantidade = 1, texto = '[EGG DE EXP] Voce usou EGG DE EXP [3x] por 30 minutos', textofinal = '[EGG DE EXP] EGG DE EXP [3x] Finalizada', storage = 33330, textoClasse = 19, efeito = 53},
}

function onUse(cid, item, frompos, item2, topos)

for potionId, potionConfig in pairs(potions) do
if item.itemid == potionId then

if (getPlayerStorageValue(cid, potionConfig.storage) > os.time()) then
doPlayerSendTextMessage(cid,20,"[EGG DE EXP] Voce ja esta sobre o efeito de uma EGG DE EXP. Espere o efeito acabar.")
return;
end

local quantidadePotionPlayer = getPlayerItemCount(cid, potionId)
if quantidadePotionPlayer < potionConfig.quantidade or quantidadePotionPlayer <= 0 then
return;
end
doRemoveItem(item.uid, potionConfig.quantidade)
doPlayerSetExperienceRate(cid, potionConfig.experiencia)
doSendMagicEffect(frompos, potionConfig.efeito)
doPlayerSendTextMessage(cid, potionConfig.textoClasse, potionConfig.texto)
addEvent(potion, potionConfig.tempo * 1000, cid, potionConfig)
setPlayerStorageValue(cid, potionConfig.storage, (os.time() + potionConfig.tempo))
end
end

end

function potion(cid, potionConfig)
doPlayerSetExperienceRate(cid, expfinal)
doPlayerSendTextMessage(cid, potionConfig.textoClasse, potionConfig.textofinal)
end
 
Back
Top