Billing
Server exports to send a bill on behalf of an employee and to read a player's unpaid bills.
sendBill
⏳ Needs a thread see Calling from a thread.
Bills a player on behalf of an employee. The sender's job must have billing enabled and their grade must clear its minimum; the share split and society routing come from that job's billing settings.
local ok, billId = exports['hex_jobscreator']:sendBill(5, 12, 500, 'Towing')Prop
Type
No distance check
Unlike the in-game action, this does not require the two players to be near each other, so it can be used for automated or remote billing.
Returns
| Value | Meaning |
|---|---|
true, billId | bill created; the second value is its database id |
false, reason | see the reasons below |
Reasons
| Code | Meaning |
|---|---|
invalid_player | player id must be a number |
same_player | source and target must differ |
player_not_found | no such sender on the server |
target_not_found | no such target player on the server |
no_billing_access | billing is off for the sender's jobs, or their grade is too low |
invalid_amount | amount must be a positive whole number within the configured cap |
insert_failed | the database insert failed |
getPlayerBills
⏳ Needs a thread see Calling from a thread.
Every unpaid bill addressed to a player.
local bills, err = exports['hex_jobscreator']:getPlayerBills(5)Prop
Type
Returns
| Value | Meaning |
|---|---|
| table | the unpaid bills, shape below |
table, 'no_bills' | the player has no unpaid bills |
nil, reason | invalid_player · player_not_found |
{
{ id = 8, label = 'Towing', amount = 500, jobLabel = 'Mechanic', senderName = 'John Doe', createdAt = '...' },
...
}