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:
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.
local success, invoice = exports["0r-ambulancejob"]:CreateFacilityInvoice({
facility_id = 1,
patient_source = 23,
amount = 750,
preset_key = "revive",
reason = "Revive"
})
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.
exports["0r-ambulancejob"]:MarkFacilityInvoicePaid(invoiceId, {
source = source,
})
CancelFacilityInvoice(invoiceId, reason)#
Cancels an unpaid invoice.
exports["0r-ambulancejob"]:CancelFacilityInvoice(invoiceId, "Cancelled by staff")
GetFacilityInvoices(facilityId, filters)#
Returns facility invoices. filters.status can be all, unpaid, paid, or cancelled.
local invoices = exports["0r-ambulancejob"]:GetFacilityInvoices(1, {
status = "unpaid",
})
GetPlayerUnpaidFacilityInvoices(identifier)#
Returns unpaid facility invoices for a player identifier.
local invoices = exports["0r-ambulancejob"]:GetPlayerUnpaidFacilityInvoices("license:xxxx")
GetMedicalState(source)#
Returns the backward-compatible server state:
alivedead
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:
statedeathTimerlaststandTimerisDeadisLaststandisDownedbleedLevelpainLevelshockLevelinjuryState
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:
fullrevivepartial
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:
sourcereasoncontextsilentGetUp
exports["0r-ambulancejob"]:RevivePlayer(targetId, {
source = source,
reason = "my_resource",
context = {
from = "my_resource:server:revive",
},
silentGetUp = true,
})
SetMedicalState(source, state, options)#
Accepted states:
alivelaststanddead
Supported options:
sourcereasoncontextsilentGetUponly used whenstate = "alive"
exports["0r-ambulancejob"]:SetMedicalState(targetId, "dead", {
source = source,
reason = "my_resource",
context = {
from = "my_resource:server:setDead",
}
})
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:
fullrevivepartial
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.
MedicalListenersare for direct in-resource customization.- Export-triggered actions still go through the normal medical lifecycle and listeners.