NightZoom LogoNightZoom

API Reference

Public exports and events for BJJ Loot Pool v1 integration

Server Exports

BJJ Loot Pool operates server-side only. All exports below are server-side functions.

Exports

ExportParametersReturnsDescription
createLootPool(data)data: tablestringCreates a new loot pool. Returns pool ID.
addLootToPool(poolId, loot)poolId: string, loot: tablebooleanAdds loot to a pool.
removeLootFromPool(poolId, lootId)poolId: string, lootId: stringbooleanRemoves loot from a pool.
spawnDrop(data)data: tablestringSpawns a loot drop in the world. Returns drop ID.
removeDrop(dropId)dropId: stringbooleanRemoves a loot drop by ID.

Parameter Details

createLootPool

  • data: table with the following fields:
    • name: string — Pool name
    • items: table — Array of item tables (see below)
    • rarity: string — Rarity label (optional)
    • meta: table — Any additional metadata (optional)

addLootToPool / removeLootFromPool

  • poolId: Pool ID (string)
  • loot: Loot table (see below)
  • lootId: Loot ID (string)

spawnDrop

  • data: table with the following fields:
    • poolId: string — Loot pool to use
    • coords: vector3 — World coordinates
    • meta: table — Any additional metadata (optional)

removeDrop

  • dropId: Drop ID (string)

Example Data Structure

{
  name = 'police_safe',
  items = {
    { name = 'money', count = 1000, chance = 0.5 },
    { name = 'weapon_pistol', count = 1, chance = 0.1 }
  },
  rarity = 'rare',
  meta = { zone = 'bank' }
}

Events

EventParametersDescription
bjj_lootpool:client:dropSpawneddropId: string, meta: tableFired when a loot drop is spawned
bjj_lootpool:client:dropPickedUpdropId: string, meta: tableFired when a loot drop is picked up
bjj_lootpool:client:poolCreatedpoolId: string, meta: tableFired when a loot pool is created

Example Usage

-- Create a loot pool
local poolId = exports['bjj_lootpool']:createLootPool({
    name = 'police_safe',
    items = {
        { name = 'money', count = 1000, chance = 0.5 },
        { name = 'weapon_pistol', count = 1, chance = 0.1 }
    },
    rarity = 'rare',
    meta = { zone = 'bank' }
})

-- Spawn a drop from the pool
local dropId = exports['bjj_lootpool']:spawnDrop({
    poolId = poolId,
    coords = vector3(250.0, 220.0, 100.0)
})

-- Listen for drop pickup
RegisterNetEvent('bjj_lootpool:client:dropPickedUp', function(dropId, meta)
    print('Drop picked up:', dropId, meta)
end)

System Overview

BJJ Loot Pool is a server-side only system that manages dynamic loot spawning and distribution.

  • All API calls are made from server-side scripts only
  • Loot drops are managed entirely server-side for security
  • Client receives updates via statebags and events only

This resource has no client-side exports or functions. All integration happens server-side.

For advanced use cases, contact the development team for guidance on safe integration.