add GetBoneDistance

This commit is contained in:
darknight2590
2021-12-20 10:28:17 +02:00
committed by GitHub
parent d981752484
commit 9a26a1b047
+15
View File
@@ -315,6 +315,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)