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 ​
Name | Type |
---|---|
vehicle | alt.Vehicle |
newValue | any |
oldValue | any |
Returns ​
void
Defined in ​
Functions ​
bind ​
Usage
Athena.document.vehicle.bind(vehicle
, document
): any
Used to bind a vehicle document to a vehicle entity
Parameters ​
Name | Type | Description |
---|---|---|
vehicle | Vehicle | An alt:V Vehicle Entity |
document | OwnedVehicle |
Returns ​
any
Defined in ​
exists ​
Usage
Athena.document.vehicle.exists(_id
): boolean
Check if a vehicle document already exists and a vehicle is attached to it.
Parameters ​
Name | Type |
---|---|
_id | string |
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 ​
Name | Type |
---|---|
T | OwnedVehicle |
Parameters ​
Name | Type | Description |
---|---|---|
vehicle | Vehicle | An alt:V Vehicle Entity |
Returns ​
T
| undefined
Defined in ​
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
T | {} |
ReturnType | any |
Parameters ​
Name | Type | Description |
---|---|---|
vehicle | Vehicle | An alt:V Vehicle Entity |
fieldName | string | number | symbol |
Returns ​
ReturnType
| undefined
Defined in ​
onChange ​
Usage
Athena.document.vehicle.onChange<T
>(fieldName
, callback
): any
Listen for individual vehicle document changes.
Type parameters ​
Name | Type |
---|---|
T | {} |
Parameters ​
Name | Type |
---|---|
fieldName | string | number | symbol |
callback | KeyChangeCallback |
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
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 ​
Name | Type |
---|---|
T | {} |
Keys | string | number | symbol |
Parameters ​
Name | Type | Default value | Description |
---|---|---|---|
vehicle | Vehicle | undefined | An alt:V Vehicle Entity |
fieldName | Keys | undefined | |
value | any | undefined | |
skipCallbacks? | boolean | false |
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 ​
Name | Type |
---|---|
T | {} |
Keys | Partial <any > |
Parameters ​
Name | Type | Description |
---|---|---|
vehicle | Vehicle | An alt:V Vehicle Entity |
fields | Keys |
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 ​
Name | Type |
---|---|
id | number |
Returns ​
any