Vehicle

This page describes the vehicle API

Get vehicles

vehicleList()

Retrieves all online vehicle IDs.

Remarks

Arguments

Type

Description

Returns

Vehicle IDs collection.

Spawn

vehicleSpawn(string, vec3, float)

Spawns the vehicle at a specified position and heading direction.

Remarks

You can use the following listing for vehicle model names.

Arguments

Type

Description

string

Model name

vec3

Position

float

Heading direction

Returns

Vehicle ID if spawned, -1 if failed.

Despawn

vehicleDespawn(vehicle)

Despawns a vehicle

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

Returns

0 if successful, -1 if failed.

Invalid

vehicleInvalid(vehicle)

Checkes whether the vehicle ID is invalid.

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

Returns

1 if invalid, 0 if valid otherwise.

Repair

vehicleRepair(vehicle)

Repairs the vehicle.

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

Returns

0 if successful, -1 if failed.

Set position

vehiclePositionSet(vehicle, vec3)

Sets the vehicle position.

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

vec3

Vehicle Position

Returns

0 if successful, -1 if failed.

Set direction

vehicleDirectionSet(vehicle, vec3)

Sets the vehicle forward direction vector.

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

vec3

Vehicle Direction

Returns

0 if successful, -1 if failed.

Set heading

vehicleHeadingSet(vehicle, float)

Sets the vehicle heading angle.

Remarks

Uses a ±180 degree format.

Arguments

Type

Description

vehicle

Vehicle ID

float

±180 degree angle

Returns

0 if successful, -1 if failed

Set fuel

vehicleFuelSet(vehicle, float)

Set vehicle fuel level

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

float

Fuel level

Returns

0 if successful, -1 if failed

Set transparency

vehicleTransparencySet(vehicle, float)

Set vehicle transparency value

Remarks

0-1 range.

Arguments

Type

Description

vehicle

Vehicle ID

float

transparency value

Returns

0 if successful, -1 if failed

Set lock

vehicleLockSet(vehicle, int)

Locks/Unlocks the vehicle

Remarks

0 for unlock, 1 for lock.

Arguments

Type

Description

vehicle

Vehicle ID

int

Lock State

Returns

0 if successful, -1 if failed

Get position

vehiclePositionGet(vehicle)

Gets the vehicle position.

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

Returns

Returns vehicle position

Get direction

vehicleDirectionGet(vehicle)

Gets the vehicle direction.

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

Returns

Returns vehicle direction

Get heading

vehicleHeadingGet(vehicle)

Retrieves the vehicle's heading angle.

Remarks

Uses a ±180 degree format.

Arguments

Type

Description

vehicle

Vehicle ID

Returns

float heading angle

Get fuel

vehicleFuelGet(vehicle)

Retrieves the vehicle's fuel level.

Remarks

Arguments

Type

Description

vehicle

Vehicle ID

Returns

float fuel level

Get transparency

vehicleTransparencyGet(vehicle)

Retrieves the vehicle's transparency value.

Remarks

0-1 range.

Arguments

Type

Description

vehicle

Vehicle ID

Returns

float transparency value

Get lock

vehicleLockGet(vehicle)

Retrieves the vehicle's lock state.

Remarks

0 for unlocked, 1 for locked.

Arguments

Type

Description

vehicle

Vehicle ID

Returns

int lock state

Visibility

There are several visibility options you can set for the vehicle:

Name

Description

VISIBILITY_ICON

Vehicle's blip visibility on the map

VISIBILITY_RADAR

Vehicle's marker visibility on the radar

VISIBILITY_COLLISION

Vehicle's collision state

VISIBILITY_MODEL

Vehicle's transparency state

Get visibility

vehicleVisibilityGet(vehicle, visibility_type)

Retrieves the current vehicle's visibility.

Remarks

None.

Arguments

Type

Description

vehicle

Vehicle ID

visibility_type

Visibility option

Returns

int vehicle visibility option value

Set visibility

vehicleVisibilitySet(vehicle, visibility_type, int)

Sets the current vehicle's visibility setting.

Remarks

None.

Arguments

Type

Description

vehicle

Vehicle ID

visibility_type

Visibility option

int

Visibility state

Returns

0 if successful

Last updated