Basically, I’m making a temporary ban system and I want to calculate the number of hours and days until a ban is lifted and I am unsure how to do it.
Currently, to see if a person is banned, the server does the following calculation:
if tonumber(tab[i].BanStart) - os.time() > tonumber(tab[i].BanTime) then
Please note: BanStart is the os.time() of the server when the player was banned, and BanTime is the number of seconds they were banned for, in days or hours.
If the value is less than, it will ban them. I just want to display how many hours and minutes it will be until they are unbanned. I have the following function to convert it into hours and minutes.
local function toHMS(s) return ("%02i hours and %02i minutes"):format(s/60^2, s/60%60) end
I’m pretty sure it’s something easy. Maths is not a subject I’m good at
Many thanks in advance!