Olá TK,
Hoje trago para vocês um MOD bem interessante que encontrei na internet, a lógica é bem simples, você usa um item e ganha mais XP durante um tempo.
O item, a XP e o tempo são totalmente configuráveis, vocês podem mudar como quiserem.
FUNCIONA COM TFS 0.4 E DEVE FUNCIONAR COM 0.3.6 (NÃO TESTADO)
Eu vou testar com a minha versão 0.3.7 quando chegar em casa e edito o post para vocês.
Bem, então vamos ao script,
Abra a pasta "mods" do seu servidor e crie um arquivo chamado expscroll.xml, abra e coloque o seguinte código:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Experience Stages Scroll" version="1.0" author="TomCrusher" contact="otland.net" enabled="yes">
<action itemid="9004" event="script" value="expstagescroll.lua"/>
<creatureevent type="think" name="ExpStage" event="script" value="expstagescroll.lua"/>
<creatureevent type="login" name="ExpStageLogin" event="script" value="expstagescroll.lua"/>
</mod>
Agora em "mods/scripts", crie um arquivo chamado expstagescroll.lua e coloque este código:
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 == 9004
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
Configurando:
rate = 2, -- número que irá ser multiplicado pela sua exp rate básica (funciona com números quebrados, tais como 1.5 ou 0.2).
storage = 1000, -- storage que irá guardar o tempo
expstorage = 1100, -- storage que irá guardar a xp
register = 1200, -- storage que indica se o player está registrado no mod
time = 14400, -- tempo que falta para o buff do scroll acabar (o tempo é calculado em segundos, ex: 14400 segundos = 24 horas)
___________________________________________________________________________________________________________________________________
Créditos :
TomCrusher (OTland) - Desenvolveu o sistema
Eu - Traduzi e postei aqui.