GetEntityBoneIndexByName() question when using for peds

Does anyone have experience with using this native? I cannot get it to work with peds.

I’m using it to create a health script and wanted to just make a table of bone names that I loop through and get the ID’s for the different bones.

Simple Test Code:

print(GetEntityBoneIndexByName(GetPlayerPed(-1), "SKEL_L_Toe0"))

This SHOULD work I think. Returning -1 as if the bone doesn’t exist for the entity… hopefully someone has some insight to this. If I figure it out I will post back for the next guy.

Link to the native: https://runtime.fivem.net/doc/natives/#_0xFB71170B7E76ACBA

I dont HAVE to have this working. Just trying to avoid doing something like this to check what bone got injured…

function GetBoneName(bone)
    if bone == 51826 then
        boneName = 'Right Thigh'
    elseif bone == 36864 then
        boneName = 'Right Calf'
    elseif bone == 52301 then
        boneName = 'Right Foot'
    elseif bone == 58271 then
        boneName = 'Left Thigh' 
    elseif bone == 63931 then
        boneName = 'Left Calf'    
    elseif bone == 14201 then
        boneName = 'Left Foot' 
    end 
end

Maan I can’t get this shit to work for vehicles either; Tried with basic args, but no fuego…will use this to doc my stuff (prolly)

Got it! I was able to do this by enclosing my bone name in quotes. Here’s what Im running:

print(GetEntityBoneIndexByName(GetVehiclePedIsIn(PlayerPedId(), ‘wing_l’))

Yeah I ended up getting it to work :smiley: good job tho I’ll mark as resolution for other people searching :smiley:

2 Likes