> For the complete documentation index, see [llms.txt](https://lscripts.gitbook.io/lscripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lscripts.gitbook.io/lscripts/scripts/l-deathtimeout/exports.md).

# Exports

The server side can set, extend, shorten, clear and read a block from another script. The client side is read only on purpose, so nothing running on a player's machine can lift their own block.

### Server

| Export                                                    | Description                                                                                                                                   |
| --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `exports['l-deathtimeout']:Set(source, seconds)`          | Sets or overwrites the block, the bypass list is ignored. Leave `seconds` out and the player's job duration is used, like after a real death. |
| `exports['l-deathtimeout']:Start(source, seconds, force)` | The same, but the bypass list still applies unless `force` is `true`.                                                                         |
| `exports['l-deathtimeout']:Add(source, seconds)`          | Adds seconds to a running block. A negative value takes them off.                                                                             |
| `exports['l-deathtimeout']:Clear(source)`                 | Lifts the block.                                                                                                                              |
| `exports['l-deathtimeout']:Stop(source)`                  | Same as `Clear`, the older name.                                                                                                              |
| `exports['l-deathtimeout']:IsActive(source)`              | `true` while the block runs.                                                                                                                  |
| `exports['l-deathtimeout']:GetRemaining(source)`          | Seconds left.                                                                                                                                 |

```lua
exports['l-deathtimeout']:Set(source, 120)
exports['l-deathtimeout']:Add(source, 30)
exports['l-deathtimeout']:Clear(source)
```

`Set` is the one to use when your own script decides that this player is blocked now, for example a jail release or an admin tool. `Start` is the one to use when you want the same rules a real death gets, including the bypass list.

`Set`, `Start` and `Add` return `true` when the block was started or changed, and `false` when nothing happened: the player is offline, the seconds come out as `0`, or, for `Start`, the player is on the bypass list. `Add` with a negative value that uses up the rest of the block lifts it completely. `Clear` and `Stop` return `true` when there was a block to lift.

### Client

| Export                                     | Description                  |
| ------------------------------------------ | ---------------------------- |
| `exports['l-deathtimeout']:IsActive()`     | `true` while the block runs. |
| `exports['l-deathtimeout']:GetRemaining()` | Seconds left.                |

### Statebag and event

The player carries the end time in the statebag `Player(source).state.deathTimeout`, a unix timestamp, `nil` when nothing is running. Any other resource can read it on both sides without calling an export.

On the client the event `l-deathtimeout:changed` fires whenever the state changes:

```lua
AddEventHandler('l-deathtimeout:changed', function(active, seconds)
end)
```

`active` is a boolean and `seconds` is what is left of the block. That is the hook to use if you want your own HUD to show the block instead of, or next to, the bar this resource draws.
