• 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!

Solved Exp Scroll Problem ! HELP

Daniel Kopeć

Member
Joined
Dec 8, 2018
Messages
125
Solutions
4
Reaction score
12
Location
Poland
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

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
 
Solution
Lua:
local config = {
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    if ( getCreatureStorage(cid, STAMINA_BONUS_STORAGE) - os.time() ) > 1500 then
        local bonusTime = os.time() - getCreatureStorage(cid, STAMINA_BONUS_STORAGE) - 1500
        doPlayerAddStamina(cid, math.floor(bonusTime / 60) * 3 )
        doShowTextDialog(cid, 2160, "Bonusowa stamina dzieki spaniu: \n" .. math.floor(bonusTime / 60) * 3 .. " minut.")
        doCreatureSetStorage(cid, STAMINA_BONUS_STORAGE, 0)
    end

local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 2000)
doAddCondition(cid, condition)
  
local text = "- Witaj na Verbania OTS...
login script

Lua:
local config = {
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    if ( getCreatureStorage(cid, STAMINA_BONUS_STORAGE) - os.time() ) > 1500 then
        local bonusTime = os.time() - getCreatureStorage(cid, STAMINA_BONUS_STORAGE) - 1500
        doPlayerAddStamina(cid, math.floor(bonusTime / 60) * 3 )
        doShowTextDialog(cid, 2160, "Bonusowa stamina dzieki spaniu: \n" .. math.floor(bonusTime / 60) * 3 .. " minut.")
        doCreatureSetStorage(cid, STAMINA_BONUS_STORAGE, 0)
    end

local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 2000)
doAddCondition(cid, condition)
    
local text = "- Witaj na Verbania OTS, Oto lista podstawowych komend:\n!aol               -> Kup amulet of loss\n!bless             -> Kup blessy\n!exp             -> Sprawdz ile musisz zdobyc doswiadczenia na nastepny level\n!spells            -> Lista dostepnych czarów\n!kills             -> Zobacz ile masz fragów\n!bp lub !explorer             -> Kup bp z machete, pick, rope i shovel za 500gp\nCtrl+R             -> Zglos bledy administracji\n- Odwiedz nasza strone internetowa, by dowiedziec sie wiecej.\n// Verbania.zapto.org"
local useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
local loss = getConfigValue('deathLostPercent')

    if(loss ~= nil and not getPlayerPromotionLevel(cid) ~= 1) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 5)
    else
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * edit)
    end

    local lastLogin = getPlayerLastLoginSaved(cid)
    if(lastLogin > 0) then
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, text)
    else
        doPlayerSendOutfitWindow(cid)
    end

    
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
    registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, "HowManyLogIn")
    registerCreatureEvent(cid, "inquisitionPortals")
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "PythiusTheRotten")
    registerCreatureEvent(cid, "levelUp")
    registerCreatureEvent(cid, "BountyHunter")
    registerCreatureEvent(cid, "StartTp")
    registerCreatureEvent(cid, "ZombieAttack")
    registerCreatureEvent(cid, "VipCheck")
    registerCreatureEvent(cid, "RushCombat")
    registerCreatureEvent(cid, "RushAttack")
    registerCreatureEvent(cid, "RushDead")
    registerCreatureEvent(cid, "RushOutfit")
    registerCreatureEvent(cid, "KilledMonstersCounter")
    registerCreatureEvent(cid, "logowanie")
    registerCreatureEvent(cid, "advbr")
    registerCreatureEvent(cid, "fraglook")
    registerCreatureEvent(cid, "lvlitems1")
    registerCreatureEvent(cid, "lvlitems2")
    registerCreatureEvent(cid, "pointsforlvl")
    registerCreatureEvent(cid, "firstpoints")
    registerCreatureEvent(cid, "Kamulec")
    registerCreatureEvent(cid, "metin_death")
    registerCreatureEvent(cid, "MutePlayer")
    registerCreatureEvent(cid, "dailytask")
    registerCreatureEvent(cid, "BestPlayer")
    registerCreatureEvent(cid, "extraExperienceScroll")
    registerCreatureEvent(cid, "AntiMC")
    
    return true
