# Exports

## Server Exports

### getPlayerInventory

{% code fullWidth="false" %}

```lua
---Get player inventory data| 1 param
---@param user_id int | required
--- return array
exports.axr_inventory:getPlayerInventory(user_id);

```

{% endcode %}

### getUserMaxWeight

{% code fullWidth="false" %}

```lua
---Get player max weight| 1 param
---@param user_id int | required
--- return number (Int32)
exports.axr_inventory:getUserMaxWeight(user_id);
```

{% endcode %}

### getUserWeight

{% code fullWidth="false" %}

```lua
---Get player current weight| 1 param
---@param user_id int | required
--- return number (Int32)
exports.axr_inventory:getUserWeight(user_id);
```

{% endcode %}

### getVehicleItems

{% code fullWidth="false" %}

```lua
---Get vehicle items (trunk/glovebox) | 3 params
---@param user_id int | required
---@param category string | required, 'trunk' or 'glovebox'
---@param vehicle_code string | required
--- return array
exports.axr_inventory:getVehicleItems(user_id, category, vehicle_code);
```

{% endcode %}

### getPlayerItemAmount

{% code fullWidth="false" %}

```lua
---Get player item amount | 2 params
---@param user_id int | required
---@param item_code string | required
--- return number (Int32)
exports.axr_inventory:getPlayerItemAmount(user_id, item_code); 
```

{% endcode %}

### hasPlayerItem

{% code fullWidth="false" %}

```lua
---Has player item in inventory | 2 params
---@param user_id int | required
---@param item_code string | required
--- return boolean (true/false)
exports.axr_inventory:hasPlayerItem(user_id, item_code); 
```

{% endcode %}

### removePlayerItem

{% code fullWidth="false" %}

```lua
---Remove player item from inventory | 5 params
---@param user_id int | required
---@param item_code string | required
---@param amount int | required
---@param notify boolean | required (true/false)
---@param from string | optional
--- return boolean (true/false) if item was removed
exports.axr_inventory:removePlayerItem(user_id, item_code, amount, notify, from);
```

{% endcode %}

### givePlayerItem

{% code fullWidth="false" %}

```lua
---Give player item | 5 params
---@param user_id int | required
---@param item_code string | required
---@param amount int | required
---@param notify boolean | required (true/false)
---@param from string | optional
--- return boolean (true/false) if item was added in player inventory
exports.axr_inventory:givePlayerItem(user_id, item_code, amount, notify, from);
```

{% endcode %}

### openChest

{% code fullWidth="false" %}

```lua
---Give player item | 3 params
---@param user_id int | required
---@param chestId string | required
---@param type string | required , need to match with Config.allowedChestType
--- return boolean (true/false) return true if chest is successful open by player
exports.axr_inventory:openChest(user_id,chestId,type);
```

{% endcode %}

### createItem

{% code fullWidth="false" %}

```lua
---Create Inventory Item | 6 params
---@param item string | required
---@param item name | optional (if not is replaced with 'No item name')
---@param description string | optional (if not is replaced with 'No item description')
---@param weight float | optional (if not is replaced with 0.01)
---@param type string | optional (if not is replaced with 'all')
---@param onUse function | optional (if not item is not usable)
--- return boolean (true/false) return true if item was created
exports.axr_inventory:createItem(item, name, description, weight, itemType, onUse);
```

{% endcode %}

### getItemWeight

{% code fullWidth="false" %}

```lua
---Get item weight | 1 param
---@param item_code string | required
--- return float/integer| return 0.0 if item_code is nil
exports.axr_inventory:getItemWeight(item_code);
```

{% endcode %}

### getItemType

{% code fullWidth="false" %}

```lua
---Get item type | 1 param
---@param item_code string | required
--- return string | return nil if item_code is nil or 'all' if type is not setted in config/items.lua
exports.axr_inventory:getItemType(item_code);
```

{% endcode %}

### getItemName

{% code fullWidth="false" %}

```lua
---Get item name | 1 param
---@param item_code string | required
--- return string | return nil if item_code is nil or 'No Name' if type is not setted in config/items.lua
exports.axr_inventory:getItemName(item_code);
```

{% endcode %}

Extra Events: (client)<br>

```lua
axr_inventory:closeForceInventory
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://axero-scripts.gitbook.io/axr-documentation/resources/axr_inventory/exports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
