RedM documentation

Murphy's Doctor

Developers

State bags


murphy_doctor uses a few replicated state bags. They are the cheapest way for another resource to know whether a player is down, being moved, or wearing a face mask, without calling an export.

Keys written by murphy_doctor

Key Bag Type Written by Replicated Meaning
murphy_doctor:coma Player(src).state true or nil server, checked every second yes, to every client The player's character is in a coma (as recorded by the server).
murphy_doctor:moved Player(src).state "carried", "stretcher", "bed" or nil server yes The player is carried on a shoulder, lying on a stretcher or in a dispensary bed.
doctorFaceCovered Player(src).state (set by the owner through LocalPlayer.state) boolean client of the player, every CheckIntervalSeconds yes Nose and mouth are covered by a mask (ped components of the Config.Infection.Proximity.FaceCovered.Categories categories). Lowers the chance of catching a disease from a nearby player.

Availability:

  • murphy_doctor:coma and murphy_doctor:moved are written by the transport module: they exist while Config.Transport.Enabled is not false (the default).
  • doctorFaceCovered is only published when Config.Infection.Enabled, Config.Infection.Proximity.Enabled and Config.Infection.Proximity.FaceCovered.Enabled are all on. A missing value means "not covered".

Keys read by murphy_doctor

Key Bag Type Set by Used for
murphy_doctor:skinTone Player(src).state string: sc01, sc02, sc03, sc04, sc05 or sc08 your character creator (optional) Skin tone of the skin patch used by the surgery and injection minigames. Without it, Config.Minigames3D.DefaultTone is used.
murphyLocale GlobalState string (language code) murphy_platform (optional) Overrides Config.Locale for the NUI.

Reading them from another resource

lua
-- server
local function isDown(src)
return Player(src).state["murphy_doctor:coma"] == true
end
local function isBeingMoved(src)
return Player(src).state["murphy_doctor:moved"] ~= nil
end
lua
-- client, any player
local function isDown(serverId)
return Player(serverId).state["murphy_doctor:coma"] == true
end
-- client, the local player
local covered = LocalPlayer.state.doctorFaceCovered == true
lua
-- client, react to changes
AddStateBagChangeHandler("murphy_doctor:coma", nil, function(bagName, key, value)
local serverId = tonumber(bagName:match("player:(%d+)"))
if serverId then
print(serverId, value and "is down" or "got up")
end
end)

Publishing the skin tone from a creator

Set it once the character is loaded, replicated so the server can read it:

lua
-- client of your character creator
LocalPlayer.state:set("murphy_doctor:skinTone", "sc03", true)

Use the codes of the multiplayer heads (sc01, sc02, sc03, sc04, sc05, sc08).

What is not in a state bag

Use exports or events for these:

Information Where to read it
Duty status server export IsDoctorOnDuty(src), client event murphy_doctor:dutyChanged
Body temperature, hunger, thirst, injuries client exports GetBodyTemperature, GetHunger, GetThirst, GetLocalHealthData (local player only)
Doctor status server export IsPlayerDoctor(src), client export IsLocalPlayerDoctorCached()
Diseases, immunities, addictions server exports GetMedicalFile, IsImmune, GetAddictions
Coma of the local player, with timer client exports IsInComa, GetComaTimeRemaining

The coma state bag mirrors the server record, so it can lag the client's own coma screen by up to a second.


Last updated: November 20, 2026