Skip to content

Exports

Note


These exports are optional and available for use in your scripts or integrations.

Client

Get Custom Vehicle Class

Returns the custom racing style vehicle class of a vehicle.

Parameters
lua
--- @param vehicle number Vehicle entity.
--- @return table # { class = string, rating = number }

-- Class ranges:
-- D  (0 - 299)
-- C  (300 - 399)
-- B  (400 - 499)
-- A  (500 - 599)
-- S1 (600 - 699)
-- S2 (700 - 799)
-- X  (800+)

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)

local data = exports.cd_mechanic:GetCustomVehicleClass(vehicle)
print('Vehicle Class:', data.class, 'Vehicle Rating:', data.rating)

-- Example output:
-- Vehicle Class: S2, Vehicle Rating: 750
lua
local class, rating = exports.cd_mechanic:GetCustomVehicleClass(vehicle)

Get Vehicle Performance Stats

Returns advanced performance stats for a vehicle.

Parameters
lua
--- @param vehicle number Vehicle entity.
--- @return table # Vehicle performance stats.

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)

local vehicleStats = exports.cd_mechanic:GetVehiclePerformanceStats(vehicle)
print(json.encode(vehicleStats, { indent = true }))
Example Output
lua
local vehicleStats  = {
  base_percentages = {
    speed = 52.4,
    acceleration = 61.8,
    braking = 43.2,
    traction = 58.9
  },
  upgrade_increases = {
    speed = 8.5,
    acceleration = 6.2,
    braking = 3.1,
    traction = 4.0
  },
  tuning_increases = {
    speed = 2.4,
    acceleration = 1.8,
    braking = 0.0,
    traction = 1.2
  },
  final_percentages = {
    speed = 63.3,
    acceleration = 69.8,
    braking = 46.3,
    traction = 64.1
  },
  horsepower = 612.5,
  torque_nm = 780.2,
  torque_ftlbs = 575.4,
  weight = 1650.0
}
lua
local vehicleStats = exports.cd_mechanic:GetVehiclePerformanceStats(vehicle)

Server

/

Shared

Get Config

Returns the complete config.lua.

Parameters
lua
--- @return table # The complete config.lua.

--- @example
local mechanicConfig = exports.cd_mechanic:GetConfig()
print(json.encode(mechanicConfig, { indent = true }))
lua
local mechanicConfig = exports.cd_mechanic:GetConfig()

Get Vehicle Mileage

Returns the mileage of a vehicle.

Parameters
lua
--- @param vehicle number|string Vehicle entity or plate text.
--- @return number # This vehicles mileage or 0.0.

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local plate = GetVehicleNumberPlateText(vehicle)

-- You can pass either a vehicle entity or a plate.
local mileage = exports.cd_mechanic:GetVehicleMileage(vehicle or plate)
print(mileage)

-- Example output:
-- 1534.67
lua
local mileage = exports.cd_mechanic:GetVehicleMileage(vehicle or plate)

Get Parts Degradation

Returns the degradation data for all this vehicle parts.

Parameters
lua
--- @param vehicle number|string Vehicle entity or plate text.
--- @return table # A table containing all vehicle parts and their health values.

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local plate = GetVehicleNumberPlateText(vehicle)

