Merge pull request #894 from TheFantomas/main

refactor(es_extended/server/onesync) Reverse if statement
This commit is contained in:
TheFantomas
2023-02-13 22:37:52 +01:00
committed by GitHub
+6 -7
View File
@@ -69,14 +69,13 @@ function ESX.OneSync.SpawnVehicle(model, coords, heading, properties, cb)
ESX.GetVehicleType(vehicleModel, xPlayer.id, function(vehicleType)
if vehicleType then
local createdVehicle = CreateVehicleServerSetter(vehicleModel, vehicleType, coords, heading)
if DoesEntityExist(createdVehicle) then
local networkId = NetworkGetNetworkIdFromEntity(createdVehicle)
vehicleProperties.NetId = networkId
Entity(createdVehicle).state:set('VehicleProperties', vehicleProperties, true)
cb(networkId)
else
print('[^1ERROR^7] Unfortunately, this vehicle has not spawned')
if not DoesEntityExist(createdVehicle) then
return print('[^1ERROR^7] Unfortunately, this vehicle has not spawned')
end
local networkId = NetworkGetNetworkIdFromEntity(createdVehicle)
Entity(createdVehicle).state:set('VehicleProperties', vehicleProperties, true)
cb(networkId)
else
print(('[^1ERROR^7] Tried to spawn invalid vehicle - ^5%s^7!'):format(model))
end