Skip to content
On this page

Athena.document.vehicle

Type Aliases

KeyChangeCallback

Ƭ KeyChangeCallback: (vehicle: alt.Vehicle, newValue: any, oldValue: any) => void

Type declaration

Usage

Athena.document.vehicle.(vehicle, newValue, oldValue): void

Parameters
NameType
vehiclealt.Vehicle
newValueany
oldValueany
Returns

void

Defined in

server/document/vehicle.ts:8

Functions

bind

Usage

Athena.document.vehicle.bind(vehicle, document): any

Used to bind a vehicle document to a vehicle entity

Parameters

NameTypeDescription
vehicleVehicleAn alt:V Vehicle Entity
documentOwnedVehicle

Returns

any

Defined in

server/document/vehicle.ts:41


exists

Usage

Athena.document.vehicle.exists(_id): boolean

Check if a vehicle document already exists and a vehicle is attached to it.

Parameters

NameType
_idstring

Returns

boolean

Defined in

server/document/vehicle.ts:235


get

Usage

Athena.document.vehicle.get<T>(vehicle): T | undefined

Get a vehicle document attached to a vehicle

Type parameters

NameType
TOwnedVehicle

Parameters

NameTypeDescription
vehicleVehicleAn alt:V Vehicle Entity

Returns

T | undefined

Defined in

server/document/vehicle.ts:60


getAllOnline

Usage

Athena.document.vehicle.getAllOnline<T>(): { document: player & T ; id: number }[]

Return all available vehicles, and their associated alt:V vehicle ids.

The vehicle can be fetched with alt.Vehicle.all.find(x => x.id === someResult.id);

Export

Type parameters

NameType
T{}

Returns

{ document: player & T ; id: number }[]

Defined in

server/document/vehicle.ts:214


getField

Usage

Athena.document.vehicle.getField<T, ReturnType>(vehicle, fieldName): ReturnType | undefined

Get a field directly for a vehicle document

Type parameters

NameType
T{}
ReturnTypeany

Parameters

NameTypeDescription
vehicleVehicleAn alt:V Vehicle Entity
fieldNamestring | number | symbol

Returns

ReturnType | undefined

Defined in

server/document/vehicle.ts:77


onChange

Usage

Athena.document.vehicle.onChange<T>(fieldName, callback): any

Listen for individual vehicle document changes.

Type parameters

NameType
T{}

Parameters

NameType
fieldNamestring | number | symbol
callbackKeyChangeCallback

Returns

any

Defined in

server/document/vehicle.ts:191


override

Usage

Athena.document.vehicle.override(functionName, callback): any

Used to override any vehicle document functionality

Parameters

NameType
functionName"exists"
callback(_id: string) => boolean

Returns

any

Defined in

server/document/vehicle.ts:261

Usage

Athena.document.vehicle.override(functionName, callback): any

Used to override any vehicle document functionality

Parameters

NameType
functionName"bind"
callback(vehicle: Vehicle, document: OwnedVehicle) => any

Returns

any

Defined in

server/document/vehicle.ts:262

Usage

Athena.document.vehicle.override(functionName, callback): any

Used to override any vehicle document functionality

Parameters

NameType
functionName"unbind"
callback(id: number) => any

Returns

any

Defined in

server/document/vehicle.ts:263

Usage

Athena.document.vehicle.override(functionName, callback): any

Used to override any vehicle document functionality

Parameters

NameType
functionName"get"
callback<T>(vehicle: Vehicle) => T | undefined

Returns

any

Defined in

server/document/vehicle.ts:264

Usage

Athena.document.vehicle.override(functionName, callback): any

Used to override any vehicle document functionality

Parameters

NameType
functionName"getField"
callback<T, ReturnType>(vehicle: Vehicle, fieldName: string | number | symbol) => ReturnType | undefined

Returns

any

Defined in

server/document/vehicle.ts:265

Usage

Athena.document.vehicle.override(functionName, callback): any

Used to override any vehicle document functionality

Parameters

NameType
functionName"set"
callback<T, Keys>(vehicle: Vehicle, fieldName: Keys, value: any, skipCallbacks?: boolean) => any

Returns

any

Defined in

server/document/vehicle.ts:266

Usage

Athena.document.vehicle.override(functionName, callback): any

Used to override any vehicle document functionality

Parameters

NameType
functionName"setBulk"
callback<T, Keys>(vehicle: Vehicle, fields: Keys) => any

Returns

any

Defined in

server/document/vehicle.ts:267

Usage

Athena.document.vehicle.override(functionName, callback): any

Used to override any vehicle document functionality

Parameters

NameType
functionName"onChange"
callback<T>(fieldName: string | number | symbol, callback: KeyChangeCallback) => any

Returns

any

Defined in

server/document/vehicle.ts:268


set

Usage

Athena.document.vehicle.set<T, Keys>(vehicle, fieldName, value, skipCallbacks?): any

Set vehicle data for a given field, automatically saves to database.

Type parameters

NameType
T{}
Keysstring | number | symbol

Parameters

NameTypeDefault valueDescription
vehicleVehicleundefinedAn alt:V Vehicle Entity
fieldNameKeysundefined
valueanyundefined
skipCallbacks?booleanfalse

Returns

any

Defined in

server/document/vehicle.ts:103


setBulk

Usage

Athena.document.vehicle.setBulk<T, Keys>(vehicle, fields): any

Set bulk data for a vehicle document. Automatically saves to database.

Type parameters

NameType
T{}
KeysPartial<any>

Parameters

NameTypeDescription
vehicleVehicleAn alt:V Vehicle Entity
fieldsKeys

Returns

any

Defined in

server/document/vehicle.ts:152


unbind

Usage

Athena.document.vehicle.unbind(id): any

Used to unbind vehicle cache for an id once the vehicle is deleted

Parameters

NameType
idnumber

Returns

any

Defined in

server/document/vehicle.ts:27

Created by Stuyk | Est. 2020