Ped::setPropIndex
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);