Skip to Content
Scriptingox_lib

ox_lib

ox_lib is a powerful library providing common functionality for FiveM resources.

Installation

Add to fxmanifest.lua:

dependency 'ox_lib'

Callbacks

Server Callback

-- Server lib.callback.register('myresource:getData', function(source, cb, param) local data = getData(param) cb(data) end) -- Client lib.callback('myresource:getData', false, function(data) print('Received:', data) end, param)

Context Menus

lib.registerContext({ id = 'mycontext', title = 'My Menu', options = { { title = 'Option 1', onSelect = function() print('Option 1 selected') end } } }) lib.showContext('mycontext')

Locales

-- locales/en.lua return { ['welcome'] = 'Welcome to the server!', ['goodbye'] = 'Thanks for playing!' } -- Usage lib.notify({ title = 'Server', description = lib.locale('welcome'), type = 'success' })

Notifications

lib.notify({ title = 'Success', description = 'Action completed!', type = 'success' })
Last updated on