# Inventory

<figure><img src="https://3746641356-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNaha8y9XrLnowcJDBY5y%2Fuploads%2Fa7jw8uiGtg9eIIfvcyGf%2F20221115121324_1.jpg?alt=media&#x26;token=d9872f0e-e8f6-43be-bdcc-502a5e66c183" 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 %}
