Dlc1::getVariantComponent: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
No edit summary
 
Line 1: Line 1:
{{ClientsideJsFunction}}
{{JSContainer|


==Syntax==
The `getVariantComponent` function is used to retrieve specific variant information for a component in the game. By specifying different parameters, developers can access various customization options or configurations for a component, which can be helpful in designing modifiable assets or specialized visual elements for players.
<syntaxhighlight lang="javascript">mp.game.dlc1.getVariantComponent(componentHash, componentId, p2, p3, p4);</syntaxhighlight>
 
=== Required Arguments ===
This function is useful in situations where variant components need to be programmatically accessed or changed, such as applying different appearances or functional parts based on player actions or game events.
*'''componentHash:''' Model hash or name
 
*'''componentId:''' int
=== Required Params ===
*'''p2:''' unknown (to be checked)
* '''componentHash:''' {{RageType|number}} – The model hash or name of the component.
*'''p3:''' unknown (to be checked)
* '''componentId:''' {{RageType|int}} – Identifier for the specific component to retrieve.
*'''p4:''' unknown (to be checked)
* '''nameHash:''' {{RageType|number}} – Hash value for the name of the component variant.
===Return value===
* '''enumValue:''' {{RageType|number}} – Enumeration value associated with the component variant.
*'''Undefined'''
* '''componentType:''' {{RageType|number}} – Type identifier for the component variant.
==Example==
 
=== Return Value ===
* '''Undefined''' – This function does not return a value.
 
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
mp.game.dlc1.getVariantComponent(componentHash, componentId, nameHash, enumValue, componentType);
</syntaxhighlight>
</syntaxhighlight>
==See also==
 
== Example ==
<syntaxhighlight lang="javascript">
// Example usage of getVariantComponent
 
const componentHash = mp.game.joaat("prop_component_example"); // Example component hash
const componentId = 1;                                        // Component ID
const nameHash = mp.game.joaat("variant_name_example");        // Name hash for the variant
const enumValue = 2;                                          // Enumeration value for the variant
const componentType = 3;                                      // Component type identifier
 
// Attempt to get the specified variant component
mp.game.dlc1.getVariantComponent(componentHash, componentId, nameHash, enumValue, componentType);
 
// Output to the chat to confirm function call
mp.gui.chat.push("getVariantComponent called for specified component variant.");
</syntaxhighlight>
}}
 
== See Also ==
{{Dlc1_s_function_c}}
{{Dlc1_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:Vehicle Functions]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 09:24, 2 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


The `getVariantComponent` function is used to retrieve specific variant information for a component in the game. By specifying different parameters, developers can access various customization options or configurations for a component, which can be helpful in designing modifiable assets or specialized visual elements for players.

This function is useful in situations where variant components need to be programmatically accessed or changed, such as applying different appearances or functional parts based on player actions or game events.

Required Params

  • componentHash: number – The model hash or name of the component.
  • componentId: int – Identifier for the specific component to retrieve.
  • nameHash: number – Hash value for the name of the component variant.
  • enumValue: number – Enumeration value associated with the component variant.
  • componentType: number – Type identifier for the component variant.

Return Value

  • Undefined – This function does not return a value.

Syntax

mp.game.dlc1.getVariantComponent(componentHash, componentId, nameHash, enumValue, componentType);

Example

// Example usage of getVariantComponent

const componentHash = mp.game.joaat("prop_component_example"); // Example component hash
const componentId = 1;                                         // Component ID
const nameHash = mp.game.joaat("variant_name_example");        // Name hash for the variant
const enumValue = 2;                                           // Enumeration value for the variant
const componentType = 3;                                       // Component type identifier

// Attempt to get the specified variant component
mp.game.dlc1.getVariantComponent(componentHash, componentId, nameHash, enumValue, componentType);

// Output to the chat to confirm function call
mp.gui.chat.push("getVariantComponent called for specified component variant.");


See Also

Template:Dlc1 s function c