# Inventory

<figure><img src="/files/Z6sWF9KuuKapgR9R9zFF" alt=""><figcaption><p>Inventory System with categories, rarity and more !</p></figcaption></figure>

Legend\
\
\_InfinitySource = Source Player \
Quantity = Quantity sended or added \
PlayerDatas.\_Inventory = Inventory of player \
false/true = Show notification or not

{% code title="INVENTORY" overflow="wrap" %}

```lua
--  Add item in inventory
exports.undead_needs:AddInventoryItem(_InfinitySource, itemname, tonumber(quantity), playerDatasInventory, true)

--  Remove item from inventory
exports.infinity_core:RemoveInventoryItem(_InfinitySource, itemdb, tonumber(quantity), PlayerDatas._Inventory, false)

-- Use Item from inventory
exports.infinity_core:UseInventoryItem(_InfinitySource, itemname, PlayerDatas._Inventory)

-- Check player have item in inventory (return int or nil)
exports.infinity_core:CheckPlayerInventory(_InfinitySource, itemdb)

```

{% endcode %}

{% code title="Example of made item" %}

```json
{
        "name"              : "WEAPON_MELEE_KNIFE_JAWBONE",
        "label"             : "Knife Jawbone",
        "description"       : "A best knife oh yeah!",
        "weight"            : 1.0,
        "type_item"         : "weapon",
        "for_item"          : "",
        "bonus"             : 0,
        "bonus2"            : 0,
        "bonus3"            : 0,
        "droped"            : 1,
        "rare"              : "common",
        "img"               : "items/weapon_melee_knife_jawbone.png"
 },

-- Category: drink, eat, ammo, ammo_clip, weapon, standard, health
-- Rare: common, rare, gold, legendary, mythic

-- In future updates a decay system is planned for eat
```

{% endcode %}


---

# 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://altitude-dev.gitbook.io/doc/global-functions/inventory.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.
