Vehicle::setMod: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
(Moved vehicle mod list to more appropriate location, and cleaned up some minor code and readability issues.)
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
In b944, there are 50 (0 - 49) mod types.<br><br>Sets the vehicle mod.<br>The vehicle must have a mod kit first.<br><br>Any out of range ModIndex is stock.<br><br>#Mod Type<br>Spoilers - 0<br>Front Bumper - 1<br>Rear Bumper - 2<br>Side Skirt - 3<br>Exhaust - 4<br>Frame - 5<br>Grille - 6<br>Hood - 7<br>Fender - 8<br>Right Fender - 9<br>Roof - 10<br>Engine - 11<br>Brakes - 12<br>Transmission - 13<br>Horns - 14 (modIndex from 0 to 51)<br>Suspension - 15<br>Armor - 16<br>Front Wheels - 23<br>Back Wheels - 24 //only for motocycles<br>Plate holders - 25<br>Trim Design - 27<br>Ornaments - 28<br>Dial Design - 30<br>Steering Wheel - 33<br>Shifter Leavers - 34<br>Plaques - 35<br>Hydraulics - 38<br>Livery - 48<br><br>ENUMS: pastebin.com/QzEAn02v
__NOTOC__
==Syntax==
{{SharedJsFunction}}
<syntaxhighlight lang="javascript">vehicle.setMod(modType, modIndex, customTires);</syntaxhighlight>
Applies the specified mod onto the vehicle.
=== Required Arguments ===
 
*'''modType:''' int
{{JSContainer|
*'''modIndex:''' int
== Syntax ==
*'''customTires:''' Boolean
 
===Return value===
<pre>
*'''Undefined'''
vehicle.setMod(modType, modIndex);
==Example==
</pre>
<syntaxhighlight lang="javascript">
 
// todo
=== Parameters ===
</syntaxhighlight>
*'''modType''': {{RageType|Int}}
==See also==
*'''modIndex''': {{RageType|Int}}
 
== Example ==
{{ServersideCode|
<pre>
mp.events.addCommand('mod', (player, _, modType , modIndex) => {
if(!player.vehicle) return player.outputChatBox("You need to be in a vehicle to use this command.");
player.vehicle.setMod(parseInt(modType), parseInt(modIndex));
player.outputChatBox(`Mod Type ${modType} with Mod Index ${modIndex} applied.`);
});
</pre>
}}
}}
== See Also ==
*'''[[:Category:Assets|Assets]]'''
*Vehicles
**[[Vehicle_Mods|Vehicle Mods]]
 
 
*'''Server-side'''
{{Vehicle_function}}
 
 
*'''Client-side'''
{{Vehicle_function_c}}
{{Vehicle_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:Serverside API]]
[[Category:Vehicle API]]

Latest revision as of 20:25, 11 September 2020

Shared
Function

 JavaScript


Applies the specified mod onto the vehicle.

JavaScript Syntax

Syntax

vehicle.setMod(modType, modIndex);

Parameters

  • modType: Int
  • modIndex: Int

Example

Server-Side
mp.events.addCommand('mod', (player, _, modType , modIndex) => {
	if(!player.vehicle) return player.outputChatBox("You need to be in a vehicle to use this command.");
	player.vehicle.setMod(parseInt(modType), parseInt(modIndex));
	player.outputChatBox(`Mod Type ${modType} with Mod Index ${modIndex} applied.`);
});


See Also