• 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 Help with Bonus Exp

Godshiryu

New Member
Joined
Mar 15, 2010
Messages
40
Reaction score
0
Olá. Tenho um servidor e estou com o seguinte problema.
Um player vip ganha 30% mais de exp.
Um player que conquistou o castelo de guerra, ganha 20% mais de exp.
Se um player é vip e conquistou o castelo, ele ganha apenas 30% de exp (que é so vip).
Como fazer pra que ganhe os 50%? (30% vip + 20% castle)
Grato!
-------------------------------------------------------------------------------------
Hello, I have a server and I'm with the following problem:
One player vip get 30% more exp than free players.
One player who won the castle of war, get 20% more exp than players without conquest.
If a player are vip, and conquered the castle, he earns only 30% bonus exp (Vip).
What I do to the player win the 50% bonus exp? (30% vip + 20% castle)
Thank you very much!

Sorry for my bad english, I'm from Brazil :S

EDIT:
A action que faz o player ganhar 30% mais exp por ser vip é a seguinte:
The action that causes the player to gain 30% more exp for being vip is as follows:
Code:
function onLogin(cid)

local rate = 1.3 -- 30%
local config = {
vip = "Você tem "..((rate - 1)*100).."% de exp a mais agora!",
notvip = "Tornesse vip e ganhe "..((rate - 1)*100).."% a mais de experiencia!",
}

if vip.hasVip(cid) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.notvip)
else
doPlayerSetExperienceRate(cid, rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.vip)
end
return TRUE
end

A Action que faz o player ganhar 20% mais exp pelo castelo é a seguinte:
The Action that makes the player earn 20% more exp the castle is as follows:
Code:
dofile("./_woe.lua")

function onLogin(cid)
    Woe.getInfo()
    local Guild_ID = getPlayerGuildId(cid)
    if (Guild_ID == infoLua[2]) and (infoLua[2] ~= 0) then
        doPlayerSetExperienceRate(cid, 1.20)    -- here 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your guild has won the last War of Emperium, for that reason you have 20% extra experience.")
    end
    return true
end

Ok, I already solved my Problem.
If anyone more need, put this tag on creaturescripts.xml
Code:
<event type="login" name="WoeEVipexp" event="script" value="vipecastleexp.lua"/>
and, inside scripts, create vipecastleexp.lua with that inside:
Code:
dofile("./_woe.lua")
function onLogin(cid)
    Woe.getInfo()
    local Guild_ID = getPlayerGuildId(cid)
local rate = 1.5 -- 50%
local config = {
vipecastle = "Logo voce tem "..((rate - 1)*100).."% de exp a mais por ter conquistado o castelo e ser vip!",
notviporcastle = "Tornesse vip e ganhe "..((rate - 1)*100).."% a mais de experiencia!",
}

if (vip.hasVip(cid) == TRUE) and (Guild_ID == infoLua[2]) and (infoLua[2] ~= 0) then
doPlayerSetExperienceRate(cid, rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.vipecastle)
else

end
return TRUE
end
Thanks all anyway!
 
Last edited by a moderator:

Similar threads

Back
Top