codeExports

Server and client export reference for 0r-ambulancejob

Use MedicalListeners when you want to extend the resource from inside modules/medical_listeners/*.lua.

Use exports when another resource wants to query medical state or trigger a supported medical action.

Public event alternatives are documented in:

boltEventschevron-right

Server Exports

GetDoctorCount()

Returns the current on-duty medical count.

addFacilityLog(payload)

Creates a facility log entry and returns the inserted log id.

Returns false when the payload is invalid or the insert fails.

local logId = exports["0r-ambulancejob"]:addFacilityLog({
    facility_id = 1,
    action_key = "staff_hired",
    action_label = "Staff Hired",
    actor_identifier = "license:xxxx",
    actor_name = "Doctor Smith",
    target_identifier = "license:yyyy",
    target_name = "John Doe",
    detail = "Hired into the facility staff roster.",
    metadata = {
        role = "doctor",
    }
})

CreateFacilityInvoice(payload)

Creates a facility invoice and returns success, invoiceOrMessage.

You can pass patient_identifier and patient_name instead of patient_source when the patient is not online.

MarkFacilityInvoicePaid(invoiceId, options)

Marks an unpaid invoice as paid. When depositPaidInvoicesToFacilityAccount = true, the paid amount is deposited into the facility account.

CancelFacilityInvoice(invoiceId, reason)

Cancels an unpaid invoice.

GetFacilityInvoices(facilityId, filters)

Returns facility invoices. filters.status can be all, unpaid, paid, or cancelled.

GetPlayerUnpaidFacilityInvoices(identifier)

Returns unpaid facility invoices for a player identifier.

GetMedicalState(source)

Returns the backward-compatible server state:

  • alive

  • dead

laststand is intentionally folded into alive in this export. If you need the exact canonical state, use IsLaststand(source) or GetMedicalStatePayload(source).

IsDead(source)

Returns true if the player is dead.

IsLaststand(source)

Returns true if the player is in laststand.

IsDowned(source)

Returns true if the player is dead or laststand.

GetMedicalStatePayload(source)

Returns the canonical medical state payload, including:

  • state

  • deathTimer

  • laststandTimer

  • isDead

  • isLaststand

  • isDowned

  • bleedLevel

  • painLevel

  • shockLevel

  • injuryState

GetPlayerInjuryState(source)

Returns the full regional injury state for a target player.

ApplyBodyDamage(source, region, amount, options)

Applies regional injury damage to the target player through the medical core.

HealBodyRegion(source, region, amount, reason)

Heals one body region without resetting the whole injury state.

ResetInjuries(source, mode)

Supported modes:

  • full

  • revive

  • partial

GetBodyRegionSeverity(source, region)

Returns the derived severity for a single region.

IsPlayerCritical(source)

Returns true if the target is in a critical regional injury state.

SetFatalInjuries(source)

Marks all canonical body regions as fatal on the target client.

Pair this with SetMedicalState(source, "dead", options) if you also want to force the death state.

RevivePlayer(source, options)

Supported options:

  • source

  • reason

  • context

  • silentGetUp

SetMedicalState(source, state, options)

Accepted states:

  • alive

  • laststand

  • dead

Supported options:

  • source

  • reason

  • context

  • silentGetUp only used when state = "alive"

This is a trusted server-side API and does not apply the public event admin gate.

Client Exports

GetMedicalState()

Returns the local medical state.

IsDead()

Returns true if the local player is dead.

IsLaststand()

Returns true if the local player is in laststand.

IsDowned()

Returns true if the local player is dead or laststand.

GetDeathTime()

Returns the local death timer.

GetLaststandTime()

Returns the local laststand timer.

CanRespawn()

Returns true if the player is dead, the timer is finished, and hospital respawn is allowed.

GetMedicalStatePayload()

Returns the local canonical state payload.

GetLocalInjuryState()

Returns the local player's full injury state.

ApplyBodyDamage(region, amount, options)

Applies regional injury damage to the local player.

HealBodyRegion(region, amount, reason)

Heals one local body region.

ResetInjuries(mode)

Resets local injury data using:

  • full

  • revive

  • partial

GetBodyRegionSeverity(region)

Returns local severity for the given region.

IsPlayerCritical()

Returns true if the local player is in a critical regional injury state.

Notes

  • Exports are for external resources.

  • MedicalListeners are for direct in-resource customization.

  • Export-triggered actions still go through the normal medical lifecycle and listeners.

Last updated