ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. isTimer

Function

isTimer

Server and clientTimersIdentical to MTA:SA

Checks whether a value is an active timer. A one-shot timer stops being active after it fires.

Syntax

bool isTimer(mixed timer)

Arguments

timermixed
The value.

Returns

true for an active timer.

Example

local respawnTimer
addEventHandler("onPlayerWasted", root, function()
    if isTimer(respawnTimer) then killTimer(respawnTimer) end
    local player = source
    respawnTimer = setTimer(function()
        spawnPlayer(player, 0, 0, 3)
    end, 5000, 1)
end)

See also