ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getVehicleEngine

Function

getVehicleEngine

Server and clientVehiclesTrilogy Hub only

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