GetCompany
This function returns the company class.
exports.bcs_companymanager:GetCompany(companyname)
The Company Class
Constructor
Variable | Type | Description |
---|---|---|
name | string | The company/job name |
label | string | The company/job label |
account | table | The company account |
employee | table | A list of employees |
The Account Class
Constructor
Variable | Type | Description |
---|---|---|
company | string | The company/job name |
money | number | The amount of money |
blackMoney | number | The amount of black money |
Functions
Function | Return Type | Description |
---|---|---|
GetMoney(account) | number | Returns the company money |
AddEarning(amount) | nil | Adds earning to the company. Amount in number |
AddMoney(account, amount, identifier, reason, isPaying) | nil | Adds money to the company. Account in string can be money or black_money . Amount in number, identifier can be player Identifier or job name |
RemoveMoney(account, amount, identifier, reason, isPaying) | nil | Removes money from the company. Account in string can be money or black_money . Amount in number, identifier can be player Identifier or job name |
Example Usage
You can use this to add/remove money/black money.
RegisterCommand('withdrawpolice', function(source, args, raw)
local company = exports.bcs_companymanager:GetCompany('police')
local xPlayer = ESX.GetPlayerFromId(source)
if company and company.account.money >= 5000 then
company.account:RemoveMoney('money', 5000)
xPlayer.addMoney(5000)
end
end, true)
RegisterCommand('withdrawblackpolice', function(source, args, raw)
local company = exports.bcs_companymanager:GetCompany('police')
local xPlayer = ESX.GetPlayerFromId(source)
if company and company.account.blackMoney >= 5000 then
company.account:RemoveMoney('black_money', 5000)
xPlayer.addMoney(5000)
end
end, true)
QB Example for qb-customs
.
qb-customs/server/sv_bennys.lua