mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
refactor(vehicleproperties): throw error for invalid or unowned entity
This commit is contained in:
@@ -158,7 +158,9 @@ end
|
|||||||
---@param vehicle number Entity handle
|
---@param vehicle number Entity handle
|
||||||
---@param props table Properties
|
---@param props table Properties
|
||||||
function lib.setVehicleProperties(vehicle, props)
|
function lib.setVehicleProperties(vehicle, props)
|
||||||
if DoesEntityExist(vehicle) and NetworkGetEntityOwner(vehicle) == PlayerId() then
|
if not DoesEntityExist(vehicle) then error(("Unable to set vehicle properties for '%s' (entity does not exist)"):format(entity)) end
|
||||||
|
if NetworkGetEntityOwner(vehicle) ~= PlayerId() then error(("Unable to set vehicle properties for '%s' (client is not entity owner)"):format(entity)) end
|
||||||
|
|
||||||
local colorPrimary, colorSecondary = GetVehicleColours(vehicle)
|
local colorPrimary, colorSecondary = GetVehicleColours(vehicle)
|
||||||
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
|
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
|
||||||
|
|
||||||
@@ -479,5 +481,4 @@ function lib.setVehicleProperties(vehicle, props)
|
|||||||
if props.modLightbar then
|
if props.modLightbar then
|
||||||
SetVehicleMod(vehicle, 49, props.modLightbar, false)
|
SetVehicleMod(vehicle, 49, props.modLightbar, false)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user