Skip to Content

Inventories

Each participant’s inventory is stored in the database when the night starts and returned at the end.

Config.InventarioForHow it stores
"vrp"vRP (including the vRPex variant, detected on its own)getInventory / tryGetInventoryItem / giveInventoryItem, with slot and expiry
"ox"ESX, QBCore or QBox with ox_inventoryGetInventoryItems / RemoveItem / AddItem, with slot and metadata (serial, durability, ammo)
"qb"qb-inventory, ps-inventory, lj-inventoryPlayerData.items / RemoveItem / AddItem, with slot and info
"esx"ESX without ox_inventoryitems with removeInventoryItem/addInventoryItem and loadout weapons (ammo, attachments and tint)

How it stores

  1. Reads the inventory.
  2. Writes the copy.
  3. Checks the copy.
  4. Writes each item to gui_noite_itens_guardados.
  5. Only then removes it from the inventory.

Each item is returned only once. If something fails halfway, it continues from where it stopped.

On ESX, QBCore and QBox the inventory only changes with the player online. If they are offline at the end, everything stays stored and returns when they join.

Default kit and loot

Each inventory has a default kit and loot ready in Gui.Padroes:

InventoryDefault
oxWEAPON_PISTOL + ammo-9
qbweapon_pistol + pistol_ammo
esxthe weapon with Config.municaoArmaESX ammo

The names must exist in your inventory. The panel warns on the item card when one does not exist (“not found on the server”).

Another inventory

  1. In functions.lua, copy one of the Inv.ox, Inv.qb or Inv.esx blocks.
  2. Give it a name, for example Inv.myinv.
  3. Replace the calls with your inventory’s.
  4. Set Config.Inventario = "myinv".

Each block has the same small functions:

FunctionWhat it does
Lerlists what is in the inventory
Tirarremoves one line
Devolverreturns with slot and metadata
DarNovogives kit, airdrop and prize items
Quantidadeamount of an item
Limparempties the inventory before returning the original
Validothe item exists in the inventory
Nomeitem name for the screen
Listaitems listed in the panel
Municaoammo from the ammo base
DepoisDeMexertells the inventory it was changed (put away the weapon in hand, clear ammo)
PastaImagensfolder with item pictures for the panel