setPedComponent
The setPedComponent
export allows you to apply a single clothing component to a ped, such as a shirt, pants, or jacket. It includes automatic handling for special cases like torso adjustments based on jackets, and skips invalid combinations for freemode peds.
How to Use
To apply a clothing component to a ped, use the following code:
This export takes:
ped
: The ped entity to modifycomponent
: A table with:component_id
: The slot ID (e.g.,11
for jacket)drawable
: The model variation indextexture
: The texture index
Behavior:
Skips application of component
0
(face) and2
(hair) for freemode peds, as they are typically handled elsewhere.If the component is a jacket (
component_id == 11
), it attempts to adjust the arms (component 3) using internal torso-hand mapping (GetUpperBodyData()
), ensuring visual compatibility.Applies the variation using
SetPedComponentVariation
. If the component ID is99
(used internally for gloves), it remaps to component3
(arms).
This function is ideal for granular updates to specific clothing slots while maintaining compatibility with freemode models.
Last updated