- Documentation
- Shared functions
- getVehicleEngine
Function
getVehicleEngine
Returns the vehicle's engine: the one fitted with setVehicleEngine or, when none was fitted, the factory engine calculated from game data (with factory = true). The second value is wear 0..1. Works on both sides.
Syntax
table, float getVehicleEngine(vehicle vehicle)Arguments
vehiclevehicle- The vehicle.
Returns
The engine table (fields as in setVehicleEngine) and wear.
Example
addCommandHandler("silnikinfo", function(player)
local vehicle = getPedOccupiedVehicle(player)
if not vehicle then return end
local engine, wear = getVehicleEngine(vehicle)
outputChatBox(("%s kW, %s Nm, zuzycie %d%%"):format(engine.power, engine.torque, wear * 100), player)
end)
See also
setVehicleEngineFits a vehicle with an engine described by real-car parameters (power, torque, displacement, fuel, mass, gears) and calculates the handling fields from them: mass, top speed, acceleration, engine inertia, fuel type, number of gears and grip. An engine much stronger than the factory one reduces grip (wheelspin). Wear lowers power by up to 30%.nilrestores the factory engine. Good for tuning and engine-swap systems on RP servers.getVehicleFactoryEngineReturns a model's factory engine. Power is calculated from the game's handling, and the other data (torque, displacement, cylinders, mass) are a realistic estimate, marked withestimated = true. It gives a reference point for tuning systems.