Skip to main content

Listener

The listener module wraps FiveM event registration and validates arguments before your callback runs. It works with schemas from the validator module.

Local events

Network events

API

function
required
Registers a local event through AddEventHandler.
function
required
Registers a network event through RegisterNetEvent.
function
Attaches validators to positional event arguments. Argument 1 is checked by validator 1, argument 2 by validator 2, and so on.
table
on and onNet return a metadata table with expect(...) so the validation contract can be chained close to the callback.
A failed parameter validation prints an error and raises. Keep validators strict for trusted internal events and wrap external flows with server-side permission checks where needed.

Pattern

client.lua