M MY Multiplayer: Wiki
Side
Kind

getPedBonePosition

Client

Returns the world position of a ped's bone.

vec3|false getPedBonePosition(ped ped, int|string bone)

Parameters

NameTypeDescription
pedpedThe ped or player.
boneint|stringAn MTA bone id up to 54, a rig bone's tag or its name.

Returns

A vec3 with the position. vec3(0, 0, 0) if the ped is streamed out. false if the id is not one of the body's bones or the ped has no such bone.

For objects and for ids above 54, use getElementBonePosition.

Example

addEventHandler("onClientRender", root, function()
    local head = getPedBonePosition(localPlayer, 5)
    if head then
        local sx, sy = getScreenFromWorldPosition(head.x, head.y, head.z + 0.3)
        if sx then
            dxDrawText(getPlayerName(localPlayer), sx, sy)
        end
    end
end)
Coming from MTAIn MTA it returns three numbers. Here it returns a vec3 and also takes rig bones by tag or name.
NoteRaises an error if the ped is streamed in and has no bone with that tag or name.

See also