mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 17:23:31 +00:00
attachProp function
This commit is contained in:
@@ -362,6 +362,19 @@ function QBCore.Functions.GetBoneDistance(entity, Type, Bone)
|
|||||||
return #(boneCoords - playerCoords)
|
return #(boneCoords - playerCoords)
|
||||||
end
|
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
|
-- Vehicle
|
||||||
|
|
||||||
function QBCore.Functions.SpawnVehicle(model, cb, coords, isnetworked)
|
function QBCore.Functions.SpawnVehicle(model, cb, coords, isnetworked)
|
||||||
|
|||||||
Reference in New Issue
Block a user