Skip to main content

Introduction

The Framework Library offers a simple and easy way to manage and use all major FiveM frameworks in one place without having to write code for every single framework.

This means for every functionality there is one single function that automatically executes the correct code for the framework that is currently being used.

This can be very useful if you want to use multiple frameworks in your project or if you want to switch to another framework without having to rewrite your entire code.

It also makes the code more readable and easier to understand and shortens the development time significantly.

Developer Reference​

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

Initialization​

Lua​

local framework = Framework:new()

C#​

private Framework framework = new Framework();

Javascript​

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.

Example implementation​

-- Client
exports('GetPlayerJobName', function()
return 'police'
end)

exports('GetPlayerJobGrade', function()
return 3
end)

exports('GetInventoryItemCount', function(item)
return 1
end)

-- Server
exports('GetPlayerWalletMoney', function(source)
return 100
end)

exports('GetPlayerAccountMoney', function(source, account)
return 100
end)

exports('AddPlayerWalletMoney', function(source, amount)
print('Added ' .. amount .. ' to wallet')
end)

exports('AddPlayerAccountMoney', function(source, amount, account)
print('Added ' .. amount .. ' to account ' .. account)
end)

exports('RemovePlayerWalletMoney', function(source, amount)
print('Removed ' .. amount .. ' from wallet')
end)

exports('RemovePlayerAccountMoney', function(source, amount, account)
print('Removed ' .. amount .. ' from account ' .. account)
end)

exports('AddPlayerInventoryItem', function(source, item, count)
print('Added ' .. count .. ' ' .. item .. ' to inventory')
end)

exports('RemovePlayerInventoryItem', function(source, item, count)
print('Removed ' .. count .. ' ' .. item .. ' from inventory')
end)

exports('GetPlayerInventoryItemCount', function(source, item)
return 1
end)