Hello guys,
I’ve been searching the forums about this problem of mine but I can’t find anything. My problem is how can I convert seconds into hours, then use it as a countdown timer. Just like in those games which uses energy refilling method.
So far this is what I have:
local function checkSlotTime() local curTime = os.time () print ("os time: " .. curTime) local slotLastUse = upSlotUsed -- this is the time when the user last used the slot machine. print ("slot last used: " .. slotLastUse) local timeSince = (curTime - slotLastUse) if timeSince \>= 21600 then -- 6 hours cooldown print ("slot is ready") else print ("slot is NOT ready") end end
what I want to achieve is convert the “slotLastUse” into hours if hours is not applicable, convert into minutes, if minutes is not applicable then, convert it into seconds. Then display how long the user will have to wait in order to used the slot machine.
I get the logic to it, but I can’t get it into codes, because time and dates freaks me out. I cannot fully understand it well.
Thanks in advance and for the help
Jam