mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
Merge pull request #894 from TheFantomas/main
refactor(es_extended/server/onesync) Reverse if statement
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user