end
Post automatically merged:

login script
any suggestions?
 
Last edited:
Lua:
local config = {
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    if ( getCreatureStorage(cid, STAMINA_BONUS_STORAGE) - os.time() ) > 1500 then
        local bonusTime = os.time() - getCreatureStorage(cid, STAMINA_BONUS_STORAGE) - 1500
        doPlayerAddStamina(cid, math.floor(bonusTime / 60) * 3 )
        doShowTextDialog(cid, 2160, "Bonusowa stamina dzieki spaniu: \n" .. math.floor(bonusTime / 60) * 3 .. " minut.")
        doCreatureSetStorage(cid, STAMINA_BONUS_STORAGE, 0)
    end

local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 2000)
doAddCondition(cid, condition)
  
local text = "- Witaj na Verbania OTS, Oto lista podstawowych komend:\n!aol               -> Kup amulet of loss\n!bless             -> Kup blessy\n!exp             -> Sprawdz ile musisz zdobyc doswiadczenia na nastepny level\n!spells            -> Lista dostepnych czarów\n!kills             -> Zobacz ile masz fragów\n!bp lub !explorer             -> Kup bp z machete, pick, rope i shovel za 500gp\nCtrl+R             -> Zglos bledy administracji\n- Odwiedz nasza strone internetowa, by dowiedziec sie wiecej.\n// Verbania.zapto.org"
local useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
local loss = getConfigValue('deathLostPercent')

    if(loss ~= nil and not getPlayerPromotionLevel(cid) ~= 1) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 5)
    else
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * edit)
    end

    local lastLogin = getPlayerLastLoginSaved(cid)
    if(lastLogin > 0) then
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, text)
    else
        doPlayerSendOutfitWindow(cid)
    end

  
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
    registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, "HowManyLogIn")
    registerCreatureEvent(cid, "inquisitionPortals")
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "PythiusTheRotten")
    registerCreatureEvent(cid, "levelUp")
    registerCreatureEvent(cid, "BountyHunter")
    registerCreatureEvent(cid, "StartTp")
    registerCreatureEvent(cid, "ZombieAttack")
    registerCreatureEvent(cid, "VipCheck")
    registerCreatureEvent(cid, "RushCombat")
    registerCreatureEvent(cid, "RushAttack")
    registerCreatureEvent(cid, "RushDead")
    registerCreatureEvent(cid, "RushOutfit")
    registerCreatureEvent(cid, "KilledMonstersCounter")
    registerCreatureEvent(cid, "logowanie")
    registerCreatureEvent(cid, "advbr")
    registerCreatureEvent(cid, "fraglook")
    registerCreatureEvent(cid, "lvlitems1")
    registerCreatureEvent(cid, "lvlitems2")
    registerCreatureEvent(cid, "pointsforlvl")
    registerCreatureEvent(cid, "firstpoints")
    registerCreatureEvent(cid, "Kamulec")
    registerCreatureEvent(cid, "metin_death")
    registerCreatureEvent(cid, "MutePlayer")
    registerCreatureEvent(cid, "dailytask")
    registerCreatureEvent(cid, "BestPlayer")
    registerCreatureEvent(cid, "extraExperienceScroll")
    registerCreatureEvent(cid, "AntiMC")
  
    return true
end
Post automatically merged:


any suggestions?
I fixed it. The error was in this script below. But REP++ for help
Lua:
local storage = 20014

local function endExpRate(cid)
    if isPlayer(cid) then
        doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
        setPlayerStorageValue(cid, storage, -1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
    end
end

function onLogin(cid)
    local storageValue = getPlayerStorageValue(cid, storage)
    local timeLeft = storageValue - os.time()
    if storageValue > os.time() then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Extra experience rate is now: 1.5x than normal. It will last for " .. (math.ceil(timeLeft/60)) .. " minutes.")
        doPlayerSetRate(cid, SKILL__LEVEL, 1.5)
        addEvent(endExpRate, timeLeft * 1000, cid)
    else
        doPlayerSetRate(cid, SKILL__LEVEL, 1.0)
    end
    return true
end
 
Solution
Back
Top