Skip to content

YaVehicleAPI

YaVehicleAPI manges vehicles, drivers, and trigger events in the game

Functions

void YaVehicleAPI.SetHandBrake(YaEntity vehicleEntity, boolean isHandBrake)

SERVER ONLY 
Sets the handbrake state of a vehicle. Disabled by default. When the handbrake is on, the vehicle's speed gradually decreases to zero
  • vehicleEntity The target vehicle entity
  • isHandBrake Whether the handbrake is enabled

void YaVehicleAPI.SetAcceleration(YaEntity vehicleEntity, boolean isAcceleration)

SERVER ONLY 
Sets the acceleration state of a vehicle. Disabled by default. When acceleration is on, the vehicle's speed increases
  • vehicleEntity The target vehicle entity
  • isAcceleration Whether speed acceleration is enabled

void YaVehicleAPI.SetEnable(YaEntity vehicleEntity, boolean enable)

SERVER ONLY 
Sets whether a vehicle receives player inputs. Disabled by default. When enabled, the vehicle receives player inputs.
  • vehicleEntity The target vehicle entity
  • enable Whether to enable receiving player inputs

boolean YaVehicleAPI.GetEnable(YaEntity vehicleEntity)

SERVER ONLY 
Returnstrue if player inputs are enabled for a vehicle, or false if not
Gets whether a vehicle receives player inputs
  • vehicleEntity The target vehicle entity

YaEntity YaVehicleAPI.GetDriverByVehicle(YaEntity vehicleEntity)

SERVER ONLY 
Returnsthe entity that controls the vehicle
Gets the driver of a vehicle
  • vehicleEntity The target vehicle entity

YaEntity YaVehicleAPI.GetVehicleByDriver(YaEntity driverEntity)

SERVER ONLY 
Returnsthe vehicle entity that the driver entity controls
Gets the vehicle driven by the driver entity.
  • driverEntity The target driver entity

void YaVehicleAPI.SetDriver(YaEntity vehicle, YaEntity driver, float3 position)

SERVER ONLY 
Sets a vehicle's driver and their position to the vehicle
  • vehicle The target vehicle entity
  • driver The target driver entity that controls the vehicle
  • position The offset of the driver in the vehicle's local transform

void YaVehicleAPI.ReleaseDriving(YaEntity vehicle)

SERVER ONLY 
Releases a driver from a vehicle
  • vehicle The target vehicle entity that the driver controls

void YaVehicleAPI.OnSetDriver(YaEntity vehicleEntity, function callback<YaEntity>)

SERVER ONLY 
Fired when a driver is assigned to the vehicle entity
  • vehicleEntity The vehicle entity
  • callback The callback function to be called when the driver is assigned
    1. entity The driver entity that controls the vehicle

void YaVehicleAPI.OnReleaseDriver(YaEntity vehicleEntity, function callback<YaEntity>)

SERVER ONLY 
Fired when a driver is released from a vehicle entity
  • vehicleEntity The vehicle entity
  • callback The callback function to be called when the driver is released
    1. entity The driver entity

boolean YaVehicleAPI.IsVehicleInAir(YaEntity vehicleEntity)

SERVER ONLY 
Returnstrue if the vehicle is in the air, or false if not
Checks if a vehicle is in the air
  • vehicleEntity The vehicle entity