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

TFS 1.X+ Check time storage

ssiwyy158

Member
Joined
Jan 24, 2011
Messages
128
Solutions
2
Reaction score
13
Hello. How to write a script checking the duration of the xp bonus from this script ? :

tfs 1.2

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(98546) >= os.time() then
        player:say('You already have exp bonus!', TALKTYPE_MONSTER_SAY)
        return true
    end
 
    player:setStorageValue(98546, os.time() + 3600)
    Item(item.uid):remove(1)
    player:say('Your 1 hours of 20% XP has started!', TALKTYPE_MONSTER_SAY)
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
    return true
end
 
You want to check the duration left?

This will give you seconds left until it ends:
(player:getStorageValue(98546) - os.time())

Can you solve the rest yourself?
 
You want to check the duration left?

This will give you seconds left until it ends:
(player:getStorageValue(98546) - os.time())

Can you solve the rest yourself?
I try:
Lua:
function onSay(cid, words, param)
    local player = Player(cid)

    local remaining = getPlayerStorageValue(cid, 98546) - os.time()
    if remaining == 0 then
        player:sendCancelMessage("You do not have boost")
    else
        
     doCreatureSay(cid, "You have " .. remaining .. " seconds remaining until your extra experience expires.", TALKTYPE_ORANGE_1, true, cid)
    end
    return false
end

but :
when the bonus is not active :
1.png

When Active:
2.png

When active it shows good but when it is not active shows large numbers
 
Back
Top