From f62b2f31b4bd2c4af39b11da67aa88c4e1347e93 Mon Sep 17 00:00:00 2001 From: darknight2590 <87971656+darknight2590@users.noreply.github.com> Date: Sat, 25 Dec 2021 12:47:04 +0200 Subject: [PATCH 1/2] attachProp function --- client/functions.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/functions.lua b/client/functions.lua index 67919f2..7d26c36 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -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) From 920d44e7180e4c17b4202a3cf2f7c9c820136611 Mon Sep 17 00:00:00 2001 From: darknight2590 <87971656+darknight2590@users.noreply.github.com> Date: Tue, 28 Dec 2021 09:11:50 +0200 Subject: [PATCH 2/2] change name function --- client/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/functions.lua b/client/functions.lua index 7d26c36..abc09d6 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -362,7 +362,7 @@ 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) +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)