function SpawnVehicle(x, y, z, vehhash, driverhash, props) --Spawning Function
local found, spawnPos, spawnHeading = GetClosestVehicleNodeWithHeading(x + math.random(-10, 10), y + math.random(-10, 10), z, 0, 3, 0)
ESX.Game.SpawnVehicle(vehhash, spawnPos, spawnHeading, function(callback_vehicle)
SetVehicleHasBeenOwnedByPlayer(callback_vehicle, true)
SetEntityAsMissionEntity(callback_vehicle, true, true)
ClearAreaOfVehicles(GetEntityCoords(callback_vehicle), 5000, false, false, false, false, false);
SetVehicleOnGroundProperly(callback_vehicle)
ESX.Game.SetVehicleProperties(callback_vehicle, props)
mechPed = CreatePedInsideVehicle(callback_vehicle, 26, driverhash, -1, true, false) --Driver Spawning.
mechBlip = AddBlipForEntity(callback_vehicle) --Blip Spawning.
SetBlipFlashes(mechBlip, true)
SetBlipColour(mechBlip, 5)
GoToTarget(x, y, z, callback_vehicle, mechPed, vehhash)
end) --Car Spawning.
end