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

TFS 1.2 Exp boost do not work

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
1,067
Solutions
5
Reaction score
63
No errors in console just doesnt work. It sends text that i have double exp and etc but i cant see exp increase.
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(1234) >= os.time() then
        player:say('You already have double exp!', TALKTYPE_MONSTER_SAY)
        return true
    end

    player:setStorageValue(1234, os.time() + 86400)
    Item(item.uid):remove(1)
    player:say('Your 24 hours of double XP has started!', TALKTYPE_MONSTER_SAY)
    return true
end

function Player:onGainExperience(source, exp, rawExp)
    if self:getStorageValue(1234) >= os.time() then
        exp = exp * 2
    end
    return exp
end
XML:
<action itemid="8266" script="expboost.lua"/>
 
Solution
man action scripts executes when a player uses an item
u cant just magically add things like to make it execute everytime a player gains exp
function Player:eek:nGainExperience(source, exp, rawExp)
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
return exp
end
thats not how it works xD just add it in players.lua mans
Why are you trying to redefine experience gain with in an action script? Why not just execute this in player.lua?

When in doubt use a print function to determine which one is executing.
 
Why are you trying to redefine experience gain with in an action script? Why not just execute this in player.lua?

When in doubt use a print function to determine which one is executing.
Is there a difference if it doesnt work in action why should it work in player.lua
 
man action scripts executes when a player uses an item
u cant just magically add things like to make it execute everytime a player gains exp
function Player:eek:nGainExperience(source, exp, rawExp)
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
return exp
end
thats not how it works xD just add it in players.lua mans
 
Solution
man action scripts executes when a player uses an item
u cant just magically add things like to make it execute everytime a player gains exp
function Player:eek:nGainExperience(source, exp, rawExp)
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
return exp
end
thats not how it works xD just add it in players.lua mans
Aaa it works now :D
 
Back
Top