Skip to content
On this page

Athena.getters.vehicle

Functions

byDatabaseID

Usage

Athena.getters.vehicle.byDatabaseID(id): alt.Vehicle | undefined

Get a vehicle based on their database _id May return undefined if the vehicle is not currently spawned.

Parameters

NameType
idstring

Returns

alt.Vehicle | undefined

Defined in

server/getters/vehicle.ts:55


byID

Usage

Athena.getters.vehicle.byID(id): alt.Vehicle | undefined

Get a vehicle by their alt:V ID

Parameters

NameType
idnumber

Returns

alt.Vehicle | undefined

Defined in

server/getters/vehicle.ts:11


byIncrementalDatabaseID

Usage

Athena.getters.vehicle.byIncrementalDatabaseID(id): alt.Vehicle | undefined

Return a spawned vehicle by is incremental data id.

This only works for persistent vehicles.

Parameters

NameType
idstring | number

Returns

alt.Vehicle | undefined

Defined in

server/getters/vehicle.ts:24


closestToPlayer

Usage

Athena.getters.vehicle.closestToPlayer(player): alt.Player | undefined

The player closest to a player.

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity

Returns

alt.Player | undefined

Defined in

server/getters/vehicle.ts:181


closestToVehicle

Usage

Athena.getters.vehicle.closestToVehicle(player): alt.Vehicle | undefined

The vehicle closest to a player.

Parameters

NameType
playerPlayer

Returns

alt.Vehicle | undefined

Defined in

server/getters/vehicle.ts:191


driver

Usage

Athena.getters.vehicle.driver(vehicle): alt.Player | undefined

Just wraps the vehicle.driver lookup. Returns a player if they are driving this vehicle.

Parameters

NameTypeDescription
vehicleVehicleAn alt:V Vehicle Entity

Returns

alt.Player | undefined

Defined in

server/getters/vehicle.ts:171


inFrontOf

Usage

Athena.getters.vehicle.inFrontOf(entity, startDistance?): Promise<alt.Vehicle | undefined>

Creates a temporary ColShape in front of the current vehicle or player. The ColShape is then used to check if a vehicle is present within the ColShape. It will keep subtract distance until it finds a vehicle near the player that is in the ColShape. Works best on flat land or very close distances.

Parameters

NameTypeDefault value
entityEntityundefined
startDistance?number6

Returns

Promise<alt.Vehicle | undefined>

Defined in

server/getters/vehicle.ts:99


isNearPosition

Usage

Athena.getters.vehicle.isNearPosition(vehicle, pos, dist?): boolean

Checks if a vehicle is within 3 distance of a position.

Parameters

NameTypeDefault valueDescription
vehicleVehicleundefinedAn alt:V Vehicle Entity
posIVector3undefinedA position in the world.
distnumber3-

Returns

boolean

Defined in

server/getters/vehicle.ts:150


isValidModel

Usage

Athena.getters.vehicle.isValidModel(model): boolean

Check if a vehicle model is currently valid. Use alt.hash to hash a plain text model. ex: alt.hash('infernus')

Parameters

NameType
modelnumber

Returns

boolean

Defined in

server/getters/vehicle.ts:78


passengers

Usage

Athena.getters.vehicle.passengers(vehicle): alt.Player[]

Returns all passengers and the driver. No specific order.

Parameters

NameTypeDescription
vehicleVehicleAn alt:V Vehicle Entity

Returns

alt.Player[]

Defined in

server/getters/vehicle.ts:160

Created by Stuyk | Est. 2020