RedM documentation

Murphy's Doctor

Developers

Extension points


Every way to plug your own code into murphy_doctor without touching the escrowed server files, from the lightest (a config value) to the heaviest (editing a client file). Each section ends with an example.

Need Extension point
Your own notification system Config.NotifyStyle = "custom" + Config.CustomNotify
Your own HUD for hunger, thirst, temperature Config.Metabolism.Enabled = false + client exports
Revive or heal from an admin menu AuthorizeComaExit, murphy_doctor:revivePlayer, AdminHealCharacter
Your own death or respawn script AuthorizeComaExit, CleanupComaState, SetDamageTrackingEnabled
A law job reading incidents and certificates GetIncidents, GetDeathCertificates, events, LawJobs
A custom inventory or shop Server adapter functions, murphy_doctor:useConsumable
Job and doctor detection DoctorDetection, cache invalidation
A target or radial menu Radial client events, non-blocking exports
A weather script murphy_doctor:setWeather
A vitals or character creator script scriptedHealthChange, murphy_doctor:skinTone state bag
Diseases and vaccines from your scripts TryInfect, GrantImmunity
Animations and consumables Config.Animations, Config.Consumables.AnimationPresets, client/consumables_anims.lua
Logs Config.DiscordLogs, the murphy_platform:pushCustomEvent feed
Debug tools Config.Debug, doc_selftest, RunSelfTest, /doc:close
Editing client files and adapters client/, server/adapters/

Custom notifications

Config.CustomNotify (in shared/config.lua) is the only function-valued key of the configuration. Set Config.NotifyStyle = "custom" and every notification of the script, server ones included, goes through it on the client. If your function errors, the game's own notification is shown instead and the error is printed in F8.

Argument Content
title Already translated ("Doctor", "Treasury", "Health"...)
text The message, already translated
kind "info", "success", "warning" or "error"
duration Milliseconds
icon The icon the Murphy box would show ("tick", "cross", "alert", "money", "shield"...) or nil
zone The zone the caller asked for ("feed", "center"...) or nil
lua
-- shared/config.lua
Config.NotifyStyle = "custom"
Config.CustomNotify = function(title, text, kind, duration, icon, zone)
exports["my_notify"]:Send({
title = title,
message = text,
type = kind,
time = duration,
})
end

The other styles (murphy, framework, native) need no code; see Notifications. The framework style calls FrameworkNotifyLeft in the client adapter, which you can also rewrite.

To show a message that looks like the script's own from your resource, call the client export Notify or trigger murphy_doctor:notify (see Events).

Custom HUD

Config.Metabolism.Enabled only controls the built-in HUD: hunger, thirst, temperature and conditions keep running when it is false. Turn the HUD off and read the values from your own HUD resource.

lua
-- shared/config_metabolism.lua
Config.Metabolism.Enabled = false -- hide the built-in indicators
-- Config.Metabolism.HungerThirstEnabled = false -- only if your framework keeps its own hunger and thirst
lua
-- client of your HUD resource
CreateThread(function()
while GetResourceState("murphy_doctor") ~= "started" do Wait(1000) end
while true do
local d = exports.murphy_doctor
if d:IsHealthDataLoaded() then
local data = d:GetLocalHealthData()
MyHud.set({
hunger = d:GetHunger(), -- 0 to 100
thirst = d:GetThirst(), -- 0 to 100
temperature = d:GetBodyTemperature(), -- °C
bleeding = data.conditions.bleeding == true,
poisoned = data.conditions.poisoned == true,
cold = data.conditions.cold == true,
hot = data.conditions.hot == true,
drunk = d:GetAlcoholLevel(), -- 0 to 100
down = d:IsInComa(),
})
end
Wait(1000)
end
end)

The low-hunger, low-thirst, health and temperature warnings keep running while the built-in HUD is off: your HUD only has to display the values.

If you keep the built-in HUD and only need to hide it for a while (cutscene, photo mode), use HideMetabolismHUD and ShowMetabolismHUD.

Revive and heal from an admin menu

A revive issued by another resource has two halves:

  1. Server: AuthorizeComaExit(target), otherwise Config.Coma.ServerExitCheck refuses the early exit and the coma comes back on the next connection.
  2. Client of the target: get out of the coma. The simplest is murphy_doctor's own handler, murphy_doctor:revivePlayer, which resurrects in place at full health.
