Daniel Kopeć
Member
After using exp scroll gives 50% more experience.
But after the relog, it adds another 50% more.
How to fix it?
TFS 0.4 Tibia 8.6
Below is the script:
actions/scripts/expscroll.lua
But after the relog, it adds another 50% more.
How to fix it?
TFS 0.4 Tibia 8.6
Below is the script:
actions/scripts/expscroll.lua
Lua:
local config = {
rate = 1.5,
time = 0.5 * 60 * 60, -- (2 hours) in seconds
storage = 20014
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, config.storage) < os.time() then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have experience rate x2 It will last for ".. (config.time / 3600) .." hours.")
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
setPlayerStorageValue(cid, config.storage, os.time() + config.time)
addEvent(endExpRate, config.time * 1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have " .. (os.date('!%H:%M:%S', getPlayerStorageValue(cid, config.storage) - os.time())) .. " extra experience time left.")
end
return true
end