GetAccount
This function returns the company account class.
exports.bcs_companymanager:GetAccount(companyname)
The Account Class
Constructor
Variable | Type | Description |
---|---|---|
company | string | The company/job name |
money | number | The total money of the company |
blackMoney | number | The total dirty money of the company |
earning | number | The total earning of the company |
Functions
Function | Return Type | Description |
---|---|---|
getMoney() | number | Returns the company money |
addEarning(amount) | nil | Adds earning to the company. Amount in number |
addMoney(account, amount) | nil | Adds money to the company. Account in string can be money or black_money . Amount in number |
removeMoney(account, amount) | nil | Removes money from the company. Account in string can be money or black_money . Amount in number |
Example Usage
You can use this to add/remove money/black money.
RegisterCommand('withdrawpolice', function(source, args, raw)
local companyAccount = exports['bcs_companymanager']:GetAccount('police')
local xPlayer = ESX.GetPlayerFromId(source)
if companyAccount.money >= 5000 then
companyAccount.removeMoney('money', 5000)
xPlayer.addMoney(5000)
end
end, true)
RegisterCommand('withdrawblackpolice', function(source, args, raw)
local companyAccount = exports['bcs_companymanager']:GetAccount('police')
local xPlayer = ESX.GetPlayerFromId(source)
if companyAccount.blackMoney >= 5000 then
companyAccount.removeMoney('black_money', 5000)
xPlayer.addMoney(5000)
end
end, true)
QB Example for qb-customs
.
qb-customs/server/sv_bennys.lua