Vehicle::setMod: Difference between revisions

From RAGE Multiplayer Wiki
m (Added vehicle mods list)
(Moved vehicle mod list to more appropriate location, and cleaned up some minor code and readability issues.)
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
{{SharedJsFunction}}
{{SharedJsFunction}}
Applies the specified mod onto the vehicle.
Applies the specified mod onto the vehicle.
List of '''[[Vehicle_Mods|Vehicle Mods]]'''


{{JSContainer|
{{JSContainer|
Line 17: Line 14:
*'''modIndex''': {{RageType|Int}}
*'''modIndex''': {{RageType|Int}}


== Examples ==
== Example ==
{{ServersideCode|
{{ServersideCode|
<pre>
<pre>
Line 29: Line 26:
}}
}}
== See Also ==
== See Also ==
*'''[[:Category:Assets|Assets]]'''
*Vehicles
**[[Vehicle_Mods|Vehicle Mods]]
*'''Server-side'''
*'''Server-side'''
{{Vehicle_function}}
{{Vehicle_function}}
Line 35: Line 37:
*'''Client-side'''
*'''Client-side'''
{{Vehicle_function_c}}
{{Vehicle_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:Serverside API]]
[[Category:Serverside API]]
[[Category:Vehicle 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