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

# QB-core

* If you're getting a “Save Inventory” error, you can find the solution in the “[ERROR](/devix/devix-inventory/errors.md)” section.
* Remove **qb-weapons** from your files

***

QBCore.Player.CheckPlayerData  Line 155-159

{% code expandable="true" %}

```lua
if not Offline and GetResourceState('devix-inventory') == 'started' then
    local ok, items = pcall(function()
        return exports['devix-inventory']:LoadInventory(PlayerData.source, PlayerData.citizenid)
    end)
    if ok and type(items) == 'table' then
        PlayerData.items = items
    end
elseif GetResourceState('qb-inventory') ~= 'missing' then
    PlayerData.items = exports['qb-inventory']:LoadInventory(PlayerData.source, PlayerData.citizenid)
end
```

{% endcode %}

***

qb-core/server/functions.lua replace it&#x20;

```lua
function QBCore.Functions.HasItem(items, amount)
    local invRes = (GetResourceState('devix-inventory') == 'started') and 'devix-inventory' or 'qb-inventory'
    local ok, result = pcall(function()
        return exports[invRes]:HasItem(items, amount)
    end)
    if ok and result == true then return true end
    return false
end
```

***

qb-core/server/functions   511.line

{% code expandable="true" %}

```lua
function QBCore.Functions.UseItem(source, item) 
    if GetResourceState('devix-inventory') == 'started' then
        exports['devix-inventory']:UseItem(source, item)
        return
    end
    if GetResourceState('qb-inventory') ~= 'missing' then
        exports['qb-inventory']:UseItem(source, item)
    end
end

```

{% endcode %}

***

You can change this on line 47 of qb-core/client/functions.lua.

{% code expandable="true" %}

```lua
function QBCore.Functions.HasItem(items, amount)
    local invRes = (GetResourceState('devix-inventory') == 'started') and 'devix-inventory' or 'qb-inventory'
    local ok, result = pcall(function()
        return exports[invRes]:HasItem(items, amount)
    end)
    if ok and result == true then return true end
    return false
end
```

{% endcode %}

***

qb-core/server/player.lua   603-611. Lines

{% code expandable="true" %}

```lua
function QBCore.Player.SaveInventory(source)
    if GetResourceState('devix-inventory') == 'started' then
        pcall(function() exports['devix-inventory']:SaveInventory(source, false) end)
        return
    end
    if GetResourceState('qb-inventory') == 'missing' then return end
    pcall(function() exports['qb-inventory']:SaveInventory(source, false) end)
end
function QBCore.Player.SaveOfflineInventory(PlayerData)
    if GetResourceState('devix-inventory') == 'started' then
        pcall(function() exports['devix-inventory']:SaveInventory(PlayerData, true) end)
        return
    end
    if GetResourceState('qb-inventory') == 'missing' then return end
    pcall(function() exports['qb-inventory']:SaveInventory(PlayerData, true) end)
end
```

{% endcode %}

***

qb-core/server/player.lua  613-625.line

{% code expandable="true" %}

```lua
function QBCore.Player.GetTotalWeight(items)
    if GetResourceState('devix-inventory') == 'started' then
        return exports['devix-inventory']:GetTotalWeight(items)
    end
    if GetResourceState('qb-inventory') == 'missing' then return end
    return exports['qb-inventory']:GetTotalWeight(items)
end
function QBCore.Player.GetSlotsByItem(items, itemName)
    if GetResourceState('devix-inventory') == 'started' then
        return exports['devix-inventory']:GetSlotsByItem(items, itemName)
    end
    if GetResourceState('qb-inventory') == 'missing' then return end
    return exports['qb-inventory']:GetSlotsByItem(items, itemName)
end
function QBCore.Player.GetFirstSlotByItem(items, itemName)
    if GetResourceState('devix-inventory') == 'started' then
        return exports['devix-inventory']:GetFirstSlotByItem(items, itemName)
    end
    if GetResourceState('qb-inventory') == 'missing' then return end
    return exports['qb-inventory']:GetFirstSlotByItem(items, itemName)
end
```

{% endcode %}

***

qb-core/server/player.lua   327 - 397.line

{% code expandable="true" %}

```lua
function self.Functions.AddMoney(moneytype, amount, reason)
        reason = reason or 'unknown'
        -- devix-core cash-as-item: dis cagrilarda devix-core'a yonlendir (qb-banking, escrow vb.)
        if reason ~= 'devix_add' and GetResourceState('devix-core') == 'started' then
            local ok, DEVIX = pcall(function() return exports['devix-core']:getObjects() end)
            if ok and DEVIX and DEVIX.AddMoney then
                DEVIX.AddMoney(self, moneytype, amount)
                return true
            end
        end
        moneytype = moneytype:lower()
        amount = tonumber(amount)
        if amount < 0 then return end
        if not self.PlayerData.money[moneytype] then return false end
        self.PlayerData.money[moneytype] = self.PlayerData.money[moneytype] + amount

        if not self.Offline then
            self.Functions.UpdatePlayerData()
            if amount > 100000 then
                TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'AddMoney', 'lightgreen', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') added, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason, true)
            else
                TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'AddMoney', 'lightgreen', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') added, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason)
            end
            TriggerClientEvent('hud:client:OnMoneyChange', self.PlayerData.source, moneytype, amount, false)
            TriggerClientEvent('QBCore:Client:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'add', reason)
            TriggerEvent('QBCore:Server:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'add', reason)
        end

        return true
    end

    function self.Functions.RemoveMoney(moneytype, amount, reason)
        reason = reason or 'unknown'
        -- devix-core cash-as-item: dis cagrilarda devix-core'a yonlendir (qb-banking, escrow vb.)
        if reason ~= 'devix_remove' and GetResourceState('devix-core') == 'started' then
            local ok, DEVIX = pcall(function() return exports['devix-core']:getObjects() end)
            if ok and DEVIX and DEVIX.RemoveMoney then
                return DEVIX.RemoveMoney(self, moneytype, amount)
            end
        end
        moneytype = moneytype:lower()
        amount = tonumber(amount)
        if amount < 0 then return end
        if not self.PlayerData.money[moneytype] then return false end
        for _, mtype in pairs(QBCore.Config.Money.DontAllowMinus) do
            if mtype == moneytype then
                if (self.PlayerData.money[moneytype] - amount) < 0 then
                    return false
                end
            end
        end
        if self.PlayerData.money[moneytype] - amount < QBCore.Config.Money.MinusLimit then return false end
        self.PlayerData.money[moneytype] = self.PlayerData.money[moneytype] - amount

        if not self.Offline then
            self.Functions.UpdatePlayerData()
            if amount > 100000 then
                TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'RemoveMoney', 'red', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') removed, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason, true)
            else
                TriggerEvent('qb-log:server:CreateLog', 'playermoney', 'RemoveMoney', 'red', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') removed, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason)
            end
            TriggerClientEvent('hud:client:OnMoneyChange', self.PlayerData.source, moneytype, amount, true)
            if moneytype == 'bank' then
                TriggerClientEvent('qb-phone:client:RemoveBankMoney', self.PlayerData.source, amount)
            end
            TriggerClientEvent('QBCore:Client:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'remove', reason)
            TriggerEvent('QBCore:Server:OnMoneyChange', self.PlayerData.source, moneytype, amount, 'remove', reason)
        end

        return true
    end
```

{% endcode %}

#### Don't forget to change provide in fxmanifest.lua.

{% code expandable="true" %}

```lua
provide 'qb-inventory'
-- provide 'ox_inventory'
```

{% endcode %}


---

# 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://devix.gitbook.io/devix/devix-inventory/installation/qb-core.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.
