Skip to main content
Hooks run before an action. A handler can let it through, change it, or cancel it. Events, by contrast, only report after.

Register

server.lua
Your resource receives a copy of the payload through exports. Editing it in place does nothing: return the changed table.

Order

Lower priority runs first, default 0. Ties run in registration order.

Safety

  • A crashing handler is logged and skipped. It never cancels, so a bug cannot block core actions.
  • Hooks belong to the resource that registered them, and are removed when it stops.
  • Unknown hook names raise with a suggestion: Did you mean "Players:BeforeDown"?
  • UgCore.Hooks.Unregister(id) removes one.

Every hook

Cancelled actions return false, 'no_permission' to the caller.