mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 07:56:02 +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 props table Properties
|
||||
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 pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
|
||||
|
||||
@@ -480,4 +482,3 @@ function lib.setVehicleProperties(vehicle, props)
|
||||
SetVehicleMod(vehicle, 49, props.modLightbar, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user