HEX
HexscriptsJobscreatorExportsServer Exports

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

ValueMeaning
true, billIdbill created; the second value is its database id
false, reasonsee the reasons below

Reasons

CodeMeaning
invalid_playerplayer id must be a number
same_playersource and target must differ
player_not_foundno such sender on the server
target_not_foundno such target player on the server
no_billing_accessbilling is off for the sender's jobs, or their grade is too low
invalid_amountamount must be a positive whole number within the configured cap
insert_failedthe 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

ValueMeaning
tablethe unpaid bills, shape below
table, 'no_bills'the player has no unpaid bills
nil, reasoninvalid_player · player_not_found
{
    { id = 8, label = 'Towing', amount = 500, jobLabel = 'Mechanic', senderName = 'John Doe', createdAt = '...' },
    ...
}