• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Why doesn't my server's exp add up?

pisquila

Member
Joined
Nov 14, 2023
Messages
48
Reaction score
5
I have two different experience scripts on my server, one is an experience potion and the other is an experience bonus the more players are online, but it doesn't add up or give the bonus. Is there anything I could do to make these experience points add up?
 
share the scripts so we can investigate. Does each script work individually without the other script?
 
share the scripts so we can investigate. Does each script work individually without the other script?

online script player get exp bonus (LIB)
config_weekend_exp = {
dates = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, -- Dias da semana que será ativo
rates = {
{3, 1.05}, -- {quantidade de jogador online, taxa de bonus}
{15, 1.08},
{30, 1.11},
{45, 1.14},
{60, 1.17},
{85, 1.20},
{100, 1.23},
},
storage_bonus = 30303,
}

function get_bonus_weekend_exp()
for _, rate in ipairs(config_weekend_exp.rates) do
if #getPlayersOnline() >= rate[1] then
if getGlobalStorageValue(config_weekend_exp.storage_bonus) ~= 1 then
doBroadcastMessage("[Player Bonus Exp Event] O servidor alcançou "..rate[1].." jogadores online! O bônus de exp é de "..((rate[2] - 1)*100).."%!")
end
setGlobalStorageValue(config_weekend_exp.storage_bonus, 1) --Bonus ativado
return rate[2] --retornando a taxa de exp que deve ser adicionada
else
setGlobalStorageValue(config_weekend_exp.storage_bonus, -1)
end
end
return 1
end

function set_bonus_weekend_exp(cid, monster_name)
local rate_bonus = get_bonus_weekend_exp()
local monster = getMonsterInfo(monster_name)
if getGlobalStorageValue(config_weekend_exp.storage_bonus) == 1 then
if getConfigValue("experienceStages") == true then
doPlayerAddExp(cid, (monster.experience * getExperienceStage(getPlayerLevel(cid))) * rate_bonus)
doPlayerSendTextMessage(cid, 25, "[Player Bonus Exp Event] Você esta com "..((rate_bonus - 1)*100).."% de bônus de experiência.")
end
end
return true
end

exp potion (ACTION)
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 = 3.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},
[6542] = { tempo = 1800, experiencia = 5.0, quantidade = 1, texto = '[EGG DE EXP] --> Voce usou egg de exp [5x] Por 30 Minutos', textofinal = '[EGG DE EXP] --> Egg de exp [5x] Finalizada', storage = 33330, textoClasse = 19, efeito = 53},
[6543] = { tempo = 1800, experiencia = 7.0, quantidade = 1, texto = '[EGG DE EXP] --> Voce usou egg de exp [7x] Por 30 Minutos', textofinal = '[EGG DE EXP] --> Egg de exp [7x] Finalizada', storage = 33330, textoClasse = 19, efeito = 53},
[6544] = { tempo = 1800, experiencia = 9.0, quantidade = 1, texto = '[EGG DE EXP] --> Voce usou egg de exp [9x] Por 30 Minutos', textofinal = '[EGG DE EXP] --> Egg de exp [9x] Finalizada', storage = 33330, textoClasse = 19, efeito = 53},
[6545] = { tempo = 1800, experiencia = 11.0, quantidade = 1, texto = '[EGG DE EXP] --> Voce usou egg de exp [11x] Por 30 Minutos', textofinal = '[EGG DE EXP] --> Egg de exp [11x] Finalizada', storage = 33330, textoClasse = 19, efeito = 53},
[2328] = { tempo = 1800, experiencia = 13.0, quantidade = 1, texto = '[EGG DE EXP] --> Voce usou egg de exp [13x] Por 30 Minutos', textofinal = '[EGG DE EXP] --> Egg de exp [13x] 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