lua
-- server, inside your admin menu's revive action
local function adminRevive(target)
exports.murphy_doctor:AuthorizeComaExit(target)
TriggerClientEvent("murphy_doctor:revivePlayer", target, 0)
end
-- server, heal without reviving (injuries, conditions, temperature, health)
local function adminHeal(target)
local ok, err = exports.murphy_doctor:AdminHealCharacter(target, "all")
if not ok then print("heal failed: " .. tostring(err)) end
end

The VORP admin revive (vorp_core:Server:OnPlayerRevive) and the RSG admin menu revive (rsg-adminmenu:server:playerrevive) are already wired in the adapters: nothing to add for them.

Custom death or respawn script

murphy_doctor owns the death flow (coma screen, help call, doctor revive, get up after the timer). Run only one death script. If yours must resurrect the player itself:

lua
-- server, before your respawn
exports.murphy_doctor:AuthorizeComaExit(src)
-- client, after your script resurrected the ped
if exports.murphy_doctor:IsInComa() then
exports.murphy_doctor:CleanupComaState() -- closes screen, camera and state only
end

Scripts that damage or teleport the player on purpose (a fall in a cutscene, a trap minigame) can pause injury creation:

lua
exports.murphy_doctor:SetDamageTrackingEnabled(false)
-- ...
exports.murphy_doctor:SetDamageTrackingEnabled(true)

Law jobs

Doctors, staff and the jobs listed in Config.Incidents.LawJobs can already read the records in game with /incidents and /certificates (Config.Autopsy.LawJobs defaults to the same list). From a law resource:

lua
-- server: a sheriff terminal
RegisterNetEvent("sheriff:server:caseFile", function(suspectCharid)
local src = source
if not MyLaw.isOfficer(src) then return end
local incidents = exports.murphy_doctor:GetIncidents({ attacker = suspectCharid, limit = 20 })
local deaths = exports.murphy_doctor:GetDeathCertificates({ limit = 20 })
TriggerClientEvent("sheriff:client:caseFile", src, incidents, deaths)
end)
-- server: open a case automatically
AddEventHandler("murphy_doctor:incidentRecorded", function(incident)
if incident.attacker then MyLaw.openCase(incident) end
end)
AddEventHandler("murphy_doctor:deathCertificate", function(cert)
MyLaw.registerDeath(cert.id, cert.name, cert.cause, cert.place)
end)

GetIncidents needs Config.Incidents.Enabled, GetDeathCertificates needs Config.Autopsy.Enabled (see Server exports).

Custom inventory or shop

Inventory and money go through the server adapter of your framework (server/adapters/, not escrowed): GiveItem, RemoveItem, GetItemAmount, GetItemMeta, GetPlayerInventory, FrameworkRegisterUsableItem, money functions. To use another inventory, rewrite those functions; the contract is in Framework adapters.

To make a shop, a crafting table or your inventory's "use" button consume a murphy_doctor item with every effect (animation, hunger and thirst, alcohol, infection roll, addiction), trigger the server flow instead of copying it:

lua
-- server
TriggerEvent("murphy_doctor:useConsumable", src, "bread")

The item must be a key of Config.Consumables.Items and the player must own it (it is removed).

Job and doctor detection

Who counts as a doctor is a configuration matter (Config.Interactions.DoctorDetection, Config.DoctorJobs, Config.DoctorWhitelist, the dispensary members). When your job script changes a player's job, refresh both caches so the change is immediate instead of up to 30 seconds later:

lua
-- server, in your job script
exports.murphy_doctor:InvalidateDoctorCache(src)
TriggerClientEvent("murphy_doctor:invalidateDoctorCache", src)

If you insert or delete rows of murphy_doctor_members yourself, also fire TriggerEvent("murphy_doctor:server:membersChanged") on the server.

Target or radial menu

murphy_radialmenu is supported out of the box. Any other menu can use the same client events (see Events), with the non-blocking exports for visibility:

lua
-- client, a third-party target system
MyTarget.addGlobalPlayer({
{
label = "Bandage",
canInteract = function() return exports.murphy_doctor:IsLocalPlayerDoctorCached() end,
action = function(targetServerId)
TriggerEvent("murphy_doctor:client:radialBandage", targetServerId)
end,
},
{
label = "Call a doctor",
canInteract = function() return exports.murphy_doctor:NeedsDoctor() end,
action = function() TriggerEvent("murphy_doctor:client:radialCallHelp") end,
},
})

