ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. getElementBonePosition

Function

getElementBonePosition

ClientElementsIdentical to MTA:SA

Returns a ped bone's position in the world.

Syntax

float getElementBonePosition(element theElement, int bone)

Arguments

theElementelement
A player or ped.
boneint
Bone number (e.g. 8 head, 24 right hand).

Returns

x, y, z or false.

Example

addEventHandler("onClientRender", root, function()
    for _, p in ipairs(getElementsByType("player")) do
        local x, y, z = getElementBonePosition(p, 8)
        if x then
            local sx, sy = getScreenFromWorldPosition(x, y, z + 0.3)
            if sx then dxDrawText(getPlayerName(p), sx, sy) end
        end
    end
end)

See also