Classes
Client
OxPlayer

OxPlayer

  • state: StateBagInterface
  • userId: number
  • charId?: number
  • stateId?: string

OxPlayer.addStatus

Increases value of a status.

player.addStatus(statusName, value)

Parameters

  • statusName: string
  • value: number

Returns

  • success: boolean

OxPlayer.get

Returns a value from the players metadata.

player.get(key)

Parameters

  • key: string

Returns

  • unknown

Example

local player = Ox.GetPlayer()
 
print(player.get('name'))         -- output: "firstName lastName"
print(player.get('firstName'))    -- output: "firstName"
print(player.get('lastName'))     -- output: "lastName"
print(player.get('gender'))       -- output: "gender"
print(player.get('dateOfBirth'))  -- output: "DD/MM/YYYY"
print(player.get('phoneNumber'))  -- output: "000-000-0000"
print(player.get('activeGroup'))  -- output: "activeGroup"
 
print(player.get('customKey'))    -- output: customValue

OxPlayer.getCoords

Returns the player's current coordinates.

player.getCoords()

Parameters

  • vector3

OxPlayer.getGroup

Returns the player's grade of a given group name, or the first matched name and grade in a filter.

player.getGroup(filter)

Parameters

  • filter: string|string[]|{ [string]: number }

Returns

  • unknown

OxPlayer.getGroupByType

Returns the player's name and grade of a group with a matching type.

player.getGroupByType(type)

Parameters

  • type: string

Returns

  • string
  • number

OxPlayer.getGroups

Returns an object of all groups the player is currently in, using the group name as a key.

player.getGroups()

Returns

  • { [string]: number }

OxPlayer.getStatus

Returns the value of the status.

player.getStatus(statusName)

Parameters

  • statusName: string

Returns

  • number

OxPlayer.getStatuses

Returns an object containing all statuses, using the status name as the key.

player.getStatuses()

Returns

  • { [string]: number }

OxPlayer.hasPermission

Checks if a user has been granted a permission by one of their groups.

player.hasPermission(permission)

Parameters

  • permission: string

Returns

  • boolean

OxPlayer.removeStatus

Reduces the value of a status.

player.removeStatus(statusName, value)

Parameters

  • statusName: string
  • value: number

Returns

  • boolean

OxPlayer.on

Listens for changes to the players metadata, specified by a key.

player.on(key, cb(data))

Parameters

  • key: string
  • cb: function

Returns

  • data: unknown
    • new value of key