Vehicle::getMod: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
In b944, there are 50 (0 - 49) mod types.<br><br>Returns -1 if the vehicle mod is stock
__NOTOC__
==Syntax==
{{SharedJsFunction}}
<syntaxhighlight lang="javascript">vehicle.getMod(modType);</syntaxhighlight>
Gets the mod currently applied on your vehicle in the targetted modType.
=== Required Arguments ===
 
*'''modType:''' int
{{JSContainer|
===Return value===
== Syntax ==
*'''int'''
 
==Example==
<pre>
<syntaxhighlight lang="javascript">
vehicle.getMod(modType);
// todo
</pre>
</syntaxhighlight>
 
==See also==
=== Parameters ===
{{Vehicle_function_c}}
*'''modType''': {{RageType|Int}}
 
== Return value ==
*'''modIndex''': {{RageType|Int}}
 
== Examples ==
{{ServersideCode|
<pre>
mp.events.addCommand('spoiler', (player) => {
if(!player.vehicle) return player.outputChatBox("You need to be in a vehicle to use this command.");
let modIndex = player.vehicle.getMod(0);
player.outputChatBox(`The mod index ID for your spoiler is ${modIndex}`);
});
</pre>
}}
}}
 
== See Also ==
*'''Server-side'''
{{Vehicle_function}}
 
 
*'''Client-side'''
{{Vehicle_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:Serverside API]]
[[Category:Vehicle API]]

Latest revision as of 02:57, 27 April 2020

Shared
Function

 JavaScript


Gets the mod currently applied on your vehicle in the targetted modType.

JavaScript Syntax

Syntax

vehicle.getMod(modType);

Parameters

  • modType: Int

Return value

  • modIndex: Int

Examples

Server-Side
mp.events.addCommand('spoiler', (player) => {
	if(!player.vehicle) return player.outputChatBox("You need to be in a vehicle to use this command.");
	let modIndex = player.vehicle.getMod(0);
	player.outputChatBox(`The mod index ID for your spoiler is ${modIndex}`);
});


See Also