> For the complete documentation index, see [llms.txt](https://docs.av-scripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.av-scripts.com/laptop-pack/laptop/installation/qbcore.md).

# QBCore

### Money Accounts

This is **NOT a laptop problem**, for some reason in the latest qb-core exists a bug where existing players can't have new money accounts: <https://github.com/qbcore-framework/qb-core/issues/1110>\
\
If you are using the latest qb-core and you get the following message on console:

```
Account cosmo doesn't exist in your Framework
```

And you are **200% sure** the account is registered correctly in your qb-core, is because of the qb-core bug, to fix it go to `qb-core/server/player.lua` and **replace the function applyDefaults** with the following:

{% code title="qb-core/server/player.lua" %}

```lua
local function applyDefaults(playerData, defaults)
    for key, value in pairs(defaults) do
        if type(value) == 'function' then
            if key == "money" then
                local moneyTypes = value()
                if not playerData[key] then
                    playerData[key] = moneyTypes
                else
                    for account, balance in pairs(moneyTypes) do
                        playerData[key][account] = playerData[key][account] or balance
                    end
                end
            else
                playerData[key] = playerData[key] or value()
            end
        elseif type(value) == 'table' then
            playerData[key] = playerData[key] or {}
            applyDefaults(playerData[key], value)
        else
            playerData[key] = playerData[key] or value
        end
    end
end
```

{% endcode %}

### Items

{% hint style="warning" %}
If using **qb-inventory** 2.0.0 (or higher) or **jaksam\_inventory** you can ignore this item section.
{% endhint %}

The **UsableItems** function in qb-core is also broken when not using qb-inventory :man\_facepalming:, implement the following fix:

* Go to `qb-core/server/functions.lua` > search for function **QBCore.Functions.CreateUseableItem** and replace it with this:<br>

  ```lua
  function QBCore.Functions.CreateUseableItem(item, data)
      QBCore.UsableItems[item] = data
  end
  ```
* To avoid any error prints when you restart a resource go to `qb-core/server/events.lua` delete the event **onResourceStop**

```lua
--[[
AddEventHandler("onResourceStop", function(resName)
    for i,v in pairs(QBCore.UsableItems) do
        if v.resource == resName then
            QBCore.UsableItems[i] = nil
        end
    end
end)
]]--
```

{% hint style="danger" %}
**This errors are caused by qb-core and not my scripts.**
{% endhint %}
