Vehicle::preloadMod: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with " {{ClientsideJsFunction}} {{JSContainer| ===Required Params=== *'''vehicle:''' {{RageType|number}} *'''modType:''' {{RageType|number}} *'''modIndex:''' {{RageType|number}} ===Return value=== *''' {{RageType|void}} ''' ==Syntax== <syntaxhighlight lang="javascript"> mp.game.vehicle.preloadMod(vehicle, modType, modIndex) </syntaxhighlight> ==Example== <syntaxhighlight lang="javascript"> //todo </syntaxhighlight> }} ==See also== {{Vehicle_functions_c}} Category:Client...")
 
No edit summary
 
Line 1: Line 1:
{{ClientsideJsFunction}}
{{ClientsideJsFunction}}
{{JSContainer|
{{JSContainer|


== 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===
=== Required Params ===
*'''vehicle:''' {{RageType|number}}
*'''vehicle:''' {{RageType|number}} - The handle of the vehicle to modify.
*'''modType:''' {{RageType|number}}
*'''modType:''' {{RageType|number}} - Type of mod to preload (e.g., wheels, roof, exhaust).
*'''modIndex:''' {{RageType|number}}
*'''modIndex:''' {{RageType|number}} - Index of the specific mod option to preload.


===Return value===
=== Return value ===
*''' {{RageType|void}} '''
*''' {{RageType|void}} ''' - No return value.


==Syntax==
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.game.vehicle.preloadMod(vehicle, modType, modIndex)
mp.game.vehicle.preloadMod(vehicle, modType, modIndex)
</syntaxhighlight>
</syntaxhighlight>


==Example==
== Example ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
//todo
// 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.");
</syntaxhighlight>
</syntaxhighlight>
}}
}}
==See also==
== See also ==
{{Vehicle_functions_c}}
{{Vehicle_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 11:42, 5 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


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.");


See also