API Reference
Public exports and events for BJJ Lib v1 integration
This page documents the public API for BJJ Lib v1. Only use these exports and events for integration.
Asset Loading
| Export | Parameters | Returns | Description |
|---|---|---|---|
loadModel(model) | model: string | number | void | Loads a model and waits for completion |
unloadModel(model) | model: string | number | void | Unloads a model to free memory |
loadAnimDict(dict) | dict: string | void | Loads an animation dictionary |
unloadAnimDict(dict) | dict: string | void | Unloads an animation dictionary |
loadPtfxDict(dict) | dict: string | void | Loads a particle FX dictionary |
unloadPtfxDict(dict) | dict: string | void | Unloads a particle FX dictionary |
Entity Management
| Export | Parameters | Returns | Description |
|---|---|---|---|
networkEntity(entity) | entity: number | void | Takes network control and sets as mission entity |
String Utilities
| Export | Parameters | Returns | Description |
|---|---|---|---|
capitalizeFirstLetter(str) | str: string | string | Capitalizes the first letter of a string |
startsWith(str, start) | str: string, start: string | boolean | Checks if string starts with prefix |
Example Usage
-- Load and spawn a vehicle
exports['bjj_lib']:loadModel('adder')
local vehicle = CreateVehicle('adder', coords, heading, true, false)
exports['bjj_lib']:networkEntity(vehicle)
exports['bjj_lib']:unloadModel('adder')
-- Load animations
exports['bjj_lib']:loadAnimDict('anim@mp_player_intmenu@key_fob@')
TaskPlayAnim(ped, 'anim@mp_player_intmenu@key_fob@', 'fob_click', 8.0, 8.0, -1, 48, 0, false, false, false)Inventory Integration
| Export | Parameters | Returns | Description |
|---|---|---|---|
HasItem(source, item, amount) | source: number, item: string, amount?: number | boolean | Checks if player has required item count |
ServerhasRequiredItems(source, data) | source: number, data: table[] | boolean, table | Checks multiple items, returns missing items |
damageItem(source, item, amount) | source: number, item: table, amount: number | boolean | Damages an item's durability |
Parameter Details
HasItem
source: Player's server IDitem: Item name (string)amount: Required amount (defaults to 1)
ServerhasRequiredItems
source: Player's server IDdata: Array of{ item: string, count: number }tables
damageItem
source: Player's server IDitem: Item table with slot informationamount: Damage amount to apply
Example Usage
-- Check if player has items
if exports['bjj_lib']:HasItem(source, 'lockpick', 1) then
print('Player has lockpick')
end
-- Check multiple items
local hasItems, missing = exports['bjj_lib']:ServerhasRequiredItems(source, {
{ item = 'steel', count = 5 },
{ item = 'rubber', count = 2 }
})
if not hasItems then
print('Missing items:', json.encode(missing))
endBJJ Lib
Best Lib in the land trust me. Nothing too crazy here but I recommend using these or their ox_lib equivalents when needed in your systems
BJJ Loot Pool
BJJ Loot Pool is a modular, closed-source loot and drop management framework for FiveM. It provides public APIs and event hooks for creating, distributing, and managing loot pools and drops, while keeping internal logic secure.