Death·exports

Exports

DS-Death exposes a couple of net events you can trigger from any script, three client-side exports for state queries / nearby revives, and a set of config-level hooks for plugging in your own triggers on death, revive, respawn, and so on.

Events

Events are the easiest integration point — fire them from your ambulance job, phone, mini-game, or admin tool.

DS-Death:revive

Revives the local player (or the targeted player when triggered from the server). Use this to wire DS-Death into existing revive flows like the ESX ambulance job's esx_ambulancejob:revive handler.

Lua
-- Client side
TriggerEvent('DS-Death:revive')

-- Server side (revives the player whose source is passed in)
TriggerClientEvent('DS-Death:revive', source)

DS-Death:lockAnim

Locks or unlocks DS-Death's death animation. Useful when another system (ambulance job, custom revive minigame) wants to play its own animation while keeping the player in DS-Death's knocked state. Pass true to lock, false to release.

Lua
-- Client side
TriggerEvent('DS-Death:lockAnim', true)   -- lock the death animation
TriggerEvent('DS-Death:lockAnim', false)  -- release it

-- Server side (target a specific player)
TriggerClientEvent('DS-Death:lockAnim', source, true)

Exports

All three exports run on the client. The state queries accept an optional server ID — pass nothing to ask about the local player.

ReviveNear

client

Looks for any knocked players around the local player and tries to revive the closest one. The script handles the item check, the progress bar, and the revive event so you only need to wire this export to whichever interaction trigger you prefer (item use, target option, keybind).

Signature

Lua
exports['DS-Death']:ReviveNear()

Example

Lua
-- e.g. from a usable-item handler or a target option
exports['DS-Death']:ReviveNear()

isPlayerDead

client

Returns whether the given player is fully dead (waiting for respawn). Pass a server ID to query another player; pass nothing to check the local player.

Signature

Lua
exports['DS-Death']:isPlayerDead(serverId)

Parameters

NameTypeDescription
serverId?numberServer ID of the player to query. Defaults to self.

Returns

boolean

true while the player is fully dead, false otherwise.

Example

Lua
if exports['DS-Death']:isPlayerDead() then
  -- block phone, inventory, etc.
end

isPlayerKnocked

client

Returns whether the given player is currently knocked (down but still revivable). Same shape as isPlayerDead — server ID is optional and defaults to self.

Signature

Lua
exports['DS-Death']:isPlayerKnocked(serverId)

Parameters

NameTypeDescription
serverId?numberServer ID of the player to query. Defaults to self.

Returns

boolean

true while the player is knocked and waiting for revive.

Example

Lua
local target = GetClosestPlayer()
if exports['DS-Death']:isPlayerKnocked(GetPlayerServerId(target)) then
  -- show "Revive" prompt
end

Config hooks

Beyond events and exports, config.lua ships with a handful of empty functions you can extend without touching the escrowed core. Drop your own triggers/exports inside any of these.

  • OnKnocked, OnDeath, OnRevive, OnRespawn — fired on the matching player state transition.
  • CanDie — return false to suppress the death loop entirely (e.g. inside a minigame, airsoft round, or PvP arena).
  • EMSCall — receives the dying player's coords; route this to your phone's emergency-call trigger.
  • Notification — replace with your own notify system; receives a string message.
  • CustomProgress / StopCustomProgress — wire any progress bar (ox_lib, custom UI, etc.) when Progressbar = 'CUSTOM' in the config.
  • DisabledKeys — the controls disabled while the player is fully dead. Override to keep your own controls usable.
Combining hooks
Hooks and exports compose well — call exports['DS-Death']:isPlayerKnocked() from inside OnKnocked to gate other systems (phone, inventory, radio) without polling.

Still stuck?

Open a ticket in our Discord and we'll help you out.

Join Discord →
Death · Exports — Documentation