Ir para conteúdo
  • 0
Entre para seguir isso  
potinho

Scripting (0.4) Exp Scroll Configuração

Pergunta

potinho    4
potinho

The OTX Server Version: (2.100 - 6000) - Codename: (FINAL)

Base:

7.72

Qual é a sua pergunta?

Olá, tenho o código abaixo. Quero que os jogadores tenham um exp buff por duas horas, mas quando uso outro pergaminho, parece que faltam 4 horas, como posso corrigir isso? Anexei a imagem.

 

Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:

Spoiler

local config = {
    rate = 2.0, -- Rate que vai ficar o Scroll.
    time = 2, -- Tempo dado pelo Scroll. 
    storage = 20011
} 

local function endExpRate(cid)
    if not isPlayer(cid) then
        return
    end

    doPlayerSetRate(cid, SKILL__LEVEL, 6.0)
    setPlayerStorageValue(cid, config.storage, -1)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local timeLeft = getPlayerStorageValue(cid, 20011)
    if timeLeft > os.time() then
        local timeTable = os.date('*t', timeLeft - (os.time() + 3600))
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, string.format("You still have %d %s %d %s %d %s left of extra experience.", timeTable.hour, timeTable.hour > 1 and "hours" or "hour", timeTable.min, timeTable.min > 1 and "minutes" or "minute", timeTable.sec, timeTable.sec > 1 and "seconds" or "second"))
        return true
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, string.format("Your extra experience rate is now: %d. It will last for %d hours.", config.rate, config.time))
    doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
    setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600 * 1000)
    addEvent(endExpRate, config.time * 3600 * 1000, cid)
    doRemoveItem(item.uid, 1)
    return true
end

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:

Spoiler

exp.JPG.d52e78ab036041ee9b318d2eee42d519.JPG

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

1 resposta a esta questão

Recommended Posts

  • 0
potinho    4
potinho

Utilizar o seguinte script em action/script:

local config = {
    rate = 2,
    time = 2, -- Hours of Exp Time
    storage = 20011
}
local function endExpRate(cid)
    if isPlayer(cid) == TRUE then
        doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
        setPlayerStorageValue(cid, config.storage, -1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
    end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, config.storage) < os.time() then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have experience rate x2 It will last for ".. config.time .." hours.")
        doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
        setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600)
        addEvent(endExpRate, config.time * 3600 * 1000, cid)
        doRemoveItem(item.uid, 1)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
    end
    return TRUE
end

E inserir em data\creaturescripts\scripts\login.lua:

last = math.ceil((getPlayerStorageValue(cid, 20011) - os.time())/60)
  if (getPlayerStorageValue(cid, 20011) > os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Extra experience rate is now: 2.0x than normal. It will last for ".. last .." minutes.")
        doPlayerSetRate(cid, SKILL__LEVEL, 2.0)
    else
        doPlayerSetRate(cid, SKILL__LEVEL, 1.0)
    end

 

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×