HEX
HexscriptsVersion 4.0Inventory

Exports

This section lists all client-side and server-side exports in this script. Exports can be called from other scripts to interact with this script functionality.

Note

If you need additional exports for your implementation, please open a ticket on our Discord server.

Client Exports

GetVehicleCapacity

Returns the capacity of a vehicle.

local capacity = exports['hex_4_inventory']:GetVehicleCapacity(spawncode, isGlove)

Prop

Type

CloseInventory

Closes the inventory for the player.

exports['hex_4_inventory']:CloseInventory()

LockInventory

Locks the inventory for the player. This can be used to prevent to open the inventory.

exports['hex_4_inventory']:LockInventory(state)

Prop

Type

OpenTrunk

Trys to open the trunk inventory for the vehicle in front of the player.

exports['hex_4_inventory']:OpenTrunk()

OpenGlove

Trys to open the glovebox only works if the player is in a vehicle returning a bool whether the glovebox was opened or not.

local success = exports['hex_4_inventory']:OpenGlove()

Server Exports

OpenInventory

Opens an inventory for a player.

local success = exports['hex_4_inventory']:OpenInventory(playerId, inventoryData)

-- example
local playerObject = GetPlayerObject(source)
local job = GetPlayerJob(playerObject)

local success = exports['hex_4_inventory']:OpenInventory(playerId, {
    id = ('fraction_%s'):format(job.name),
    type = 'fraction',
    title = ('Fraction Inventory: %s'):format(job.label),
    weight = false
})

Prop

Type

GetInventory

Returns the inventoryData for a specific inventory.

local inventory = exports['hex_4_inventory']:GetInventory(playerObject, inventoryData)

Prop

Type

AddItemToInventory

Adds an item to a specific inventory.

local success = exports['hex_4_inventory']:AddItemToInventory(playerId, playerObject, itemData, count, inventoryData)

Prop

Type

RemoveItemFromInventory

Removes an item to a specific inventory.

exports['hex_4_inventory']:RemoveItemFromInventory(playerObject, itemData, count, inventoryData, cb)

Prop

Type

ChangeInventoryPlate

Changes the plate of a vehicle inventory. This can be used when a player changes the plate of their vehicle to also update the inventory id.

exports['hex_4_inventory']:ChangeInventoryPlate(oldPlate, newPlate)

Prop

Type