refactor(client/vehicleProperties): return true if client owns entity

Technically closer to the previous behaviour.
This commit is contained in:
Linden
2024-04-20 10:28:21 +10:00
parent 3df183653d
commit b9452f9248

View File

@@ -284,7 +284,7 @@ end
---@param vehicle number
---@param props VehicleProperties
---@param fixVehicle? boolean Fix the vehicle after props have been set. Usually required when adding extras.
---@return boolean?
---@return boolean isEntityOwner True if the entity is networked and the client is the current entity owner.
function lib.setVehicleProperties(vehicle, props, fixVehicle)
if not DoesEntityExist(vehicle) then
error(("Unable to set vehicle properties for '%s' (entity does not exist)"):format(vehicle))
@@ -637,5 +637,5 @@ function lib.setVehicleProperties(vehicle, props, fixVehicle)
SetVehicleFixed(vehicle)
end
return true
return not NetworkGetEntityIsNetworked(vehicle) or NetworkGetEntityOwner(vehicle) == cache.playerId
end