- Documentation
- Client functions
- getPedBoneIndexByName
Function
getPedBoneIndexByName
Converts a game skeleton bone name to its index, which you can then pass to getPedBonePosition and similar functions. Some names repeat in the skeleton (there are e.g. two "Spine" bones); the second argument picks which occurrence to return.
Syntax
int getPedBoneIndexByName(string name [, int occurrence = 0])Arguments
namestring- Bone name, e.g.
"Head". occurrenceint, optional = 0- Which occurrence of a repeated name: 0 = first, 1 = second, and so on.
Returns
The bone index, or false/nil when there is no such name.
Example
local head = getPedBoneIndexByName("Head")
local x, y, z = getPedBonePosition(localPlayer, head)
See also
getPedBoneNameReturns the name of the game skeleton bone with the given index (e.g."Head","R_Hand"). The index is the bone's position in the Definitive Edition skeleton (0 togetPedBoneCount() - 1), not a number fromgetBoneIDs.getPedBoneIndexForMtaTranslates a bone number used by existing scripts (e.g. 8 = head, 25 = right hand) into a bone index in the Definitive Edition skeleton. Useful when porting existing scripts that use bone numbers. Returnsfalsewhen the bone has no counterpart in the new skeleton.