Browse docs

Overview

How the export-based action hook system works.

onAction Export

The onAction export lets external resources register callbacks for specific actions. Works on both client and server side with the same API.

local unsubscribe = exports["sky_ambulancejob"]:onAction(action, callback)
  • Arguments:
    • action (string): The action to listen for.
    • callback (function): Called with a context table when the action fires.
  • Returns: function — call it to unsubscribe the listener.

Unsubscribing

Every onAction call returns an unsubscribe function:

local unsub = exports["sky_ambulancejob"]:onAction("xray:start", function(ctx)
    -- one-time logic
end)

-- Later, when no longer needed:
unsub()

Support

Need help? Our support team is always ready to assist

Join Discord