> 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-deathscreen/installation.md).

# Installation

A death screen for ESX. A player who goes down gets a bottom bar with a heartbeat line, a countdown ring, the cause of death and the number of medics on duty, plus a respawn button and a call medic button. Your ambulance script keeps the death state, the death camera and the revive path, this resource only replaces the on screen timer and the distress prompt.

### Dependencies

* es\_extended (ESX Legacy), 1.13.x and 1.14.x
* ox\_lib
* esx\_ambulancejob, or visn\_are, osp\_ambulance, wasabi\_ambulance, or your own death system (see Another ambulance script)

No database table and no SQL import.

{% hint style="info" %}
l-deathscreen is free on Tebex. It is still delivered with Cfx.re asset escrow, so you claim it through Tebex to get it onto your Cfx.re account, see Asset escrow.
{% endhint %}

### Steps

1. Drop the `l-deathscreen` folder into your `resources` directory.
2. Add it to your `server.cfg`, after es\_extended and ox\_lib:

   ```
   ensure l-deathscreen
   ```

   If the folder sits inside a bracket folder that is already ensured (for example `[lscripts]`), no extra line is needed.
3. Make the small esx\_ambulancejob edit below. On esx\_ambulancejob this step is required.
4. Open `config.lua` and set the language, the timers and the respawn points.
5. Optional: set the Discord webhook in `server_config.lua`.
6. Restart the server.

### The esx\_ambulancejob edit

esx\_ambulancejob has no setting for a custom death screen, so one small edit is needed. Without it the old text timer and the G distress prompt draw on top of the new screen, and both respawn timers run at the same time.

Open `esx_ambulancejob/client/main.lua`, find `OnPlayerDeath()` and wrap the two UI calls so they are skipped while l-deathscreen runs:

```lua
local hasDeathscreen = GetResourceState('l-deathscreen') == 'started'
if not hasDeathscreen then
    StartDeathTimer()
end
StartDeathCam()
isDead = true
StartDeathLoop()
if not hasDeathscreen then
    StartDistressSignal()
end
```

Do not remove the whole `OnPlayerDeath()` call. The death camera, the death animation, the dead state and the revive path stay in esx\_ambulancejob on purpose.

Redo this edit whenever you update esx\_ambulancejob. If you stop or remove l-deathscreen, the stock death screen comes back on its own, no revert needed.

### What keeps working, what is ignored

Still used from esx\_ambulancejob: `RemoveWeaponsAfterRPDeath`, `RemoveCashAfterRPDeath` and `RemoveItemsAfterRPDeath`, the death animation, the death camera and the whole revive path. A medic revives exactly like before, which also closes the screen.

Ignored while l-deathscreen runs: `EarlyRespawnTimer` and `BleedoutTimer`, replaced by `Config.RespawnDelay` and `Config.AutoRespawn`, `EarlyRespawnFine`, replaced by `Config.EarlyRespawn`, and the esx\_ambulancejob `RespawnPoints`, replaced by `Config.RespawnPoints`. Keep the hospitals in both files in sync if you move them.

es\_extended needs no changes. With `Config.SaveDeathStatus = true` in esx\_ambulancejob a player who disconnects while dead logs back in dead, and the death screen opens again on its own.

### The death camera speed

Not required, but worth doing. The death camera in esx\_ambulancejob feeds the raw mouse input in as radians, so one mouse movement can swing the camera around 57 degrees in a single frame. It is very noticeable now that a player actually looks around while waiting.

Add a setting to `esx_ambulancejob/config.lua`:

```lua
Config.deathcam = {
    sensitivity = 0.2
}
```

Then in `esx_ambulancejob/client/deathcam.lua`, next to the existing `local zoom = Config.zoom`:

```lua
local sensitivity = (Config.deathcam and Config.deathcam.sensitivity) or 0.2
```

and multiply both mouse axes in `ProcessNewPosition`:

```lua
x -= GetDisabledControlNormal(0, 1) * sensitivity
y -= GetDisabledControlNormal(0, 2) * sensitivity
```

Lower the value for a calmer camera, raise it for a snappier one. The fallback keeps the file working even without the config entry.

### Which files you can edit

The escrow leaves these files open:

| File                                           | What is in it                                                                                            |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `config.lua`                                   | Timers, early respawn, the screen effect, the HUD, the cursor key, the medic mode and the respawn points |
| `server_config.lua`                            | Discord logging                                                                                          |
| `locales/en.lua`, `locales/de.lua`             | Every text                                                                                               |
| `shared/functions.lua`                         | Notifications, the dispatch blocks and your HUD                                                          |
| `shared/ambulance.lua`                         | Which death system the resource works with                                                               |
| `client/framework.lua`, `server/framework.lua` | How player data and money are read from ESX                                                              |
| `html/`                                        | The complete interface, every colour sits in `html/style.css`                                            |

{% hint style="warning" %}
The folder has to keep the name `l-deathscreen`. Under another name the script does nothing and prints a red line in the server console every minute until the folder name is fixed.
{% endhint %}

### Update check

With `Config.VersionCheck = true` the resource checks for a newer version once on start. A green line in the server console means you run the latest version, a yellow line names the newer version and links to lscripts.cc. A red line means the check got no usable answer, for example because your server has no outgoing internet access. The resource keeps working either way. Set `Config.VersionCheck = false` to turn the check off.
