The documentation for GetEntityBoneIndexByName
states you can use on a vehicle however it returns nil
local bone_index = GetEntityBoneIndexByName(targetVehicle, 'window_lf')
print(bone_index) -- prints nothing
I am guessing getting vehicle “bones” no longer works due to them marked old in the pastebin. Is there an alternative for this?
The native works for me. If you would like to see how I used it you can look on my github spikestrip client script
Hope that helps.
1 Like
Thanks for the reference. I see what I did now. Leaving the snippet that helped me here:
local vehicle = GetVehiclePedIsIn(LocalPed(), false)
local tirePos = GetWorldPositionOfEntityBone(vehicle, GetEntityBoneIndexByName(vehicle, tires[a].bone))
local spike = GetClosestObjectOfType(tirePos.x, tirePos.y, tirePos.z, 15.0, GetHashKey(spikemodel), 1, 1, 1)
local spikePos = GetEntityCoords(spike, false)
local distance = Vdist(tirePos.x, tirePos.y, tirePos.z, spikePos.x, spikePos.y, spikePos.z)
1 Like
Well fuckk meeee! I got mine to work! I just needed to enclose my vehicle’s bone name in single quotes.
here’s my successful code snippset:
print(GetEntityBoneIndexByName(GetVehiclePedIsIn(PlayerPedId(), 'wing_l'))