Listeners
Bridge hooks for Wasabi Ambulance Job V2 (wasabi_ambulance_v2). Implement these in the resource’s listener files; they are not exports.
Files
- Client:
bridge/listeners/client.lua - Server:
bridge/listeners/server.lua
Behavior
- Implement functions on the
listenerstable. Any listener you omit resolves to a no-op, so undefined names do not error. - Do not use blocking calls in these listeners (waits, long loops, etc.). They run during death and related loops; hanging here can cause serious issues.
Client listeners
Death & animation
shouldPlayDeathAnim
Checked during death / last stand loops to decide whether the death animation should keep playing.
function listeners.shouldPlayDeathAnim()
| Returns | Type | Description |
|---|---|---|
| return value | boolean | true to allow death anim persistence; false to skip (e.g. when another script is playing a carry animation). |
shouldProcessDeath
Whether this resource should process the player’s death at all.
function listeners.shouldProcessDeath()
| Returns | Type | Description |
|---|---|---|
| return value | boolean | true to process death; false to ignore it (e.g. paintball / TDM). |
onLastStand
Called when the local player enters last stand (downed).
function listeners.onLastStand(deathData)
| Parameter | Type | Description |
|---|---|---|
deathData | { cause: number?, killer: number? }? | Optional: damage cause hash and killer server ID. |
Returns: Nothing.
onDeath
Called when the local player is fully dead (after last stand or instant death).
function listeners.onDeath(deathData)
| Parameter | Type | Description |
|---|---|---|
deathData | { cause: number?, killer: number? }? | Optional: damage cause hash and killer server ID. |
Returns: Nothing.
onRevive
Called when the local player is revived.
function listeners.onRevive()
Returns: Nothing.
onRespawn
Called when the local player respawns at a hospital (gave up or forced respawn).
function listeners.onRespawn(facilityId, coords)
| Parameter | Type | Description |
|---|---|---|
facilityId | number? | Facility ID, if applicable. |
coords | vector3 | Respawn position. |
Returns: Nothing.
Facility & items
onFacilityHeal
Called when facility treatment completes (healed at a hospital bed).
function listeners.onFacilityHeal(facilityId, facilityName)
| Parameter | Type | Description |
|---|---|---|
facilityId | number | Facility ID. |
facilityName | string | Display name. |
Returns: Nothing.
onHealingItemUsed
Called when a healing item is used on the local player.
function listeners.onHealingItemUsed(itemName, healAmount, healerId)
| Parameter | Type | Description |
|---|---|---|
itemName | string | Item name. |
healAmount | number | Amount healed. |
healerId | number? | Healer’s server ID if another player healed you. |
Returns: Nothing.
Stretcher
onStretcherEnter
Called when the local player is placed on a stretcher.
function listeners.onStretcherEnter(stretcherId, stretcherEntity)
| Parameter | Type | Description |
|---|---|---|
stretcherId | number | Stretcher ID. |
stretcherEntity | number | Stretcher entity handle. |
Returns: Nothing.
onStretcherExit
Called when the local player is removed from a stretcher.
function listeners.onStretcherExit(stretcherId, stretcherEntity)
| Parameter | Type | Description |
|---|---|---|
stretcherId | number | Stretcher ID. |
stretcherEntity | number | Stretcher entity handle. |
Returns: Nothing.
Injury & status
onInjuryUpdate
Called when the local player’s limb injury state changes.
function listeners.onInjuryUpdate(limbs)
| Parameter | Type | Description |
|---|---|---|
limbs | table | Current per-limb injury data (see script types / annotations in source). |
Returns: Nothing.
onStatusChange
Called when a status effect changes (bleed, stun, etc.) on the local player.
function listeners.onStatusChange(statusType, amount, previousAmount)
| Parameter | Type | Description |
|---|---|---|
statusType | WasabiAmbulanceStatusType | Which status changed. |
amount | number | New amount (0 if removed). |
previousAmount | number | Previous amount. |
Returns: Nothing.
Server listeners
Death & revive
onLastStand
Called when a player enters last stand.
function listeners.onLastStand(source, deathData)
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID. |
deathData | { cause: number?, killer: number? }? | Optional: cause hash and killer server ID. |
Returns: Nothing.
onDeath
Called when a player is fully dead.
function listeners.onDeath(source, deathData)
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID. |
deathData | { cause: number?, killer: number? }? | Optional: cause hash and killer server ID. |
Returns: Nothing.
onRevive
Called when a player is revived by any supported method.
function listeners.onRevive(source, reviver, method)
| Parameter | Type | Description |
|---|---|---|
source | number | Player being revived (server ID). |
reviver | number? | Reviver’s server ID (nil for self / hospital / no specific player). |
method | 'player' | 'hospital' | 'item' | 'admin' | 'command' | How they were revived. |
Returns: Nothing.
onRespawn
Called when a player respawns at a hospital.
function listeners.onRespawn(source, facilityId, coords)
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID. |
facilityId | number? | Facility ID, if applicable. |
coords | vector3 | Respawn position. |
Returns: Nothing.
Facility & items
onFacilityHeal
Called when a player completes facility treatment (healed at bed).
function listeners.onFacilityHeal(source, facilityId, facilityName, cost)
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID. |
facilityId | number | Facility ID. |
facilityName | string | Facility name. |
cost | number | Amount charged (0 if free). |
Returns: Nothing.
onHealingItemUsed
Called when a healing item is used on a player.
function listeners.onHealingItemUsed(source, itemName, healAmount, healerId)
| Parameter | Type | Description |
|---|---|---|
source | number | Player being healed (server ID). |
itemName | string | Item name. |
healAmount | number | Amount healed. |
healerId | number? | Healer’s server ID (nil if self). |
Returns: Nothing.
Stretcher
onStretcherEnter
Called when a player is placed on a stretcher.
function listeners.onStretcherEnter(source, stretcherId, placedBy)
| Parameter | Type | Description |
|---|---|---|
source | number | Player on the stretcher (server ID). |
stretcherId | number | Stretcher ID. |
placedBy | number | Who placed them (server ID). |
Returns: Nothing.
onStretcherExit
Called when a player is removed from a stretcher.
function listeners.onStretcherExit(source, stretcherId, removedBy)
| Parameter | Type | Description |
|---|---|---|
source | number | Player removed (server ID). |
stretcherId | number | Stretcher ID. |
removedBy | number | Who removed them (server ID). |
Returns: Nothing.
Injury & duty
onInjuryUpdate
Called when a player’s limb injury state changes.
function listeners.onInjuryUpdate(source, limbs, previousLimbs)
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID. |
limbs | table | Current limb injury data. |
previousLimbs | table | Previous limb injury data. |
Returns: Nothing.
onDutyChange
Called when EMS duty status changes for a player.
function listeners.onDutyChange(source, onDuty, job)
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID. |
onDuty | boolean | Whether they are now on duty. |
job | string | Job name. |
Returns: Nothing.
Quick reference
| Client only | Server only | |
|---|---|---|
| Extra listeners | shouldPlayDeathAnim, shouldProcessDeath, onStatusChange | onDutyChange |
Shared names (onRevive, onFacilityHeal, stretcher, healing, injury) use different parameters on client vs server; use the tables above for each side.