Never call the blocking IsPlayerDoctor client export inside a visibility check.

Weather script

The temperature engine reads weathersync. Any other weather resource can feed it from the client each time the weather changes:

lua
-- client of your weather script
TriggerEvent("murphy_doctor:setWeather", "snow")
-- or from its server: TriggerClientEvent("murphy_doctor:setWeather", -1, "snow")

Without any weather source the weather modifier stays neutral.

Vitals and character creator scripts

  • murphy_doctor does not restore the ped's health when a character loads; your framework or vitals script keeps that job.
  • Each time murphy_doctor deliberately writes the ped's health, it fires the local client event murphy_doctor:scriptedHealthChange with { reason, from, to, max }. Listen to it so your script does not revert the change.
  • A creator can publish the character's skin tone for the surgery and injection patches.
lua
-- client of your vitals script
AddEventHandler("murphy_doctor:scriptedHealthChange", function(change)
MyVitals.acceptHealth(change.to, change.max)
end)
-- client of your character creator, once the character is loaded
LocalPlayer.state:set("murphy_doctor:skinTone", "sc03", true)

Diseases and vaccines

lua
-- server: contaminated well, 20 % chance of cholera
if math.random() < 0.20 then
exports.murphy_doctor:TryInfect(src, "cholera", "well_water")
end
-- server: a vaccination campaign, 30 days of immunity
exports.murphy_doctor:GrantImmunity(src, "cholera", 30 * 24 * 3600, {
notifyText = "You have been vaccinated against cholera.",
})
-- server: an epidemic triggered by your event script
exports.murphy_doctor:StartOutbreak("grippe", "valentine", 24)

Animations and consumables

  • Animation catalog: Config.Animations (shared/config_animations.lua) holds every doctor animation (dict/clip, scenario or phased intro/action/outro, with props). Change an entry to change the animation everywhere it is used, or add your own entries and play them from your resource with exports.murphy_doctor:PlayDoctorAnim("my_key").
  • Consumable animations: an item of Config.Consumables.Items names a preset in animation; the preset of Config.Consumables.AnimationPresets either names a function of ConsumableAnims (animFn, with optional animFnArgs) or gives a plain dict/anim. The functions live in client/consumables_anims.lua, which you can edit or extend.
lua
-- client/consumables_anims.lua
function ConsumableAnims.tea()
-- your animation: props, prompts, stances
end
-- shared/config_consumables.lua
Config.Consumables.AnimationPresets.tea = { animFn = "tea" }
-- and on the item: animation = "tea"

Logs

  • Discord: built in, configured in Config.DiscordLogs (shared/config_metabolism.lua), with one webhook per log type in DoctorWebhooks (server/adapters/webhooks.lua, server only). See Integrations.
  • Activity feed: every medical action is pushed through the local server event murphy_platform:pushCustomEvent. Listen to it to build your own logs, even without murphy_platform (payload in Events).

Debug tools

  • Config.Debug = true (shared/config.lua) prints debug lines and registers the test commands (/doc:testinjury, /doc:clearinjuries and more). See Commands and keybinds. The dbg(...) helper defined in the same file prints only while Config.Debug is on.
  • Module debug switches: Config.Infection.Debug mirrors infection rolls to the player's F8 console, Config.Alcohol.Debug prints liver wear changes.
  • doc_selftest [serverId] in the server console (or the RunSelfTest export) checks adapter functions, dependencies, tables, item names and known conflicts.
  • /doc:close (always available) closes every murphy_doctor screen and gives the mouse back.

Editing client files and adapters

client/, shared/ and server/adapters/ are readable and editable. Some useful places:

File What you can change
client/adapters/<Framework>Adapter.lua Revive after the coma timer (FrameworkRevivePlayer), framework notifications, character-load and revive bridges
server/adapters/<Framework>Adapter.lua Identifiers, money, items, usable items, framework dead flag, admin revive hooks
client/notify.lua Native notification look, threshold warning rules
client/temperature.lua Weather sources and clothing detection of the temperature engine
client/consumables_anims.lua Consumable animation functions
shared/locales/*.lua Every Lua text (see Localization)
ui/build/locales/*.js Every UI text

Prefer the configuration, exports and events above: an edited file has to be merged by hand at each update. Keep a list of your changes, or keep them in a separate resource that calls the exports.


Last updated: November 20, 2026