Dlc1::getVariantComponent: Difference between revisions
(yay) |
No edit summary |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{ClientsideJsFunction}} | |||
{{JSContainer| | |||
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. | |||
=== Required | 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:''' | |||
*'''componentId:''' int | === Required Params === | ||
*''' | * '''componentHash:''' {{RageType|number}} – The model hash or name of the component. | ||
*''' | * '''componentId:''' {{RageType|int}} – Identifier for the specific component to retrieve. | ||
*''' | * '''nameHash:''' {{RageType|number}} – Hash value for the name of the component variant. | ||
===Return | * '''enumValue:''' {{RageType|number}} – Enumeration value associated with the component variant. | ||
*'''Undefined''' | * '''componentType:''' {{RageType|number}} – Type identifier for the component variant. | ||
== | |||
=== Return Value === | |||
* '''Undefined''' – This function does not return a value. | |||
== Syntax == | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
mp.game.dlc1.getVariantComponent(componentHash, componentId, nameHash, enumValue, componentType); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See | |||
{{ | == 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}} | |||
[[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 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.");