> For the complete documentation index, see [llms.txt](https://striga.gitbook.io/striga-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://striga.gitbook.io/striga-docs/striga-inventory/exports-and-events.md).

# Exports & Events

Use Striga Inventory from your own scripts.

{% hint style="success" %}
**Quick start (server)**

`exports['striga-inventory']:AddItem(source, 'water_bottle', 2)`\
`exports['striga-inventory']:RemoveItem(source, 'water_bottle', 1)`
{% endhint %}

{% hint style="info" %}
**Your qb scripts need no change.** `exports['qb-inventory']:AddItem(...)` and the other qb-inventory exports still work. See [QB Compatibility](/striga-docs/striga-inventory/qb-compatibility.md).
{% endhint %}

## Where things are

| Side   | What                                                                   | Page                                                                 |
| ------ | ---------------------------------------------------------------------- | -------------------------------------------------------------------- |
| Server | Item, open / close, stash, shop and drop exports; hooks; server events | [Server](/striga-docs/striga-inventory/exports-and-events/server.md) |
| Client | qb-inventory client events. No public client exports                   | [Client](/striga-docs/striga-inventory/exports-and-events/client.md) |

## The `inv` argument

Most server exports take `inv`:

| Value                | Means                          |
| -------------------- | ------------------------------ |
| `source` (number)    | That player's inventory        |
| `'stash:<name>'`     | A stash, e.g. `'stash:police'` |
| `'trunk:<plate>'`    | A vehicle trunk                |
| `'glovebox:<plate>'` | A vehicle glovebox             |

Bad input returns `false` / `nil` / `0`. Items are checked against your framework item list.

## The `target` argument

`OpenInventory(source, target)` takes a table `{ type, id }` or a container id string (like `'trunk:ABC123'`):

| `type`          | `id`       | Checks done for you                  |
| --------------- | ---------- | ------------------------------------ |
| `'player'`      | -          | Opens the player's own inventory     |
| `'stash'`       | stash name | Job groups and distance of the stash |
| `'otherplayer'` | server id  | -                                    |
| `'drop'`        | drop id    | -                                    |
| `'trunk'`       | plate      | -                                    |
| `'glovebox'`    | plate      | -                                    |

{% hint style="warning" %}
For `otherplayer`, `trunk` and `glovebox`, **your script** checks why the player may open it (police job, vehicle unlocked...).
{% endhint %}

## Through striga-core (recommended)

If your script already uses **striga-core**, use the core item functions. They work with whatever inventory the server owner runs, not only Striga Inventory. See [striga-core Exports](/striga-docs/striga-core/exports.md).

{% content-ref url="/pages/8UCLPyBpPfEKHltcM3vv" %}
[Server](/striga-docs/striga-inventory/exports-and-events/server.md)
{% endcontent-ref %}
