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

Function

getVehiclePerformance

Server and clientVehiclesTrilogy Hub only

Returns a vehicle's performance in a player-friendly form: power in kW and HP, torque, mass, 0-100 km/h time and top speed. You can pass a vehicle (its engine and wear are used) or a model number, optionally with an engine to compare.

Syntax

table getVehiclePerformance(vehicle/int vehicleOrModel [, table spec = nil, float wear = 0])

Arguments

vehicleOrModelvehicle/int
A vehicle or a model ID.
spectable, optional = nil
An engine to calculate instead of the current one (as in setVehicleEngine).
wearfloat, optional = 0
Wear 0..1 (for a vehicle without spec: its own).

Returns

powerKW, powerHP, torque, mass, accel100 (s), topSpeed (km/h), engine; false for an unknown model.

Example

addCommandHandler("osiagi", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if not vehicle then return end
    local p = getVehiclePerformance(vehicle)
    outputChatBox(("%d KM, 0-100 w %.1f s, Vmax %d km/h"):format(p.powerHP, p.accel100, p.topSpeed), player)
end)

See also