Skip to content

Commit

Permalink
update OxVehicle and minor tweaks to OxPlayer & OxAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Oct 9, 2024
1 parent 57832ab commit d663f00
Show file tree
Hide file tree
Showing 13 changed files with 210 additions and 115 deletions.
2 changes: 1 addition & 1 deletion pages/ox_core/Classes/Server/OxAccount.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ title: OxAccount

## OxAccount.get

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

```lua
account.get(key)
Expand Down
30 changes: 28 additions & 2 deletions pages/ox_core/Classes/Server/OxPlayer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ player.emit(eventName, ...args)

## OxPlayer.get

Returns a value from the players metadata.
Get the value of specific key from the player's metadata.

```lua
player.get(key)
Expand All @@ -119,6 +119,19 @@ player.get(key)
- `unknown`


## OxPlayer.getAccount

Returns the player's default account.

```lua
player.getAccount()
```

**Returns**

- `OxAccount`


## OxPlayer.getCoords

Returns the player's current coordinates.
Expand Down Expand Up @@ -218,6 +231,19 @@ player.getLicenses()
- `[key: string]: any`


## OxPlayer.getState

Returns the player's statebag interface.

```lua
player.getState()
```

**Returns**

- `StateBagInterface`


## OxPlayer.getStatus

Returns the value of the status.
Expand Down Expand Up @@ -346,7 +372,7 @@ player.save()

## OxPlayer.set

Stores a value in the players metadata, which can be optionally synced with the client.
Stores a value in the player's metadata, which can be optionally synced with the client.

```lua
player.set(key, value, replicated)
Expand Down
183 changes: 181 additions & 2 deletions pages/ox_core/Classes/Server/OxVehicle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: OxVehicle
---

# OxVehicle
## OxVehicle

- entity: `number`
- make: `string`
Expand All @@ -12,4 +12,183 @@ title: OxVehicle
- group?: `string`
- id?: `number`
- owner?: `number`
- vin?: `string`
- vin?: `string`

## OxVehicle.delete

Despawns the vehicle and removes it from the database.

```lua
vehicle.delete()
```


## OxVehicle.despawn

Despawns the vehicle, optionally saving it to the database.

```lua
vehicle.despawn(save)
```

**Parameters**

- save?: `boolean`


## OxVehicle.get

Get the value of specific key from the vehicless's metadata.

```lua
vehicle.get(key)
```

**Parameters**

- key: `string`

**Returns**

- `unknown`


## OxVehicle.getCoords

Returns the vehicle's current coordinates.

```lua
vehicle.getCoords(): Vector3
```


## OxVehicle.getState

Returns the vehicle's statebag interface.

```lua
vehicle.getState()
```

**Returns**

- `StateBagInterface`


## OxVehicle.getStored

Returns the vehicle's "stored" state.

```lua
vehicle.getStored()
```

**Returns**

- `string?`


## OxVehicle.respawn

Spawns a new entity for the vehicle, removing an existing entity if it exists and reapplying stored vehicle properties.

```lua
vehicle.respawn(coords, rotation)
```

**Parameters**

- coords?: `vector3`
- rotation?: `vector3`


## OxVehicle.save

Saves the vehicle to the database.

```lua
vehicle.save()
```

**Returns**

- `number`


### OxVehicle.set

Stores a value in the vehicle's metadata, which will be saved to the database (_this behaviour is likely to be removed_).

```lua
player.set(key, value)
```

**Parameters**

- key: `string`
- value: `any`


## OxVehicle.setGroup

Sets the vehicle as a group vehicle "owned" by the given group name, or removes the group if omitted.

```lua
vehicle.setGroup(groupName)
```

**Parameters**

- groupName?: `string`


## OxVehicle.setOwner

Sets the owner of a vehicle as the given charId, or removes the owner if omitted.

```lua
vehicle.setOwner(charId)
```

**Parameters**

- charId?: `number`


## OxVehicle.setPlate

Sets the registered plate of a vehicle to the given value. The plate will be padded or stripped to 8 characters.

This plate is not necessarily the displayed plate on vehicle properties.

```lua
vehicle.setPlate(plate: string)
```


## OxVehicle.setProperties

Saves the properties (mods, extras, etc.) stored on the vehicle, optionally applying them to the entity.

```lua
vehicle.setProperties(properties, apply)
```

**Parameters**

- properties: `VehicleProperties`
- apply?: `boolean`


## OxVehicle.setStored

Sets the vehicle as "stored" at the given value (e.g. impound, garage, null), and optionally despawns the vehicle.

```lua
vehicle.setStored(value, despawn)
```

**Parameters**

- value?: `string`
- despawn?: `boolean`
11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/delete.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/despawn.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/get.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/getCoords.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/save.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/set.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/setGroup.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/setOwner.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/setPlate.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions pages/ox_core/Classes/Server/OxVehicle/setStored.mdx

This file was deleted.

0 comments on commit d663f00

Please sign in to comment.