Skip to content

Commit

Permalink
refactor(ox_core/classes/client): Reformatted to match rest of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
simsonas86 committed Oct 9, 2024
1 parent 29b6022 commit 7852e47
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 336 deletions.
167 changes: 166 additions & 1 deletion pages/ox_core/Classes/Client/OxPlayer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,174 @@
title: OxPlayer
---

# OxPlayer
## OxPlayer

- state: `StateBagInterface`
- userId: `number`
- charId?: `number`
- stateId?: `string`

## OxPlayer.addStatus

Increases value of a status.

```lua
player.addStatus(statusName, value)
```

**Parameters**
- statusName: `string`
- value: `number`

**Returns**
- success: `boolean`

## OxPlayer.get

Returns a value from the players metadata.

```lua
player.get(key)
```

**Parameters**
- key: `string`

**Returns**
- `unknown`

**Example**
```lua
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.

```lua
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.

```lua
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.

```lua
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.

```lua
player.getGroups()
```

**Returns**
- `{ [string]: number }`

## OxPlayer.getStatus

Returns the value of the status.

```lua
player.getStatus(statusName)
```

**Parameters**
- statusName: `string`

**Returns**
- `number`

## OxPlayer.getStatuses

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

```lua
player.getStatuses()
```

**Returns**
- `{ [string]: number }`

## OxPlayer.hasPermission

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

```lua
player.hasPermission(permission)
```

**Parameters**
- permission: `string`

**Returns**
- `boolean`

## OxPlayer.removeStatus

Reduces the value of a status.

```lua
player.removeStatus(statusName, value)
```

**Parameters**
- statusName: `string`
- value: `number`

**Returns**
- `boolean`

## OxPlayer.on

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

```lua
player.on(key, cb(data))
```

**Parameters**
- key: `string`
- cb: `function`

**Returns**
- data: `unknown`
- new value of `key`
14 changes: 0 additions & 14 deletions pages/ox_core/Classes/Client/OxPlayer/_meta.json

This file was deleted.

25 changes: 0 additions & 25 deletions pages/ox_core/Classes/Client/OxPlayer/addStatus.mdx

This file was deleted.

37 changes: 0 additions & 37 deletions pages/ox_core/Classes/Client/OxPlayer/get.mdx

This file was deleted.

22 changes: 0 additions & 22 deletions pages/ox_core/Classes/Client/OxPlayer/getCoords.mdx

This file was deleted.

42 changes: 0 additions & 42 deletions pages/ox_core/Classes/Client/OxPlayer/getGroup.mdx

This file was deleted.

26 changes: 0 additions & 26 deletions pages/ox_core/Classes/Client/OxPlayer/getGroupByType.mdx

This file was deleted.

24 changes: 0 additions & 24 deletions pages/ox_core/Classes/Client/OxPlayer/getGroups.mdx

This file was deleted.

Loading

0 comments on commit 7852e47

Please sign in to comment.