Registering a hook
RegisterHook returns a hook id. Pass it to RemoveHook to unregister:
Return values
Only the fields listed under Changeable are read back from a returned table. Any other field you change is ignored, and the MDT validates the new values again, the same way it validates player input.
payload.sourceis the player who triggered the action. It’snilwhen the action is automated (exports, timers, scripts).- If a hook errors, the error is logged and the hook is skipped. The action still goes through.
- The first hook to return
falsestops the chain. Hooks after it don’t run.
Examples
Block an action
Stop society withdrawals over a limit:Change the payload
Return the payload with the changed fields. Every hook after this one receives the changed payload.Adjust charges
onChargesIssue runs before any fine, jail time or record is written, for every flow that issues charges (penalties, incidents and warrants). Returned charges must still target the same citizens and stay within the Config.Charges caps, otherwise the action is rejected.
Enrich dispatch calls
payload.payload holds the call being created (type, code, priority, title, description, location, details).
Require something before clock in
Any check your server already has can gate an MDT action.my_garage below stands in for your own resource.
Hook list
Most payloads also includesource. It isn’t repeated in the tables below.
Incidents
entityType is penalty, incident or warrant. entityId is nil while the record is still being created.
Warrants
BOLOs
Evidence
Citizens
Vehicles & weapons
modification is { id, name, category }.
Dispatch
Field
onRadarPlateHit hides the hit from the officer and skips the dispatch call it would create.
Chat
image is { url, width?, height? }, location is { label?, x, y } and record is { kind, id, label }.
Notifications
Collaboration
Employees
Shifts
Certifications & achievements
Department
onRecordAccessChange, entityType is incident, warrant, bolo or evidence.