E
Evil Puncker
Guest
Hi everyone, currently the script bellow displays the following:
how do I make it not display the days and hours if they are zero? like this:
and if you could add singular and plural (1 hours > 1 hour), even better
Elapsed time: 0 days, 0 hours, 13 minutes."
how do I make it not display the days and hours if they are zero? like this:
Elapsed time: 13 minutes."
and if you could add singular and plural (1 hours > 1 hour), even better

LUA:
local str = ""
local secs = ""
secs = 1554654 -- fictional value
-- converting secs --
local hours = math.ceil(secs / 3600) - 1
local minutes = math.ceil((secs - (3600 * hours)) / 60)
if (minutes == 60) then
minutes = 0
hours = hours + 1
end
local days = math.ceil(hours / 24) - 1
hours = math.ceil(hours - (24 * days))
if (hours == 24) then
hours = 0
days = days + 1
end
-- end of conversion --
str = "Elapsed time: ".. days .." days, ".. hours .." hours, ".. minutes .." minutes."
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, str)
return true