Skip to main content

Vehicle::preloadMod

Client-side function

Description​

The preloadMod function preloads a specified vehicle mod on a target vehicle. This is useful for preparing mods (such as wheels or body kits) for rendering or for applying mods more quickly in complex vehicle customization scenes.

Required Params​

  • vehicle: number - The handle of the vehicle to modify.
  • modType: number - Type of mod to preload (e.g., wheels, roof, exhaust).
  • modIndex: number - Index of the specific mod option to preload.

Return value​

  • void - No return value.

Syntax​

mp.game.vehicle.preloadMod(vehicle, modType, modIndex)

Example​

// Preload a custom spoiler mod on the first vehicle in the game
const vehicle = mp.vehicles.at(0).handle;
const modType = 0; // Spoiler category
const modIndex = 3; // Specific spoiler design index

mp.game.vehicle.preloadMod(vehicle, modType, modIndex);
mp.gui.chat.push("Spoiler mod preloaded for the vehicle.");