# Frameworks

If you use any custom framework other than ESX/QBCore, you will have to write a small integration to our script.

This will required the very basics of LUA or programming, as you will be only rewriting some existing values.

We can't really provide support to include all your frameworks, so please pay attention and follow this easy guide :)

First of all, add your framework to Frameworks in `config.lua`.

### Where?

The framework integration is located in the file `server\lib\frameworkBridge.lua`

### How?

Here you can see a commented part starting at line 62 (marked with line `CUSTOM FRAMEWORK`). All you have to do to start is to simply remove comment from the `elseif` block.

Inside the `elseif` block copy paste the QBCORE integration above (in the file) and simply add your own functions.

### **Am I doing it right?**

Let's say your framework is called STEVE, for better preview :) Your integration should then look like this:

```lua
elseif Config.Framework == Frameworks.STEVE then
    QBCore = {}
    ESX = {}
    Steve = ... -- function to get object of your framework

    ESX.GetPlayerFromId = function(source)
        local xPlayer = {}
        local stevePlayer = Steve.GetPlayer(source)

        ---------
        xPlayer.getMoney = function()
            return stevePlayer.GetMoney("cash") -- ***
        end
        ---------

        ... -- and other needed functions here

        return xPlayer
    end
end
```

So if you understand correctly, you should now know, that you simply need to only write the return functions inside xPlayer functions, like the one marked with `***`.

### List of used functions

### ESX

```lua
xPlayer = ESX.GetPlayerFromId(playerId)
xPlayer.getGroup()
xPlayer.addInventoryItem(itemName, amount)
xPlayer.removeInventoryItem(itemName, amount)
xPlayer.getInventoryItem(itemName) -- returns count, name

ESX.RegisterUsableItem(item, cb)
ESX.UseItem(playerId, xItem.name) -- xItem returned by getInventoryItem
```

### QBCore

```lua
QBCore.Functions.HasPermission(src, group)
QBCore.Functions.CreateUseableItem(item, cb)

player = QBCore.Functions.GetPlayer(source)
player.Functions.AddItem(itemName, amount)
player.Functions.RemoveItem(itemName, amount)
player.Functions.GetItemByName(itemName) -- returns amount, anme

QBCore.Functions.UseItem(player.source, item) -- item returned by GetItemByName
```


---

# 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://documentation.rcore.cz/paid-resources/rcore_camping/framework.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.
