• 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 Voucher with Stages do not work.

Maziol

New Member
Joined
Jan 28, 2018
Messages
13
Reaction score
1
Hi Guys, maybe someone is able to help me? TFS 1.2 , I did Script for Exp voucher and its doesnt work. Everythink is fine, but the problem is, people dont get (x30) exp, when use voucher. My exp server is on stages. Until 600 lvl is x300 , and from lvl 600 to 999 is x10. Thats why i want to create voucher for exp x30 by 1 hour.
This is what happend when i use item voucher in game, it is removed from backpack like should and get message:
http://s5.ifotos.pl/img/Beztytulu_qnewxhw.jpg
So....
Items.xml
Code:
    <item id="8981" article="a" name="EXP Voucher x30">
        <attribute key="weight" value="2400" />
        <attribute key="description" value="x30 EXP Voucher by 1 hour." />

Actions.xml (of course i put exp.voucher.lua to folder)
Code:
<action itemid="8981" script="other/expvoucher.lua"/>

Expvoucher.lua
Code:
function onUse(cid, item, frompos, item2, topos)
local pausa = 60*60*1000 -- (1000 = 1 second)
local texto = "You have 30 times more experience for 1 hour, do not logout or else you will loose the bonus."
local exp = 30 -- How much you want over your experience, for example 2 is 2x your server's rates.
        doPlayerSendTextMessage(cid, 22, "Have fun with Your x30 EXP.")
        doRemoveItem(item.uid,1)
        Game.getExperienceStage(cid,exp)
        doSendMagicEffect(frompos,13)
        doPlayerSendTextMessage(cid,22,texto)
    end
function potion(pos, cid)
    doPlayerSetExperienceRate(pos,expfinal)
    doPlayerSendTextMessage(pos,22,textofinal)
end

Anybody know how to fix it please?
 
Expvoucher.lua

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(44445) >= os.time() then
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'You still have an experience boost.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end
    player:setStorageValue(44445, os.time() + 30 * 60) -- 2 * 60 mins * 60 secs = 2 hours
    player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have activated 30 minutes of extra experience.')
    item:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)
    return true
end

data/events/scripts - just delete stamina modifier currently and paste this

Code:
    -- Stamina modifier
    if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
        useStamina(self)

        local staminaMinutes = self:getStamina()
        if staminaMinutes > 2400 and self:isPremium() then
            exp = exp * 1.5
        elseif staminaMinutes <= 840 then
            exp = exp * 0.5
        end
    end

    if self:getStorageValue(44445) >= os.time() then
        exp = exp * 1.3 -- +30%
    end

    return exp
end
 
Back
Top