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

Lua Exp Bonus

Ü Pendragon

Member
Joined
Apr 10, 2017
Messages
51
Reaction score
6
Hello everyone. Could someone help me with this, I want to make a 10% bonus for having a client 12 and a 10% bonus for having a premium. But I think that the 2 codes collapse, the percentage does not give well it is disproportionate. Because if I remove 1 the other works fine. Thanks in advance:)
Lua:
-- Client 12 Bonus Experience
    local clientVersion = self:getClient().version
    if clientVersion >= 1200 then
        exp = exp * 1.1
    end

    -- Apply extra experience to Premium account
    if self:isPremium() then
        exp = exp * 1.1
    end
 
Solution
This should work as you want it to work

Lua:
local featureBonus = 0

-- Client 12 Bonus Experience
local clientVersion = self:getClient().version
if clientVersion >= 1200 then
    featureBonus = featureBonus + 10
end

-- Apply extra experience to Premium account
if self:isPremium() then
    featureBonus = featureBonus + 10
end

exp = exp * (1 + (featureBonus / 100))
This should work as you want it to work

Lua:
local featureBonus = 0

-- Client 12 Bonus Experience
local clientVersion = self:getClient().version
if clientVersion >= 1200 then
    featureBonus = featureBonus + 10
end

-- Apply extra experience to Premium account
if self:isPremium() then
    featureBonus = featureBonus + 10
end

exp = exp * (1 + (featureBonus / 100))
 
Solution
This should work as you want it to work

Lua:
local featureBonus = 0

-- Client 12 Bonus Experience
local clientVersion = self:getClient().version
if clientVersion >= 1200 then
    featureBonus = featureBonus + 10
end

-- Apply extra experience to Premium account
if self:isPremium() then
    featureBonus = featureBonus + 10
end

exp = exp * (1 + (featureBonus / 100))
It works thank you.
 
Back
Top