API
Functions for Job Account. Modify them inside bridge/jobaccount/server.lua for custom changes.
Get a Job Account
_API.JobAccount.Get(jobName)
Retrieves the shared job account for a given job.
Parameters:
jobName(string) – The name of the job whose account is being retrieved.
Returns:
JobAccount(table) – The job account object if found.nil– If no account is found.
Example Usage:
local account = _API.JobAccount.Get("mechanic") if account then print("Account found:", account) else print("No job account exists for mechanic.") end
Get Job Account Balance
_API.JobAccount.GetBalance(jobName)
Retrieves the balance of a shared job account.
Parameters:
jobName(string) – The name of the job whose balance is being retrieved.
Returns:
balance(number) – The current balance of the job account, or0if unavailable.
Example Usage:
Add Money to a Job Account
_API.JobAccount.AddMoney(jobName, amount)
Adds money to a shared job account.
Parameters:
jobName(string) – The name of the job whose account will receive money.amount(number) – The amount of money to add.
Example Usage:
Remove Money from a Job Account
_API.JobAccount.RemoveMoney(jobName, amount)
Removes money from a shared job account.
Parameters:
jobName(string) – The name of the job whose account will be debited.amount(number) – The amount of money to remove.
Example Usage:
Set a Job Account Balance
_API.JobAccount.SetMoney(jobName, amount)
Sets a specific balance for a shared job account.
Parameters:
jobName(string) – The name of the job whose account balance will be set.amount(number) – The new balance to be set for the job account.
Example Usage:
Create a New Job Account
_API.JobAccount.Create(jobName, startBalance)
Creates a new shared job account with a starting balance.
Parameters:
jobName(string) – The name of the job/society for which the account will be created.startBalance(number) – The initial balance of the newly created job account.
Returns:
true– If the account was created successfully.false– If the account could not be created.
Example Usage:
Last updated