public static void SpawnFractionCars(int fraction)
{
foreach (var vehicle in FractionVehicles[fraction])
{
if (vehicle.Value.Item1 == "barracks")
{
var model = NAPI.Util.GetHashKey(vehicle.Value.Item1);
var canmats = ((VehicleHash)model == VehicleHash.Barracks || (VehicleHash)model == VehicleHash.Youga || (VehicleHash)model == VehicleHash.Burrito3); // "CANMATS"
var candrugs = ((VehicleHash)model == VehicleHash.Youga || (VehicleHash)model == VehicleHash.Burrito3); // "CANDRUGS"
var canmeds = ((VehicleHash)model == VehicleHash.Ambulance); // "CANMEDKITS"
var veh = NAPI.Vehicle.CreateVehicle(model, vehicle.Value.Item2, vehicle.Value.Item3.Z, vehicle.Value.Item5, vehicle.Value.Item6);
NAPI.Data.SetEntityData(veh, "ACCESS", "FRACTION");
NAPI.Data.SetEntityData(veh, "FRACTION", fraction);
NAPI.Data.SetEntityData(veh, "MINRANK", vehicle.Value.Item4);
NAPI.Data.SetEntityData(veh, "TYPE", FractionTypes[fraction]);
if (canmats)
NAPI.Data.SetEntityData(veh, "CANMATS", true);
if (candrugs)
NAPI.Data.SetEntityData(veh, "CANDRUGS", true);
if (canmeds)
NAPI.Data.SetEntityData(veh, "CANMEDKITS", true);
NAPI.Vehicle.SetVehicleNumberPlate(veh, vehicle.Key);
Core.VehicleStreaming.SetEngineState(veh, false);
VehicleManager.FracApplyCustomization(veh, fraction);
CarSpawner.carSpawners.Find(x => x.FractionID == fraction).SpawnedCars.Add(vehicle.Key);
}
}
}