YaVehicleAPI¶
YaVehicleAPI manges vehicles, drivers, and trigger events in the gameFunctions¶
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
vehicleEntityThe target vehicle entityisHandBrakeWhether 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
vehicleEntityThe target vehicle entityisAccelerationWhether 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.
vehicleEntityThe target vehicle entityenableWhether 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
vehicleEntityThe target vehicle entity
YaEntity YaVehicleAPI.GetDriverByVehicle(YaEntity vehicleEntity)¶
SERVER ONLY 
Returnsthe entity that controls the vehicle
Gets the driver of a vehicle
vehicleEntityThe 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.
driverEntityThe 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
vehicleThe target vehicle entitydriverThe target driver entity that controls the vehiclepositionThe offset of the driver in the vehicle's local transform
void YaVehicleAPI.ReleaseDriving(YaEntity vehicle)¶
SERVER ONLY 
Releases a driver from a vehicle
vehicleThe 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
vehicleEntityThe vehicle entitycallbackThe callback function to be called when the driver is assignedentityThe 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
vehicleEntityThe vehicle entitycallbackThe callback function to be called when the driver is releasedentityThe 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
vehicleEntityThe vehicle entity