• 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 Daily/hourly chest open times

MadMOOK

Hoo
Joined
Apr 20, 2011
Messages
802
Reaction score
43
Code:
15:19 You must wait 2 hours to get your hourly quest. Next available will be at: 14:52:34.
See the differant time stamps??
I need it be be openable in 2 hours, the time formula that I have does not work....

Code:
  setPlayerStorageValue(cid, 13544, os.time() + 1 * 2 * 60 * 60 * 1000)

I have others that is openable for 24 hours like this
Code:
  setPlayerStorageValue(cid, 13544, os.time() + 1 * 24 * 60 * 60 * 1000)
and it works... but I just changed the 24 to 2 and it doesnt work..
 
Thanks @seleo but none of it helps. I need to know how to make time a formula that the server will actualy read. I can do a day formula but I dont know how to change it to hourly... :(
 
try this
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local daysvalue = 1 * 2 * 60 * 60
local daily = getPlayerStorageValue(cid, 13541)
if (daily == -1) then
daily = 0
end
if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
doPlayerAddItem(cid, 2160, 1)
time = os.time() + daysvalue
setPlayerStorageValue(cid, 13540, time)
setPlayerStorageValue(cid, 13541, daily+1)
local daily = getPlayerStorageValue(cid, 13541)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You done your " .. daily .. " Hourly Quest. You got 1 cc.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must wait 2 Hours to get your hourly quest. Next avaiable will be at: " .. os.date("%H:%M:%S", getPlayerStorageValue(cid, 13540)) .. ".")
end
return true
end
 
There is no need for a formula. The time is in seconds. So a hour delay would be 3600.
It is just written as 60 * 60 etc. to make it easier to read in most cases.
If you really wish support you should just post the script so we don't have to guess.
 
@Summ
Code:
--credits to Leon Zawo
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local pos = {x=999, y=999, z=7}
    local daily = getPlayerStorageValue(cid, 13545)
    if (daily == -1) then
            daily = 0
    end
    if getPlayerStorageValue(cid, 13544) - os.time() <= 0 then
        doPlayerAddItem(cid, 8306, 1)
        setPlayerStorageValue(cid, 13544, os.time() + 1 * 2 * 60 * 60 * 1000)
        doTeleportThing(cid,pos)
        setPlayerStorageValue(cid, 13545, daily+1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You done your " .. getPlayerStorageValue(cid, 13545) .. " Low level daily. You got 1 chance upgrade stone.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must wait 24 hours to get your daily quest. Next available will be at: " .. os.date("%H:%M:%S", getPlayerStorageValue(cid, 13542)) .. ".")
    end
return true
end
 
Soon this line?
Code:
setPlayerStorageValue(cid, 13544, os.time() + 1 * 2 * 60 * 60 * 1000)

I can do this???
Code:
setPlayerStorageValue(cid, 13544, os.time() + 7200)
 
ok, when i do that. i do not get the message that gives you the time to open next, it opens chest like a normal chest and gives me this error.
gayyy.png

This is the 24hour chest
Code:
19:07 You must wait 24 hours to get your daily quest. Next available will be at: 14:55:59.
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local pos = {x=999, y=999, z=7}
    local daily = getPlayerStorageValue(cid, 13545)
    if (daily == -1) then
            daily = 0
    end
    if getPlayerStorageValue(cid, 13544) - os.time() <= 0 then
        doPlayerAddItem(cid, 8306, 1)
        setPlayerStorageValue(cid, 13544, os.time() + 2 * 60 * 60)
        doTeleportThing(cid,pos)
        setPlayerStorageValue(cid, 13545, daily+1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You done your " .. getPlayerStorageValue(cid, 13545) .. " Low level daily. You got 1 chance upgrade stone.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must wait 2 hours to get your daily quest. Next available will be at: " .. os.date("%H:%M:%S", getPlayerStorageValue(cid, 13542)) .. ".")
    end
return true
end

2 hours.
CLEAR THE STORAGE VALUE WITH ID "13544" IN DATABASE!
 
Back
Top