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)