# Export and Events

## **EXPORTS**

#### CLIENT EXPORTS

With this export you can search and control player inventory.(Only nearby players)

```lua
exports['bp_inventory']:searchcplayer()
```

#### SERVER EXPORTS

You can add items with this export.

```lua
exports['bp_inventory']:AddItem(source, item, amount, info, slot)
```

You can delete items with this export.

```lua
exports['bp_inventory']:RemoveItem(source, item, amount, slot)
```

With this export, you can get the information of the item with the item name.

```lua
exports['bp_inventory']:GetItemByName(source, item)
```

With this export, you can pull item information and quantity with item name.

```lua
exports['bp_inventory']:hasItem(source, item)
```

With this export you can retrieve information about the weight of the player's inventories.

```lua
exports['bp_inventory']:getWeight(source)
```

The total weight of the player's inventories.

```lua
exports['bp_inventory']:getMaxWeight(source)
```

Pulls information according to inventory type and inventory id. (playerid etc.) <mark style="color:red;">Types</mark> : **backpack, pocket, weapon, clothing, others. (id like playerid or string)**

```lua
exports['bp_inventory']:getinvinfo(type, id)
```

This export creates new inventory information with the incoming information. <mark style="color:red;">Types</mark> : **backpack, pocket, weapon, clothing, others. (id like playerid or string)**

<pre class="language-lua"><code class="lang-lua"><strong>exports['bp_inventory']:insertinvinfo(typed, id, data, slot, weight)
</strong></code></pre>

This export is used to update the existing inventory information. <mark style="color:red;">Types</mark> : **backpack, pocket, weapon, clothing, others. (id like playerid or string)**

```lua
exports['bp_inventory']:updateinvinfo(typed, id, data)
```

## EVENTS

#### CLIENT EVENTS

You can close the inventory with this event.

```lua
TriggerEvent('bp_inventory:closeinventory')
```

You can change clothes with this event.

```lua
TriggerEvent('bp_inventory:setclothing2', iteminfo)
```

### Stash

You can open stash with this event.

* type : ‘stash’
* stashid : ‘example’
* other : { maxweight = weight , slot = slot }
* items : the first occurrence creates items.

```lua
TriggerServerEvent('inventory:server:OpenInventory', "stash", "Motel_1534", false, {{['name'] = "weapon_pistol", ['amount'] = 1}})
```


---

# 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://docs.0resmon.org/0resmon/0resmon-1/bp-resources/bp-inventory/export-and-events.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.
