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

Exp booster with max level

Joined
Apr 6, 2014
Messages
119
Reaction score
51
Hello there,

i'm using tfs 0.4.0 and i'm trying to get an exp booster to work with a max level on it,
but since u guys see me writing here i failed xD.
Supposed to give me 50% more exp

anyone could help me? would be appreciated.


Grtz,
 
im based on this


Code:
local config = {
    rate = 2,
    storage = 1000,
    expstorage = 1100,
    register = 1200,
    time = 14400,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, config.storage) <= 0 then
        local rates = getPlayerRates(cid)
        setPlayerStorageValue(cid, config.expstorage, rates[SKILL__LEVEL])
        setPlayerStorageValue(cid, config.register, 1)
        itemEx=itemid == 12673
        doCreatureSay(cid, "Your extra experience rate has been activated! It now is: " .. config.rate .. "x added to your former experience rate.", TALKTYPE_ORANGE_1, true, cid)
        setPlayerStorageValue(cid, config.storage, os.time()+config.time)
        doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]*config.rate)
        doRemoveItem(item.uid,1)
        registerCreatureEvent(cid, "ExpStage")
    else
        doCreatureSay(cid, "You must finish first exp condition to start other exp condition !", TALKTYPE_ORANGE_1, true, cid)
    end
return true
end
function onThink(cid, interval)
    if getPlayerStorageValue(cid, config.register) == 1 then
        if getPlayerStorageValue(cid, config.storage) <= os.time() then
            doCreatureSay(cid, "Your extra experience rate has finished! It is now normaly experience rate.", TALKTYPE_ORANGE_1, true, cid)
            setPlayerStorageValue(cid, config.storage, 0)
            setPlayerStorageValue(cid, config.register, 0)
            local oldexp = getPlayerStorageValue(cid, config.expstorage)
            doPlayerSetExperienceRate(cid, oldexp)
            unregisterCreatureEvent(cid, "ExpStage")
        end
    end
return true
end
function onLogin(cid)
    if getPlayerStorageValue(cid, config.register) == 1 then
        registerCreatureEvent(cid, "ExpStage")
        local rates = getPlayerRates(cid)
        doCreatureSay(cid, "Your extra experience rate is still here! It is: " .. config.rate .. "x added to your former experience rate.", TALKTYPE_ORANGE_1, true, cid)
        if getPlayerStorageValue(cid, config.storage) > os.time() then
        local oldexp = getPlayerStorageValue(cid, config.expstorage)
        doPlayerSetExperienceRate(cid, oldexp*config.rate)
        end
    end 
return true
end


but if i add max level to it i just can't use it, or it debugs me..
anyone could add a quick fix so i know next time how to use it?
 
i tried adding

  1. config =
  2. {
  3. minlevel = 0,
  4. maxlevel = 150
  5. }

  6. function onUse(cid, item, fromPos, itemEx, toPos)
  7. if (getPlayerLevel(cid) < config.minlevel or getPlayerLevel(cid) > config.maxlevel) then
  8. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your level is to high to use this booster."



i'm pretty new in this so i'm learning alot, did alot on the project i'm working on.
just can't figure this out.
 
Back
Top