Browse docs

Death Screen

Reference for Death Screen in ambulancejob.

All 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.

client.lua
local accepted = exports["sky_ambulancejob"]:killPlayer("Overdose")
ArgumentTypeDescription
customReasonstring?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.

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?), or send the sky_ambulancejob:killPlayer client event with TriggerClientEvent.

Building a replacement UI? See External Death Screen for the complete setup, state contract, actions, error codes, and server API.

getDeathState()

  • Purpose: Returns a complete snapshot of the local player's death lifecycle, timer, action availability, AI Medic state, and detected cause.
  • Returns: table
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.
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.
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.
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.
exports["sky_ambulancejob"]:addTime(30)