tweak(vehicleProperties): allow local entities

Local entities (not networked) would fail the check for NetworkGetEntityOwner.
Also fix the error messages, which referenced the wrong variable.
This commit is contained in:
Linden
2022-07-09 03:39:42 +10:00
parent 4fc6366801
commit 9bc37b461d

View File

@@ -171,8 +171,8 @@ end
---@param vehicle number Entity handle
---@param props table Properties
function lib.setVehicleProperties(vehicle, props)
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
if not DoesEntityExist(vehicle) then error(("Unable to set vehicle properties for '%s' (entity does not exist)"):format(vehicle)) end
if NetworkGetEntityIsNetworked(vehicle) and NetworkGetEntityOwner(vehicle) ~= cache.playerId then error(("Unable to set vehicle properties for '%s' (client is not entity owner)"):format(vehicle)) end
local colorPrimary, colorSecondary = GetVehicleColours(vehicle)
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)