Merge pull request #384 from darknight2590/patch-6

add GetBoneDistance
This commit is contained in:
Kakarot
2021-12-20 08:22:26 -06:00
committed by GitHub
+15
View File
@@ -347,6 +347,21 @@ function QBCore.Functions.GetClosestBone(entity, list)
return bone, coords, distance
end
function QBCore.Functions.GetBoneDistance(entity, Type, Bone)
local bone
if Type == 1 then
bone = GetPedBoneIndex(entity, Bone)
else
bone = GetEntityBoneIndexByName(entity, Bone)
end
local boneCoords = GetWorldPositionOfEntityBone(entity, bone)
local playerCoords = GetEntityCoords(PlayerPedId())
return #(boneCoords - playerCoords)
end
-- Vehicle
function QBCore.Functions.SpawnVehicle(model, cb, coords, isnetworked)