Page 1 of 1

Elapsed time from Rocket Rush

Posted: Thu Mar 05, 2020 11:51 am
by XaLpHa89
The scenario is about time, only it is annoying to have to enter the command /time all the time, so it would be nice if the following function is shown in the header.
20200305122230_1.jpg
20200305122230_1.jpg (2.54 KiB) Viewed 995 times

Code: Select all

function seconds_to_clock( seconds )
    local seconds = tonumber( seconds )
    if seconds <= 0 then
        return '00:00:00'
    else
        local hours = string.format( '%02.f', math.floor( seconds / 3600 ) )
        local minutes = string.format( '%02.f', math.floor( seconds / 60 - ( hours * 60 ) ) )
        seconds = string.format( '%02.f', math.floor( seconds - hours * 3600 - minutes * 60 ) )
        return hours .. ':' .. minutes .. ':' .. seconds
    end
end

Re: Elapsed time from Rocket Rush

Posted: Fri Mar 06, 2020 4:59 pm
by conn11
agreed +1