CreatorsServer exports
AddMoneyOffline
Last updated on
Gives money to a character by citizen id, online or not.
local res = exports.opx_infinity:AddMoneyOffline(citizenId, moneyType, amount, reason)Scope write · must be awaited — a synchronous call answers export.mustAwait before touching anything.
Parameters
-
citizenId:
string -
moneyType:
string -
amount:
integer -
reason?:
string -
Money types are the server's
MONEY.TYPES(EDDIES,BANKshipped). -
amountis a whole number from 1 to 9 999 999 999. -
reasonis optional text, cut to 64 characters, stored asext:<your resource>:<reason>. -
Runs the same hooks as any other change and raises
opx:on:character:money. -
The event comes with
offline = trueand noplayerId.
Returns
{ balance, offline }—offline = falsewhen the character turned out to be online
Errors
money.badType,money.badAmount,money.vetoed,character.notFound,export.badArgumenterror.unavailablewhile the row is being written
CreateThread(function()
local pending, why = Open77.exports.call('opx_infinity', 'AddMoneyOffline', citizenId, 'BANK', 1200, 'salary')
if not pending then return print('not sent: ' .. tostring(why)) end
local res = pending:await()
if not (res and res.ok) then return print('refused: ' .. tostring(res and res.error)) end
print(res.value.balance, res.value.offline)
end)