Skip to main content

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 listeners table. 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()
ReturnsTypeDescription
return valuebooleantrue 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()
ReturnsTypeDescription
return valuebooleantrue 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)
ParameterTypeDescription
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)
ParameterTypeDescription
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)
ParameterTypeDescription
facilityIdnumber?Facility ID, if applicable.
coordsvector3Respawn position.

Returns: Nothing.

Facility & items

onFacilityHeal

Called when facility treatment completes (healed at a hospital bed).

function listeners.onFacilityHeal(facilityId, facilityName)
ParameterTypeDescription
facilityIdnumberFacility ID.
facilityNamestringDisplay name.

Returns: Nothing.

onHealingItemUsed

Called when a healing item is used on the local player.

function listeners.onHealingItemUsed(itemName, healAmount, healerId)
ParameterTypeDescription
itemNamestringItem name.
healAmountnumberAmount healed.
healerIdnumber?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)
ParameterTypeDescription
stretcherIdnumberStretcher ID.
stretcherEntitynumberStretcher entity handle.

Returns: Nothing.

onStretcherExit

Called when the local player is removed from a stretcher.

function listeners.onStretcherExit(stretcherId, stretcherEntity)
ParameterTypeDescription
stretcherIdnumberStretcher ID.
stretcherEntitynumberStretcher entity handle.

Returns: Nothing.

Injury & status

onInjuryUpdate

Called when the local player’s limb injury state changes.

function listeners.onInjuryUpdate(limbs)
ParameterTypeDescription
limbstableCurrent 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)
ParameterTypeDescription
statusTypeWasabiAmbulanceStatusTypeWhich status changed.
amountnumberNew amount (0 if removed).
previousAmountnumberPrevious amount.

Returns: Nothing.


Server listeners


Death & revive

onLastStand

Called when a player enters last stand.

function listeners.onLastStand(source, deathData)
ParameterTypeDescription
sourcenumberPlayer 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)
ParameterTypeDescription
sourcenumberPlayer 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)
ParameterTypeDescription
sourcenumberPlayer being revived (server ID).
revivernumber?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)
ParameterTypeDescription
sourcenumberPlayer server ID.
facilityIdnumber?Facility ID, if applicable.
coordsvector3Respawn position.

Returns: Nothing.

Facility & items

onFacilityHeal

Called when a player completes facility treatment (healed at bed).

function listeners.onFacilityHeal(source, facilityId, facilityName, cost)
ParameterTypeDescription
sourcenumberPlayer server ID.
facilityIdnumberFacility ID.
facilityNamestringFacility name.
costnumberAmount charged (0 if free).

Returns: Nothing.

onHealingItemUsed

Called when a healing item is used on a player.

function listeners.onHealingItemUsed(source, itemName, healAmount, healerId)
ParameterTypeDescription
sourcenumberPlayer being healed (server ID).
itemNamestringItem name.
healAmountnumberAmount healed.
healerIdnumber?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)
ParameterTypeDescription
sourcenumberPlayer on the stretcher (server ID).
stretcherIdnumberStretcher ID.
placedBynumberWho placed them (server ID).

Returns: Nothing.

onStretcherExit

Called when a player is removed from a stretcher.

function listeners.onStretcherExit(source, stretcherId, removedBy)
ParameterTypeDescription
sourcenumberPlayer removed (server ID).
stretcherIdnumberStretcher ID.
removedBynumberWho removed them (server ID).

Returns: Nothing.

Injury & duty

onInjuryUpdate

Called when a player’s limb injury state changes.

function listeners.onInjuryUpdate(source, limbs, previousLimbs)
ParameterTypeDescription
sourcenumberPlayer server ID.
limbstableCurrent limb injury data.
previousLimbstablePrevious limb injury data.

Returns: Nothing.

onDutyChange

Called when EMS duty status changes for a player.

function listeners.onDutyChange(source, onDuty, job)
ParameterTypeDescription
sourcenumberPlayer server ID.
onDutybooleanWhether they are now on duty.
jobstringJob name.

Returns: Nothing.


Quick reference

Client onlyServer only
Extra listenersshouldPlayDeathAnim, shouldProcessDeath, onStatusChangeonDutyChange

Shared names (onRevive, onFacilityHeal, stretcher, healing, injury) use different parameters on client vs server; use the tables above for each side.