-- You can pass either a vehicle entity or a plate.
local degradation = exports.cd_mechanic:GetPartsDegradation(vehicle or plate)
print(degradation)
Example Output
lua
local degradation = {
    clutch = {
        health = 99.22,
        tuning = {
            negative_effect = -0.08,
            handling_modifier = "fClutchChangeRateScaleUpShift"
        }
    },
    tires = {
        health = 99.08,
        tuning = {
            negative_effect = -0.14,
            handling_modifier = "fTractionCurveMax"
        }
    },
    brake_fluid = {
        health = 99.61,
        tuning = {
            negative_effect = -0.02,
            handling_modifier = "fBrakeForce"
        }
    },
    spark_plugs = {
        health = 99.48,
        tuning = {
            negative_effect = -0.03,
            handling_modifier = "fInitialDriveForce"
        }
    },
    radiator = {
        health = 99.61,
        tuning = {
            negative_effect = -0.05,
            handling_modifier = "fEngineDamageMult"
        }
    },
    transmission = {
        health = 99.61,
        tuning = {
            negative_effect = -0.03,
            handling_modifier = "fClutchChangeRateScaleDownShift"
        }
    },
    brake_pads = {
        health = 98.95,
        tuning = {
            negative_effect = -0.08,
            handling_modifier = "fBrakeForce"
        }
    },
    suspension = {
        health = 99.61,
        tuning = {
            negative_effect = -0.03,
            handling_modifier = "fSuspensionForce"
        }
    },
    steering = {
        health = 99.74,
        tuning = {
            negative_effect = -0.02,
            handling_modifier = "fSteeringLock"
        }
    },
    engine_oil = {
        health = 99.74,
        tuning = {
            negative_effect = -0.03,
            handling_modifier = "fEngineDamageMult"
        }
    },
    fuel_system = {
        health = 99.61,
        tuning = {
            negative_effect = -0.03,
            handling_modifier = "fDriveInertia"
        }
    },
    air_filter = {
        health = 99.35,
        tuning = {
            negative_effect = -0.03,
            handling_modifier = "fInitialDriveForce"
        }
    }
}
lua
local degradation = exports.cd_mechanic:GetPartsDegradation(vehicle or plate)

Get Dyno History (Single Vehicle)

Returns dyno history for a specific vehicle.

Parameters
lua
--- @param plate string Vehicle plate text.
--- @return table # Dyno history data.

--- @example
local plate = GetVehicleNumberPlateText(vehicle)

local dyno = exports.cd_mechanic:GetDynoHistory(plate)
print(json.encode(dyno, { indent = true }))

-- Example output:
-- {
--     vehicle_name = "Sultan RS",
--     created = 1775692410
--     dyno_data = {
--         has_turbo = false,
--         tq_nm = 364,
--         hp = 332,
--         vehicle_class = 6
--     }
-- }
lua
local dyno = exports.cd_mechanic:GetDynoHistory(plate)

Get Dyno History (All Vehicles)

Returns dyno history for all vehicles.

Parameters
lua
--- @return table # Dyno history data.

--- @example
local dyno = exports.cd_mechanic:GetDynoHistory()
print(json.encode(dyno, { indent = true }))
Example Output
lua
{
  [1] = {
    plate = 
    vehicle_name = "Sultan RS",
    created = 1775692410,
    dyno_data = {
        has_turbo = false,
        tq_nm = 364,
        hp = 332,
        vehicle_class = 6
    }
  },
  [2] = {
    vehicle_name = "Elegy Retro",
    created = 1775692500,
    dyno_data = {
        has_turbo = true,
        tq_nm = 812,
        hp = 741,
        vehicle_class = 7
    }
  }
}
lua
local dyno = exports.cd_mechanic:GetDynoHistory()

Get Vehicle Engine Sound

Returns advanced performance stats for a vehicle.

Parameters
lua
--- @param vehicle number|string Vehicle entity or plate text.
--- @return table # Vehicle performance stats.

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local plate = GetVehicleNumberPlateText(vehicle)

-- You can pass either a vehicle entity or a plate.
local engineSound = exports.cd_mechanic:GetEngineSound(vehicle or plate)
print(engineSound)

-- Example output:
-- 'ADDER'
lua
local engineSound = exports.cd_mechanic:GetEngineSound(vehicle or plate)

Get Stancer Data

Returns the stancer configuration data for a vehicle.

Parameters
lua
--- @param vehicle number|string Vehicle entity or plate text.
--- @return table # A table containing the vehicle's stancer settings.

--- @example
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local plate = GetVehicleNumberPlateText(vehicle)

-- You can pass either a vehicle entity or a plate.
local stancer = exports.cd_mechanic:GetStancerData(vehicle or plate)
print(json.encode(stancer, { indent = true }))
Example Ouput
lua
{
    height = 0.0,
    wheels = {
        ['0'] = {offset = -0.75, rotation = 0.0},
        ['1'] = {offset = 0.75, rotation = 0.0},
        ['2'] = {offset = -0.75, rotation = 0.0},
        ['3'] = {offset = 0.75, rotation = 0.0}
    }
}
lua
local stancer = exports.cd_mechanic:GetStancerData(vehicle or plate)

Hello!