attachProp function

This commit is contained in:
darknight2590
2021-12-25 12:47:04 +02:00
committed by GitHub
parent 02a46247cb
commit f62b2f31b4
+13
View File
@@ -362,6 +362,19 @@ function QBCore.Functions.GetBoneDistance(entity, Type, Bone)
return #(boneCoords - playerCoords)
end
function QBCore.Functions.attachProp(ped, model, boneId, x, y, z, xR, yR, zR, Vertex)
local modelHash = GetHashKey(model)
local bone = GetPedBoneIndex(ped, boneId)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end
local prop = CreateObject(modelHash, 1.0, 1.0, 1.0, 1, 1, 0)
AttachEntityToEntity(prop, ped, bone, x, y, z, xR, yR, zR, 1, 1, 0, 1, not Vertex and 2 or 0, 1)
SetModelAsNoLongerNeeded(modelHash)
return prop
end
-- Vehicle
function QBCore.Functions.SpawnVehicle(model, cb, coords, isnetworked)