Skip to main content
Inventory 4.0

Shared exports

Register items, shops and crafting places from shared resource files.

Setup overview

Integration notes

Shared execution

Call these exports on both the client and server from a shared Lua file.

Item start order

Registering items from another resource is not recommended. If that resource starts too late, an unregistered item may not be added and may be deleted from an inventory.

API reference

Shared exports

Extend the inventory from another resource.

3 exports
registerItem(name, itemData)

Registers an item definition from another resource.

namestringitemDataRegisteredItemData
createShop(id, shopData)

Creates a shop from another resource.

idstringshopDataShopStaticData
createCraftPlace(craftPlaceData)

Creates a crafting place from another resource.

craftPlaceDataCraftingPlaceStaticData

Shop data

Configuration

Shop data type

Define a shop created through the shared export.

---@class ShopStaticData
---@field shopName string
---@field items ShopItem[]
---@field blip? { sprite: number; colour:number; scale:number; }
---@field locations { x: number; y:number; z:number; }[]
---@field peds? { modelName: string; scenario?:string; coords: vector3; heading:number; }[]

Crafting place data

Configuration

Crafting place data type

Define a crafting place created through the shared export.

---@class CraftingPlaceStaticData
---@field craftPlaceName string
---@field items { name:string; quantity: number; meta: InventoryItemMetaData; ingredients: { name:string; quantity:number; }[] }[]
---@field blip? { sprite:number; colour:number; scale:number; }
---@field peds? { modelName:string; scenario?: string; coords?: vector3; heading: number; }[]
---@field locations? { range:number; coords: vector3; }[]
Configuration

Register an item

Register an item definition from a shared resource file.

exports["avp_inv_4"]:registerItem(name, itemData)
Configuration

Create a shop

Register a shop from a shared resource file.

exports["avp_inv_4"]:createShop(id, shopData)
Configuration

Create a crafting place

Register a crafting place from a shared resource file.

exports["avp_inv_4"]:createCraftPlace(craftPlaceData)