# Death Screen

> Reference for Death Screen in ambulancejob.

[All client exports](/docs/jobs/ambulancejob/api/client-exports)

## Death Screen

### `killPlayer(customReason?)`

Kills the local player through the normal ambulance death flow. Use the optional reason for integrations such as overdose systems; the text appears on the death screen and in the paramedic diagnosis UI.

```lua [client.lua]
local accepted = exports["sky_ambulancejob"]:killPlayer("Overdose")
```

<table>
<thead>
  <tr>
    <th>
      Argument
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        customReason
      </code>
    </td>
    
    <td>
      <code>
        string?
      </code>
    </td>
    
    <td>
      Optional display text. Leading and trailing whitespace is trimmed. The result must contain 1–120 Unicode characters, valid UTF-8, and no ASCII control characters. Supply the translated text from your integration's locale.
    </td>
  </tr>
</tbody>
</table>

Returns `true` when the death flow starts and `false` when the request is rejected, including invalid text, an already dead player, or a blocked death. Invalid text does not kill the player. Omit the argument or pass `nil` to retain the existing `suicide` behavior. Custom text changes the displayed reason; the existing forced-death injury rules still apply.

The reason is stored as `profile.death.customReason` and exposed as `getDeathState().cause.customReason`. The bundled death-screen NUI receives it as `customDeathReason`.

For a server integration, use [`killPlayer(playerId, customReason?)`](/docs/jobs/ambulancejob/api/server-exports#killplayerplayerid-customreason), or send the [`sky_ambulancejob:killPlayer` client event](/docs/jobs/ambulancejob/api/client-events#sky_ambulancejobkillplayer) with `TriggerClientEvent`.

<callout color="info" icon="i-lucide-panels-top-left">

Building a replacement UI? See [External Death Screen](/docs/jobs/ambulancejob/api/external-death-screen)
for the complete setup, state contract, actions, error codes, and server API.

</callout>

### `getDeathState()`

- **Purpose**: Returns a complete snapshot of the local player's death lifecycle, timer, action availability, AI Medic state, and detected cause.
- **Returns**: `table`

```lua
local state = exports["sky_ambulancejob"]:getDeathState()
```

### `requestDeathAction(action, payload?)`

- **Purpose**: Requests a server-validated dispatch, early respawn, AI Medic, or AI Medic offer response.
- **Arguments**:

  - `action` (`string`): `request_dispatch`, `request_early_respawn`, `request_ai_medic`, or `respond_ai_medic_offer`.
  - `payload` (`table?`): Optional action payload.
- **Returns**:

  - `boolean`: Whether the request was accepted.
  - `table`: Success data or a failure object containing `code` and `message`.

```lua
local success, result = exports["sky_ambulancejob"]:requestDeathAction("request_dispatch")
```

### `open()`

- **Purpose**: Opens the bundled death screen UI. Returns `external_deathscreen_active` when external mode is active.

```lua
exports["sky_ambulancejob"]:open()
```

### `updateTime(seconds)`

- **Purpose**: Updates the bundled death-screen timer to a specific value. Returns `external_deathscreen_active` when external mode is active.
- **Arguments**:

  - `seconds` (`number`): The new timer value in seconds.

```lua
exports["sky_ambulancejob"]:updateTime(120)
```

### `addTime(seconds)`

- **Purpose**: Adds time to the bundled death-screen timer. Returns `external_deathscreen_active` when external mode is active.
- **Arguments**:

  - `seconds` (`number`): Seconds to add.

```lua
exports["sky_ambulancejob"]:addTime(30)
```

<br />
