Get/Set vehicle props

This commit is contained in:
MrNewb committed 2025-06-08 19:40:49 -04:00
1 parent 71aca51cb5
commit 33868c43c4
3 files changed
+93

No files matched your search

+31
View File
@@ -171,6 +171,37 @@ Framework.GetPlayerInventory = function()
return items
end
---This will return the vehicle properties for the specified vehicle.
---@param vehicle number
---@return table
Framework.GetVehicleProperties = function(vehicle)
if not vehicle or not DoesEntityExist(vehicle) then return {} end
local vehicleProps = QBCore.Functions.GetVehicleProperties(vehicle)
return vehicleProps or {}
end
---This will set the vehicle properties for the specified vehicle.
---@param vehicle number
---@param properties table
---@return boolean
Framework.SetVehicleProperties = function(vehicle, properties)
if not vehicle or not DoesEntityExist(vehicle) then return false end
if not properties then return false end
if NetworkGetEntityIsNetworked(vehicle) then
local vehNetID = NetworkGetNetworkIdFromEntity(vehicle)
local entOwner = GetPlayerServerId(NetworkGetEntityOwner(vehNetID))
if entOwner ~= GetPlayerServerId(PlayerId()) then
NetworkRequestControlOfEntity(vehicle)
local count = 0
while not NetworkHasControlOfEntity(vehicle) and count < 3000 do
Wait(1)
count = count + 1
end
end
end
return true, QBCore.Functions.SetVehicleProperties(vehicle, properties)
end
---This will get a players dead status.
---@return boolean
Framework.GetIsPlayerDead = function()