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

# PS-Inventory snippets

There are only two functions for inventories.\
You can find them in server/inventory/\*.lua its different for many inventories.

## **These functions above is for ps-inventory:**

One of them is giveItem function:

```lua
--- @param src number
--- @param type string
--- @param count number
function giveItem(src, item, count)
    exports['ps-inventory']:AddItem(src, item, count)
    notify.send(src, string.format(Locales.Get("GOT_ITEM"), count, item), 2500)
end
```

And the second one is canCarry function:

```lua
--- @param src number
--- @param type string
--- @param count number
function canCarry(src, item, count)
    local Player = QBCore.Functions.GetPlayer(src)
    local totalWeight = exports['ps-inventory']:GetTotalWeight(Player.PlayerData.items)
    local itemInfo = QBCore.Shared.Items[item:lower()]
    if totalWeight + (itemInfo['weight'] * count) <= Config.MaxInventoryWeight then
        return true
    else
        notify.send(src, Locales.Get('NOT_E_SPACE'), 'info', 2500)
    end
end
```

Also add new value into config.lua for this case:

```lua
Config.MaxInventoryWeight = 120000 -- written in grams (120000g == 120kg)
```

1. Make new file in server/inventory/\[name-of-inventory].lua
2. Add new enum for your inv in shared/enum.lua\
   Just like that:\
   Inventory = { OXInventory = 1, QBInventory = 2, ESXInventory = 3, \[YOUR-INVENTORY] = 4 }
3. And thats it, only you need to do is change number to yours Config.InventorySystem = 4

```lua
if Config.InventorySystem == Inventory.[YOUR-INVENTORY] then
    -- Here you can insert these two functions
end
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://baspel.gitbook.io/baspel-docs/scripts/advent-calendar/ps-inventory-snippets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
