# setTimerPaused (Shared)

> Pauses or resumes a timer. While paused it keeps the time it had left and is not called.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Timers and async
- **URL**: https://wiki.mymp.gg/en/setTimerPaused

## Syntax

```lua
bool setTimerPaused(timer timer, bool paused)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `timer` | `timer` | The timer, the number `setTimer` returned. |
| `paused` | `bool` | `true` to pause, `false` to resume. |

## Returns

`true` if it changed, `false` if the timer does not exist in this resource.

## Example

```lua
local round = setTimer(function()
    outputDebugString("round over")
end, 120000, 1)
local paused = false

addCommandHandler("pause", function()
    paused = not paused
    setTimerPaused(round, paused)
end)
```

## See also

- [setTimer (Shared)](https://wiki.mymp.gg/en/setTimer.md): Calls a function after an interval, once or repeatedly.
- [getTimerDetails (Shared)](https://wiki.mymp.gg/en/getTimerDetails.md): Reads a timer's state: how long is left, how many repeats remain and its interval.
- [resetTimer (Shared)](https://wiki.mymp.gg/en/resetTimer.md): Starts a timer's countdown over, with the same interval. The repeats left do not change.
