🔗Frameworks

On this page you will find anything you need to setup the framework integration of a Codineer product.

Framework Library

The Framework Library is Codineer's in-house interface to manage different frameworks and make integration consistent for each product. All content on this page refers exclusively to the Framework Library.

Supported Frameworks

  1. ESX Legacy

  2. ESX Infinity

  3. QBCore

  4. Custom Framework (Guide below)

  5. Standalone

Configuration file

All settings of the framework library can be found in the respective product folder in the framework.json file and here: https://github.com/Garmingo/framework-js-client/blob/master/framework.json

Settings

AutoDetect

AutoDetect specifies if the Framework Library should try to automatically detect the used framework. Only works for ESX Legacy, ESX Infinity and QBCore.

Sometimes AutoDetect falsely identifies ESX Legacy as ESX Infinity. Manual change is required.

Framework

This field sets the framework to use. It is either set by AutoDetect or by yourself. Please note that AutoDetect will overwrite this setting if set to true.

ESXEvent

This field sets the ESX Shared Object Event and is only needed for ESX Infinity.

Trying to enter the ESX Legacy Export will break the configuration. There is no need to specify the Export!

ExportResource

This field specifies which resource is exporting the framework functions. Only needed for Custom Framework.

Setting up a custom framework

The integration of custom frameworks with the framework library works via exports. It is important that all exports listed below exist and are implemented with the correct parameters and return types.

Server-side export functions

NameParametersReturn typeDescription

GetPlayerWalletMoney

source (player handle; int)

int

Returns the players wallet/cash money

GetPlayerAccountMoney

source (player handle; int), account (string)

int

Returns the players money in the given account. 0 if account does not exist

AddPlayerWalletMoney

source (player handle; int), amount (int)

void/none

Adds the given amount to the players wallet/cash money

AddPlayerAccountMoney

source (player handle; int), amount (int), account (string)

void/none

Adds the given amount to the given account

RemovePlayerWalletMoney

source (player handle; int), amount (int)

void/none

Removes the given amount from the players wallet/cash money

RemovePlayerAccountMoney

source (player handle; int), amount (int), account (string)

void/none

Removes the given amount from the given account

AddPlayerInventoryItem

source (player handle; int), item (string), amount (int)

void/none

Adds the given item to the players inventory

RemovePlayerInventoryItem

source (player handle; int), item (string), amount (int)

void/none

Removes the given item from the players inventory

GetPlayerInventoryItemCount

source (player handle; int), item (string)

int

Returns the quantity a player has of a given item

Client-side export functions

NameParametersReturn typeDescription

GetPlayerJobName

None

string

Returns the players job name

GetPlayerJobGrade

None

int

Returns the players job grade

GetInventoryItemCount

item (string)

int

Returns the quantity of the given item in the players inventory

Developer Reference

Here you will find a list of all available functions and how to use them. You can find the libraries here: https://github.com/Garmingo/Framework-Library

Initialization

lua
local framework = Framework:new()
c#
private Framework framework = new Framework();
js
const framework = new Framework();

Server-side

getConfig()

Returns the framework config.

  • Returns: FrameworkConfig

isInitialized()

Checks if the framework is initialized.

  • Returns: boolean - Whether the framework is initialized.

getFramework()

Returns the raw framework object.

  • Returns: any - Framework object.

getFrameworkName()

Returns the framework name.

  • Returns: string - Framework name.

getPlayerWalletMoney(player: number)

Get the wallet money of a player.

  • Parameters:

    • player: number - Player ID.

  • Returns: number - Wallet money.

getPlayerAccountMoney(player: number, account: string)

Get the money of a specific account of a player.

  • Parameters:

    • player: number - Player ID.

    • account: string - Account name (e.g., bank).

  • Returns: number - Account money.

addPlayerWalletMoney(player: number, amount: number)

Add money to the wallet of a player.

  • Parameters:

    • player: number - Player ID.

    • amount: number - Amount to add.

  • Returns: void

removePlayerWalletMoney(player: number, amount: number)

Remove money from the wallet of a player.

  • Parameters:

    • player: number - Player ID.

    • amount: number - Amount to remove.

  • Returns: void

addPlayerAccountMoney(player: number, account: string, amount: number)

Add money to a specific account of a player.

  • Parameters:

    • player: number - Player ID.

    • account: string - Account name (e.g., bank).

    • amount: number - Amount to add.

  • Returns: void

removePlayerAccountMoney(player: number, account: string, amount: number)

Remove money from a specific account of a player.

  • Parameters:

    • player: number - Player ID.

    • account: string - Account name (e.g., bank).

    • amount: number - Amount to remove.

  • Returns: void

addPlayerInventoryItem(player: number, item: string, amount: number)

Add an item to the inventory of a player.

  • Parameters:

    • player: number - Player ID.

    • item: string - Item name.

    • amount: number - Amount to add.

  • Returns: void

removePlayerInventoryItem(player: number, item: string, amount: number)

Remove an item from the inventory of a player.

  • Parameters:

    • player: number - Player ID.

    • item: string - Item name.

    • amount: number - Amount to remove.

  • Returns: void

getPlayerInventoryItemCount(player: number, item: string)

Get the amount of an item in the inventory of a player.

  • Parameters:

    • player: number - Player ID.

    • item: string - Item name.

  • Returns: number - Amount of the item.

Client-side

getConfig(): FrameworkConfig

Returns the framework config.

  • Returns: FrameworkConfig

isInitialized(): boolean

Checks if the framework is initialized.

  • Returns: boolean - Whether the framework is initialized.

getFramework(): any

Returns the raw framework object.

  • Returns: any - Framework object.

getFrameworkName(): string

Returns the framework name.

  • Returns: string - Framework name.

getPlayerJobName(): string

Returns the name of the player’s job.

  • Returns: string - Job name.

getPlayerJobGrade(): number

Returns the grade of the player’s job.

  • Returns: number - Job grade.

getInventoryItemCount(item: string): number

Returns the count of a specific item in the player’s inventory.

  • Parameters:

    • item: string - Item name.

  • Returns: number - Item count.

addCarKeys(plate: string): void

Adds the keys for a car to the player’s keys. (QB-Core only)

  • Parameters:

    • plate: string - Car plate.

Note: This function is specific to QB-Core.

Last updated