Ir para conteúdo

talkaction to exp boost/pot mod


malyfanek

Posts Recomendados

Hello as the title sais i need small(? for sure not small for me) help with the talkaction, ok here's the script:


local config = { 
    rate = 2,
    storage = 10000,
    expstorage = 10100,
    register = 10200,
    exh = 10300,
    time = 120, -- sekundy
}

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 == 12289
        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

 


function onSay(cid)


local last = math.floor((getPlayerStorageValue(cid, 10000) - os.time())/60)  -- minuty
local last2 = ((getPlayerStorageValue(cid, 10000) - os.time()))  -- sekundy

    
  

if isPlayer then
if getPlayerStorageValue(cid, config.register) == 1 then
    doPlayerSendCancel(cid, 'Your bonus experience time  : '.. (last2).. ' seconds.')
end

if getPlayerStorageValue(cid, config.register) == 0 then
        doPlayerSendCancel(cid, 'You dont have any exp bonus!')
        end
    end
    return true
end

And the thing is as i wrote i need talkaction for players to check how much time of exp booster/exp potion, name it as u want the player got left of time. Well all is fine but it shows only in senconds, so here's my request, how to make it show hh:mm:ss? Please help ;x 

TFS 0,4 tibia 8,6 rev 3777

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...