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:

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

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

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

Last updated