FiveM modules
Each module loads the first time you use it.
| Module | What it does |
|---|---|
Fx.net |
handle(name, schema, handler, { rateLimit = '10/s' }), stream(name, schema), send, broadcast, emit |
Fx.rpc |
register(name, { input, output?, rateLimit? }, handler), call(name, input, { timeout }) (client), callClient(player, name, input) (server) |
Fx.security |
on(fn) or stream() for invalid_payload, rate_limited, unknown_rpc and invalid_state, also fired as the rivo_fx:security event |
Fx.player |
scope(src), fork(src, eff), onDrop(src, fn): tied to the player's session |
Fx.onStop(fn), Fx.resourceScope |
resource lifecycle; every open scope closes on stop |
Fx.config |
typed convars (int, bool, enum, json, ...) and config files |
Fx.log, Fx.logInfo(...) |
levelled logs, level from the rivo_fx:logLevel convar |
Fx.assets |
model, animDict, animSet, ptfx, textureDict, scaleform, audioBank, each with a scoped use* variant |
Fx.entity |
exists, requestControl, fromNetId, scoped spawnVehicle/Ped/Object |
Fx.kvp |
typed resource KVP: get(key, schema), set, keys(prefix), typed(prefix, schema) with get/set/delete/ids/all; refuses values JSON would corrupt |
Fx.state |
schema-typed state bag keys: key(name, schema) with get/set/clear/onChange/watch/await/changes on global(), player(src), entity(ent); invalid client writes become invalid_state security events |
Fx.db |
oxmysql as typed effects (server): query(sql, params, { row = schema }), single, scalar, insert, update, prepare, transaction; failures are SqlError / SqlDecodeError; swap the driver with the Fx.db.Database service |
Fx.framework |
one player/money/job API over ESX, QBCore, Qbox and standalone (server): the Framework service from Fx.framework.auto (or .esx/.qbcore/.qbox/.standalone) with getPlayer, getMoney, addMoney, removeMoney (fails InsufficientFunds), setJob, onPlayerLoaded/Unloaded, onJobChange |
Fx.nui |
typed NUI (client): handle(name, { input, output? }, fn) answers the page's fetch with { ok, value } or a typed error (NuiInvalidInput, your tagged errors, NuiInternalError without details); send(type, payload, schema?); scoped useFocus(). The page side is @rivolabs/fx-nui |
Fx.tick |
frame-bound work that stops cleanly: everyFrame(fn), whileNear(coords, radius, fn), whileTrue(cond, fn) |
Fx.compat |
ox_lib bridge: spec.libCallback = true on Fx.rpc.register, Fx.compat.libCallback(name, ...) |
The wire protocol, shared by the Lua and JS implementations, is in docs/PROTOCOL.md.