Classes
Server
OxAccount

OxAccount

  • accountId number

OxAccountMetadata

  • id: number
  • balance: number
  • isDefault: number
  • label?: boolean
  • owner?: number
  • group?: string
  • type: personal | shared | group

OxAccount.get

Get the value of specific key(s) from the account's metadata.

account.get(key)

Parameters

  • key: string | string[]

Returns

  • OxAccountMetadata[key] | OxAccountMetadata[key][]
    • Returns an array if passing multiple keys.

OxAccount.addBalance

Add funds to the account.

account.addBalance({ amount, message })

Parameters

  • object
    • amount: number
    • message?: string

Returns

  • object
    • success: boolean
    • message: 'amount_not_number' | 'no_balance' | 'something_went_wrong'

OxAccount.removeBalance

Remove funds from the account.

account.removeBalance({ amount, message, overdraw })

Parameters

  • object
    • amount: number
    • message?: string
    • overdraw?: boolean

Returns

  • object
    • success: boolean
    • message: 'amount_not_number' | 'no_balance' | 'something_went_wrong'

OxAccount.transferBalance

Transfer funds to another account.

account.transferBalance({ toId, amount, overdraw, message, note, actorId })

Parameters

  • object
    • toId: number
      • The accountId to transfer funds to.
    • amount: number
    • message?: string
    • overdraw?: boolean
    • note?: string
    • actorId? number
      • The charId of the player initiating the transfer.

Returns

  • object
    • success: boolean
    • message: 'amount_not_number' | 'no_balance' | 'something_went_wrong'

OxAccount.depositMoney

Deposit money into the account.

account.transferBalance(playerId, amount, message, note)

Parameters

  • playerId: number
  • amount: number
  • message?: string
  • note?: string

Returns

  • object
    • success: boolean
    • message: 'amount_not_number' | 'insufficient_funds' | 'no_balance' | 'no_access' | 'something_went_wrong'

OxAccount.withdrawMoney

Withdraw money from the account.

account.transferBalance(playerId, amount, message, note)

Parameters

  • playerId: number
  • amount: number
  • message?: string
  • note?: string

Returns

  • object
    • success: boolean
    • message: 'amount_not_number' | 'no_charId' | 'insufficient_funds' | 'no_balance' | 'no_access' | 'something_went_wrong'

OxAccount.deleteAccount

Mark the account as deleted. It can no longer be accessed, but remains in the database.

account.deleteAccount()

Returns

  • object
    • success: boolean
    • message: 'something_went_wrong'

OxAccount.getCharacterRole

Get the account access role of a character by charId or stateId.

account.getCharacterRole(id)

Parameters

  • id: number | string

Returns

  • string

OxAccount.setCharacterRole

Set the account access role of a character by charId or stateId.

account.setCharacterRole(id, role)

Parameters

  • id: number | string
  • role?: string

Returns

  • object
    • success: boolean
    • message: 'something_went_wrong'

OxAccount.playerHasPermission

Checks if a player's active character has permission to perform an action on the account.

account.playerHasPermission(playerId, permission)

Parameters

  • playerId: number
  • permission: string

Returns

  • boolean

OxAccount.setShared

Set the account as shared, allowing permissions to be assigned to other characters.

account.setShared()

Returns

  • object
    • success: boolean
    • message: 'update_account_error'

OxAccount.createInvoice

Create an unpaid invoice on the account.

account.createInvoice(invoice)

Parameters

  • invoice: object
    • actorId?: number;
      • The charId of the player creating the invoice.
    • toAccount: number;
      • The accountId of the account receiving the invoice.
    • amount: number;
    • message: string;
    • dueDate: string;

Returns

  • object
    • success: boolean
    • message: 'no_charId' | 'no_permission' | 'no_target_account'