RedM documentation
Murphy's Doctor
Developers
Server exports
Call them from any server script of another resource:
Conventions used on this page:
srcis a connected player's server id;charidis the character identifier (see Identifiers).- Module: the export is only registered when that module is enabled (see Module guards). "always" means the export exists whatever the configuration.
- Exports marked DB run a synchronous database query: call them from a thread or an event handler, not every tick.
There are 37 server exports.
| System | Exports |
|---|---|
| Doctors and availability | IsPlayerDoctor, IsPlayerDoctorAsync, CheckDoctorByJob, CheckDoctorByDatabaseSync, CheckDoctorByWhitelist, InvalidateDoctorCache, InvalidateAllDoctorCache, RefreshDoctorStatus, FindAllDoctors, FindNearbyDoctorsAdvanced, IsDutyServiceGateActive, IsDoctorAvailable, FindNearbyAvailableDoctors, IsDoctorOnDuty |
| Health | AdminHealCharacter, GetMedicalCatalog |
| Coma and revive | AuthorizeComaExit |
| Diseases, infection and immunity | TryInfect, RollConsumableInfection, GrantImmunity, IsImmune, GetImmunityExpiry, SyncDiseasesToPlayer, BuildClientDiseasePayload |
| Addiction | GetAddictions, ReduceAddiction |
| Alcohol | OnAlcoholConsumed, GetLiverWear |
| Billing | GetUnpaidInvoices |
| Incidents | GetIncidents |
| Death certificates | GetDeathCertificates |
| Medical file | GetMedicalFile |
| Transport | GetTransportState |
| Epidemics | GetActiveOutbreaks, StartOutbreak, StopOutbreak |
| Diagnostics | RunSelfTest |
Doctors and availability
Doctor detection follows Config.Interactions.DoctorDetection ("job", "database", "whitelist", "both" for job
plus database, "any" for all three, or a table such as { "job", "whitelist" }). When
Config.Interactions.DoctorSpeFromCraft is true and murphy_craft runs, a player who unlocked the root node of the
Config.Interactions.DoctorSpeCraftId specialisation also counts as a doctor.
IsPlayerDoctor
| Parameter | Type | Description |
|---|---|---|
src |
number | Player server id |
Returns true when the player is a doctor under the configured detection modes. The result is cached 30 seconds per
player. No database query: the "database" mode reads an in-memory copy of the members table.
Module: always.
IsPlayerDoctorAsync
| Parameter | Type | Description |
|---|---|---|
src |
number | Player server id |
callback |
function(isDoctor: boolean) | Called with the result |
Same check as IsPlayerDoctor, callback form. Every detection path is synchronous, so the callback runs before the
export returns. Module: always.
CheckDoctorByJob
Checks only the job: GetCharJob(src) compared (case-insensitive) with Config.DoctorJobs. When
Config.Interactions.DoctorJobRequireDuty is true and the adapter exposes GetCharJobDuty (RSG), an off-duty job
returns false. Uncached, ignores DoctorDetection. Module: always.
CheckDoctorByDatabaseSync
Checks only the dispensary membership (murphy_doctor_members), read from the in-memory set. The set is loaded a few
seconds after start and reloaded when a member is added or removed. Uncached, ignores DoctorDetection. Module: always.
CheckDoctorByWhitelist
Checks only Config.DoctorWhitelist. Matches the character identifier or any account identifier of the player
(license:, steam:, discord:, fivem:...). Uncached. Module: always.
InvalidateDoctorCache
Drops the cached doctor status of one player. Call it after you change a player's job or membership yourself, so the
next check is fresh instead of waiting up to 30 seconds. This clears the server cache only; the player's client keeps its
own cache (see the client event murphy_doctor:invalidateDoctorCache in Events). Module: always.
InvalidateAllDoctorCache
Drops the cached status of every player. Module: always.
RefreshDoctorStatus
Invalidates the cache of src, then checks again. Without a callback the new status is returned; with one it is passed
to the callback. Module: always.
FindAllDoctors
Every connected player for whom IsPlayerDoctor is true. name is "first last" from the adapter, isOnline is
always true. Module: always.
FindNearbyDoctorsAdvanced
| Parameter | Type | Description |
|---|---|---|
x, y, z |
number | Search origin |
radius |
number | Radius in metres |
Connected doctors within radius, closest first. Ignores duty. Module: always.
IsDutyServiceGateActive
true when Config.Duty.Enabled is true and Config.Duty.GateServices is not false. When the gate is active,
help calls and the nurse NPC only count doctors who are clocked in. Module: always.
IsDoctorAvailable
true when the player is a doctor and, if the duty gate is active, clocked in. Without the gate (or when the duty module
is not loaded) it equals IsPlayerDoctor. Module: always.
FindNearbyAvailableDoctors
Same as FindNearbyDoctorsAdvanced, filtered with IsDoctorAvailable. This is the list the help calls use. Module:
always.
IsDoctorOnDuty
true when the player's character is clocked in at a dispensary. Module: Config.Duty.
Health
AdminHealCharacter
Heals the online player whose active character is charid.
| Form | Arguments | Effect |
|---|---|---|
| New, full heal | charid, nil (or { parts = "all" }) |
Clears every injury and condition, sets temperature to 37, restores health and refills the health core |
| New, partial heal | charid, { parts = { "head", "left-arm" } } |
Removes only the listed body parts that carry an injury, restores health and the core |
| Legacy | src (server id), "all" or { "head", ... } |
Same, the first argument being a server id |
Returns true on success, otherwise false and one of invalid_args, invalid_parts, target_offline,
no_health_data.
Side effects: saves the health row, and sends the client events murphy_doctor:healthRestored then
murphy_doctor:applyBandageHeal (full heal) or murphy_doctor:applyTreatmentEffects (partial heal). Diseases,
immunities, addictions and liver wear are kept. It does not revive a player in a coma: see
Coma and revive.
Module: always.
GetMedicalCatalog
Localized labels for dashboards, logs and admin panels:
label follows Config.Locale. urgency is the raw urgency key of the grimoire entry (modérée, haute,
critique or variable in the shipped config). Module: always.
Coma and revive
There is no "is in coma" server export. Read the replicated state bag murphy_doctor:coma (see
State bags) or ask the client (IsInComa).
AuthorizeComaExit
| Parameter | Type | Description |
|---|---|---|
src |
number | Player server id |
Allows the next coma exit of this player for 60 seconds, even if the coma timer is not over. With
Config.Coma.ServerExitCheck = true (default) the server refuses an early exit that it did not cause: the player gets up
on their screen, but the coma stays in the database and comes back on the next connection. Call this export right
before any revive issued by your own resource.
The VORP (vorp_core:Server:OnPlayerRevive) and RSG (rsg-adminmenu:server:playerrevive) admin revives already call
it through the server adapters.
Module: always.
Diseases, infection and immunity
TryInfect
| Parameter | Type | Description |
|---|---|---|
src |
number | Player server id |
diseaseId |
string | Grimoire id, for example "cholera" |
sourceTag |
string, optional | Free text shown in the Discord log, for example "well_water" |
Gives the disease. No probability roll: your code decides. Picks 2 to 4 visible symptoms from the grimoire entry, saves
the disease, pushes the disease list to the client and, when Config.Infection.NotifyOnInfection is on and the disease
has no incubation, tells the player they feel sick (without naming the disease).
Returns false when Config.Infection.Enabled is false, the player has no loaded health data, is already sick with
this disease, or is immune to it.
Module: always (inert without Config.Infection.Enabled).
RollConsumableInfection
Rolls the chances listed for itemName in Config.Infection.Consumable.Items and infects on a hit. A per-item cooldown
(Config.Infection.Consumable.RollIntervalSeconds) prevents spam. Already called for every consumable used through
murphy_doctor: call it only for items consumed outside the script. Returns true when a disease was applied.
Module: always (inert without Config.Infection.Enabled and Config.Infection.Consumable.Enabled).
GrantImmunity
| Parameter | Type | Description |
|---|---|---|
src |
number | Player server id |
diseaseId |
string | Grimoire id |
durationSeconds |
number | Immunity length, greater than 0 |
opts |
table, optional | { silent = bool, notifyText = string or { k = "locale.key" }, vaccineItem = string } |
Saves the immunity right away. Unless silent, the player gets a notification: notifyText, else the notifyText of
Config.Infection.Vaccines[vaccineItem], else a built-in message for variole and cholera. Returns false when the
arguments are invalid, the player has no loaded health data, or the player is already immune for longer.
Module: always.
IsImmune
true while the immunity has not expired. Module: always.
GetImmunityExpiry
Expiry as a Unix timestamp (seconds), or nil when the player never had that immunity. The value may be in the past.
Module: always.
SyncDiseasesToPlayer
Pushes the player's disease list to their client now (it is pushed every 30 seconds anyway), through the client event
murphy_doctor:syncDiseases. Module: always.
BuildClientDiseasePayload
Pure helper. Copies a { [diseaseId] = state } table and adds symptomatic = true|false to each entry (incubation
from Config.Treatment.DiseaseEffects[id].incubationSeconds, measured on the server clock from appliedAt). Never
modifies its input. Module: always.
Addiction
Module for both: Config.Addiction.
GetAddictions
substance is a key of Config.Addiction.Substances (alcohol, tobacco, opiates by default). Only substances with
a level above 0 (or dependent) are listed. level goes from 0 to 100 (decayed to now), dependent is level >= dependentAt, withdrawal is true when dependent and the last use is older than withdrawalAfterMinutes. Returns {}
when the player has no character. DB on the first call for a character (then cached).
ReduceAddiction
Lowers the level by amount (a negative amount raises it), clamped to 0 to 100, saves it and pushes the new flags to the
client. Returns false for an unknown player or substance.
Alcohol
OnAlcoholConsumed
Adds liver wear for units alcohol units (units * Config.Alcohol.Wear.GainPerAlcoholUnit, capped at
Config.Alcohol.Wear.Max) and saves it. Already called for every alcoholic consumable used through murphy_doctor: call
it only for drinks served by your own script. It does not change the player's drunkenness, which is client side (see
SetAlcoholLevel in Client exports).
Module: always (no-op without Config.Alcohol.Enabled).
GetLiverWear
Current liver wear, 0 when healthy, up to Config.Alcohol.Wear.Max. Module: always.
Billing
GetUnpaidInvoices
Unpaid invoices of a character, oldest first. dispensary is the dispensary name from Config.Dispensaries, at a Unix
timestamp. DB. Module: Config.Billing.
Incidents
GetIncidents
| Filter key | Type | Description |
|---|---|---|
victim |
string | Victim charid |
attacker |
string | Attacker charid |
name |
string | Part of the victim or attacker name |
limit |
number | 1 to 100, default Config.Incidents.MaxRows |
Coma records, newest first. Every filter is optional (nil returns the latest rows). cause is a coma cause key,
attacker_npc is 1 when an NPC knocked the victim out, at is a Unix timestamp. DB. Module: Config.Incidents.
Death certificates
GetDeathCertificates
| Filter key | Type | Description |
|---|---|---|
deceased |
string | charid of the deceased |
name |
string | Part of the deceased's name |
limit |
number | 1 to 100, default Config.Autopsy.MaxRows |
Signed death certificates, newest first. Each row: certificate_id, deceased_id (nil for an NPC), deceased_name,
cause, weapon, wound (body part), time_of_death, place, notes, doctor_name, at (Unix timestamp). DB.
Module: Config.Autopsy (enabled unless set to false).
Medical file
GetMedicalFile
Everything the doctors know about a character, whether the player is online or not. Returns nil for an empty
identifier. Shape:
| Field | Content |
|---|---|
identifier |
The charid |
name, surname |
From the latest report, if any |
bloodType, allergies, conditions, notes |
Written by doctors in the medical file (strings, empty when unset) |
updatedBy, updated |
Last editor and date of those notes |
diseases |
Array of localized disease names |
vaccines |
Array of { name, expires } (expires as YYYY-MM-DD) for valid immunities |
liver |
Liver wear 0 to 100, or nil |
addictions |
Array of { name, level, dependent } for substances at half the dependence threshold or more |
death |
{ id, date, cause, doctor } of the last death certificate, or nil |
history |
Array of { id, kind, date, doctor, summary }, newest first; kind is report, bed or certificate |
The export reads every dispensary's reports, whatever Config.Archives.SharedArchives says. DB. Module:
Config.Records (enabled unless set to false).
Transport
GetTransportState
Is the player carried on a shoulder, lying on a stretcher or in a dispensary bed? For a bed, the second value is the key
of the bed in the transport config. Module: Config.Transport (enabled unless set to false).
Epidemics
Module for all three: Config.Epidemics.
GetActiveOutbreaks
Active outbreaks, sorted by id. outbreak is a key of Config.Epidemics.Outbreaks, zone a key of
Config.Epidemics.Zones, startedAt / endsAt Unix timestamps, infected the number of players infected so far.
StartOutbreak
Starts an outbreak in a zone. hours is optional (defaults to the outbreak's own hours, then 24). Doctors are warned,
and so are players inside the zone when Config.Epidemics.AnnounceToZone is on. Fires the server event
murphy_doctor:outbreakChanged. Outbreaks survive a restart (resource KVP).
StopOutbreak
Ends one outbreak (or all). Returns false for an unknown id. Fires murphy_doctor:outbreakChanged.
Diagnostics
RunSelfTest
The same report as the doc_selftest console command: adapter functions, dependencies, tables, item names, known
conflicts. With serverId, it adds that player's character, health cache, doctor and staff status. Module: always.
Last updated: November 20, 2026