M MY Multiplayer: Wiki
Side
Kind

getTimerDetails

Shared

Reads a timer's state: how long is left, how many repeats remain and its interval.

float|false getTimerDetails(timer timer)

Parameters

NameTypeDescription
timertimerThe timer, the number setTimer returned.

Returns

Three values: the milliseconds until the next call, the repeats left (0 if it repeats forever) and the interval in milliseconds. false if the timer does not exist in this resource.

Example

local round = setTimer(function()
    outputDebugString("round over")
end, 120000, 1)

addCommandHandler("timeleft", function()
    local left = getTimerDetails(round)
    if left then
        outputDebugString(math.ceil(left / 1000) .. " seconds left")
    end
end)

See also