• 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+ Doubt about using date tfs 1.x

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,210
Solutions
35
Reaction score
206
I need to be able to get the table value, which is bigger and closer to the "timeNow"
the timeNow print the hours and minutes, exemple if i use print(timeNow), it print like this:
Code:
13:55
in this case, i need to get "14:30", because is the value bigger and closer to the timeNow

remembering that if timeNow is "22:00" hours for example, i need to get the next value that would be "00:10"
LUA:
local times = {
[1] = {"00:10", "04:30", "14:30", "16:30"},
[2] = {"02:30", "06:00", "10:30", "18:00"}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local timeNow = tostring(os.date("%X")):sub(1, 5)

    --need to get the table value, which is bigger and closer to the "timeNow"
    --remembering that if timeNow is "22:00" hours for example, i need to get the next value that would be "00:10" 
    return true
end
 
Last edited:
Back
Top