Funções
Server

Ox.CreateAccount

Creates a new account for a character with the given charId or stateId.

Ox.CreateAccount(ownerId, label)

Parameters

  • ownerId: number | string
  • label: string

Returns

  • OxAccount

Ox.CreateGroup

Creates a new group from the given data, handling all database interactions internally.

Ox.CreateGroup(data)

Parameters

  • data: object
    • name: string
    • label: string
    • grades: object[]
      • label: string
      • accountRole?: string
    • type?: string
    • colour?: number
    • hasAccount?: boolean

Ox.CreateVehicle

Creates a new vehicle, which will be saved to the database if it has an assigned owner or group.

Ox.CreateVehicle(data, coords, heading)

Parameters

  • data: string | object
    • model: string
    • owner?: number
    • group?: string
    • stored?: string
    • properties?: object
  • coords?: vector3
  • heading?: number

Returns

  • OxVehicle

Ox.DeleteAccountInvoice

Deletes the account invoice with the given invoiceId.

Ox.DeleteAccountInvoice(invoiceId)

Parameters

  • invoiceId: number

Returns

  • object
    • success: boolean
    • message?: string

Ox.DeleteGroup

Deletes all data associated with the given group name, such as group grades, vehicles, etc.

Ox.DeleteGroup(groupName)

Parameters

  • groupName: string

Ox.GenerateVehiclePlate

Generate a unique vehicle plate that doesn't exist in database.

Ox.GenerateVehiclePlate()

Returns

  • string

Ox.GenerateVehicleVin

Generate a unique vehicle identification number that doesn't exist in database.

Ox.GenerateVehicleVin(modelName)

Parameters

  • modelName: string
    • Vehicle information (i.e. model and make) are used as part of the VIN.

Returns

  • string

Ox.GetAccount

Get the OxAccount with the given accountId.

Ox.GetAccount(accountId)

Parameters

  • accountId: number

Returns

  • OxAccount

Ox.GetCharacterAccount

Get the default OxAccount for a character by their charId or stateId.

Ox.GetCharacterAccount(id)

Parameters

  • id: number | string

Returns

  • OxAccount

Ox.GetCharIdFromStateId

Get a character's charId from their stateId.
Note: This queries the database and shouldn't be used excessively

Ox.GetCharIdFromStateId(stateId)

Parameters

  • stateId: string

Returns

  • number

Ox.GetGroupAccount

Get the OxAccount for a group.

Ox.GetGroupAccount(groupName)

Parameters

  • groupName: string

Returns

  • OxAccount

Ox.GetGroupsByType

Returns an array of group names which have the given group type.

Ox.GetGroupsByType(groupType)

Parameters

  • groupType: string

Returns

  • string[]

Ox.GetPlayer

Get an OxPlayer from its enity id.

Ox.GetPlayer(entityId)

Parameters

  • userId: number

Returns

  • OxPlayer

Ox.GetPlayerFromFilter

Get the first OxPlayer matching a filter.

Ox.GetPlayerFromFilter(filter)

Parameters

  • filter?: { [string]: any }
    • Compare player fields and metadata against the given key-value pairs.
    • Groups can be given as a string or array of strings to match.

Returns

  • OxPlayer

Ox.GetPlayerFromUserId

Get an OxPlayer from its user id.

Ox.GetPlayerFromUserId(userId)

Parameters

  • userId: number

Returns

  • OxPlayer

Ox.GetPlayers

Get an array of containing OxPlayer for all players matching a filter, if given.

Ox.GetPlayers(filter)

Parameters

  • filter?: { [string]: any }
    • Compare player fields and metadata against the given key-value pairs.
    • Groups can be given as a string or array of strings to match.

Returns

  • OxPlayer[]

Ox.GetVehicle

Get an OxVehicle from its entity id.

Ox.GetVehicle(entityId)

Parameters

  • entityId: number

Returns

  • OxVehicle

Ox.GetVehicleFromNetId

Get an OxVehicle from its network id.

Ox.GetVehicleFromNetId(netId)

Parameters

  • netId: number

Returns

  • OxVehicle

Ox.GetVehicleFromVin

Get an OxVehicle from its VIN.

Ox.GetVehicleFromVin(vin)

Parameters

  • vin: string

Returns

  • OxVehicle

Ox.RemoveGroupPermission

Removes a permission from a specified group and minimum grade.

Ox.RemoveGroupPermission(groupName, grade, permission)

Parameters

  • groupName: string
  • grade: number
  • permission: string

Ox.SaveAllPlayers

Save all players to the database.

Ox.SaveAllPlayers()

Ox.SaveAllVehicles

Save all vehicles to the database.

Ox.SaveAllVehicles()

Ox.SetGroupPermission

Assigns a permission to a specified group and minimum grade, which will be inherited by higher grades.

Ox.SetGroupPermission(groupName, grade, permission, value)

Parameters

  • groupName: string
  • grade: number
  • permission: string
  • value: allow | deny

Ox.SpawnVehicle

Spawns an OxVehicle with the given dbId, if it hasn't already been spawned.

Ox.SpawnVehicle(dbId, coords, heading)

Parameters

  • dbId: number
  • coords: vector3
  • heading?: number

Returns

  • OxVehicle