Ped::setPropIndex: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with " {{ClientsideJsFunction}} {{JSContainer| ===Required Params=== *'''ped:''' {{RageType|number}} *'''componentId:''' {{RageType|number}} *'''drawableId:''' {{RageType|number}} *'''TextureId:''' {{RageType|number}} *'''attach:''' {{RageType|boolean}} ===Return value=== *''' {{RageType|void}} ''' ==Syntax== <syntaxhighlight lang="javascript"> mp.game.ped.setPropIndex(ped, componentId, drawableId, TextureId, attach) </syntaxhighlight> ==Example== <syntaxhighlight lang="j...")
 
No edit summary
 
Line 1: Line 1:
{{ClientsideJsFunction}}
{{ClientsideJsFunction}}
{{JSContainer|
{{JSContainer|


==Function==
This function sets a prop on a ped (such as a hat, glasses, or other accessories) by specifying the component, drawable, and texture IDs. The `attach` parameter determines if the prop should be applied immediately.


===Required Params===
===Required Params===
*'''ped:''' {{RageType|number}}
*'''ped:''' {{RageType|number}} - The handle of the ped (player or NPC).
*'''componentId:''' {{RageType|number}}
*'''componentId:''' {{RageType|number}} - The ID of the prop component (e.g., hats, glasses).
*'''drawableId:''' {{RageType|number}}
*'''drawableId:''' {{RageType|number}} - The specific prop model to apply.
*'''TextureId:''' {{RageType|number}}
*'''TextureId:''' {{RageType|number}} - The texture variation of the prop.
*'''attach:''' {{RageType|boolean}}
*'''attach:''' {{RageType|boolean}} - Whether to attach the prop immediately.


===Return value===
===Return value===
Line 16: Line 17:
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.game.ped.setPropIndex(ped, componentId, drawableId, TextureId, attach)
mp.game.ped.setPropIndex(ped, componentId, drawableId, TextureId, attach);
</syntaxhighlight>
</syntaxhighlight>


==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
//todo
// Example: Apply a hat to the player ped with a specific model and texture.
const playerPed = mp.players.local.handle; // Get the local player's ped handle
const componentId = 0; // Hats component
const drawableId = 5; // Example hat model
const textureId = 2; // Texture variation for the hat
const attach = true; // Attach immediately
 
mp.game.ped.setPropIndex(playerPed, componentId, drawableId, textureId, attach);
</syntaxhighlight>
</syntaxhighlight>
}}
}}
==See also==
==See also==
{{Ped_s_function_c}}
{{Ped_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 12:23, 2 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


Function

This function sets a prop on a ped (such as a hat, glasses, or other accessories) by specifying the component, drawable, and texture IDs. The `attach` parameter determines if the prop should be applied immediately.

Required Params

  • ped: number - The handle of the ped (player or NPC).
  • componentId: number - The ID of the prop component (e.g., hats, glasses).
  • drawableId: number - The specific prop model to apply.
  • TextureId: number - The texture variation of the prop.
  • attach: boolean - Whether to attach the prop immediately.

Return value

  • void

Syntax

mp.game.ped.setPropIndex(ped, componentId, drawableId, TextureId, attach);

Example

// Example: Apply a hat to the player ped with a specific model and texture.
const playerPed = mp.players.local.handle; // Get the local player's ped handle
const componentId = 0; // Hats component
const drawableId = 5; // Example hat model
const textureId = 2; // Texture variation for the hat
const attach = true; // Attach immediately

mp.game.ped.setPropIndex(playerPed, componentId, drawableId, textureId, attach);



See also