Callbacks

CLIENT & SERVER SIDE

A standalone, framework-agnostic callback system designed to streamline client-server communication in FiveM projects.

It provides developers with a single, unified API for handling server callbacks, eliminating the need to write and manage multiple callback implementations for different frameworks.

Client Functions

callback

Trigger a server callback. All callbacks must be registered first on the server in order to be called.

--- Specfig the event name for the callback you created on the server.
local event_name = 'your event name'

--- Data *(optional)*
-- Any data sent this way from client you should always validate again on server.
local data = {
    ['some data key'] = 'some value'
}

--- Utils object
utils.callback.cb(event_name, data, function(response)
   if response then
       -- Do something
   end
end)

--- Direct export
exports.boii_utils:trigger_callback(...)

Server Functions

register_callback

Use the following to register a callback on the server.

--- Utils object
utils.callback.register('your_event', function() ... end)

--- Direct export
exports.boii_utils:register_callback('your_event', function() ... end)

Last updated