PrescriptionsExports
Events and hooks
Events other scripts can listen to, and the files you can edit in place.
In-development version. These docs cover the testing build of Prescriptions. The official release is still documented on the GitBook linked in its README.
Server events
Listen with AddEventHandler. These are local server events, not network events.
| Event | Arguments | Fired when |
|---|---|---|
MrNewbPrescriptions:MedicationConsumed | src, payload | A dose is taken. payload has itemName, drugKey, metadata, medicaldata, and slot |
MrNewbPrescriptions:MedicationTreatment | src, targetSrc, treatmentType, context | TriggerMedicationTreatment is called. Ambulance bridges use this to heal or revive, and a medic's Treat overdose uses it too |
AddEventHandler('MrNewbPrescriptions:MedicationConsumed', function(src, payload)
print(src, payload.drugKey, payload.metadata.uses)
end)Anything else that starts with MrNewbPrescriptions: is internal. Do not build on it.
Open files
These stay readable after escrow, so you can edit them.
| File | What it is for |
|---|---|
resource/open/server/medication_hooks.lua | CanUseMedication, OnMedicationConsumed, OnMedicationTreat. Only run when Other scripts can hook a dose is turned on in the panel. The events above fire either way |
resource/open/server/utility.lua | CreateLog(data). Every line goes to ox_lib logging and the Discord webhook from the panel. Add your own logger here |
resource/open/server/custom_effects.lua and resource/open/client/custom_effects.lua | Custom effect ids, labels, and handlers |
resource/open/client/forgery.lua | OpenCanEnterForgery and OpenCanUseForgeryStation. Return false (and an optional reason) to block the entrance or the forge desk |
resource/open/bridge/insurance/ | The insurance bridge files for Another script: insurance_minsurance.lua and insurance_custom.lua |
resource/open/bridge/ambulancejobs/ | Ambulance job adapters, including the overdose-clearing listeners for MrNewb_Medical and Wasabi |
resource/open/shared/job_checks.lua | How on-duty is read for a job, if your framework or duty system reports it differently |
Block a medication under a condition
With Other scripts can hook a dose turned on in the panel, in medication_hooks.lua:
function CanUseMedication(src, payload)
return not Player(src).state.isCuffed
endBuild your own insurance
On the Plans page set Who handles the policy to Another script, then fill in ExternalInsuranceStatus, ExternalInsuranceCopay, and ExternalInsuranceSummary in insurance_custom.lua. Copy insurance_minsurance.lua as a starting point if that is easier.
