Vehicle::setMod: Difference between revisions

From RAGE Multiplayer Wiki
(Moved vehicle mod list to more appropriate location, and cleaned up some minor code and readability issues.)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''[[Vehicle_Mods|Vehicle Mods]]'''
__NOTOC__
==Syntax==
{{SharedJsFunction}}
<syntaxhighlight lang="javascript">vehicle.setMod(modType, modIndex);</syntaxhighlight>
Applies the specified mod onto the vehicle.
=== Required Arguments ===
*'''modType:''' int
*'''modIndex:''' int
===Return value===
*'''Undefined'''


==Example==
{{JSContainer|
<syntaxhighlight lang="javascript">
== Syntax ==
mp.events.addCommand('mod', (player: MpPlayer, fullText: string, a : string, b : string) => {
 
    player.vehicle.setMod(parseInt(a), parseInt(b));
<pre>
vehicle.setMod(modType, modIndex);
</pre>
 
=== Parameters ===
*'''modType''': {{RageType|Int}}
*'''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.`);
});
});
</syntaxhighlight>
</pre>
==See also==
}}
[[Vehicle_Mods|Vehicle Mods]]
}}
== 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