Save Livery for Faction Vehicles
This commit is contained in:
@@ -1702,7 +1702,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
Vehicle vehicle = player.Vehicle;
|
Vehicle vehicle = player.Vehicle;
|
||||||
int playerSeat = player.VehicleSeat;
|
int playerSeat = player.VehicleSeat;
|
||||||
vehicle = SaveManager.SaveFactionVehicleData(vehicle, (VehicleHash)vehicle.Model, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
|
vehicle = SaveManager.SaveFactionVehicleData(vehicle, (VehicleHash)vehicle.Model, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
|
||||||
vehicle.PrimaryColor, vehicle.SecondaryColor, vehicle.Locked, vehicle.EngineStatus, player.GetUser().FactionId.Value);
|
vehicle.PrimaryColor, vehicle.SecondaryColor, vehicle.Locked, vehicle.EngineStatus, player.GetUser().FactionId.Value, vehicle.Livery);
|
||||||
player.SendNotification("Fraktionsfahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
|
player.SendNotification("Fraktionsfahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
|
||||||
player.SetIntoVehicle(vehicle, playerSeat);
|
player.SetIntoVehicle(vehicle, playerSeat);
|
||||||
}
|
}
|
||||||
@@ -2615,7 +2615,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Command("setweaponrack", "~m~Benutzung: ~s~/setweaponrack [Fraktion ID] [Waffen Model] [SlotID (1-4)]")]
|
[Command("setweaponrack", "~m~Benutzung: ~s~/setweaponrack [Fraktion ID] [Waffen Model] [SlotID (1-4)]")]
|
||||||
public void CmdAdminSetWeaponrack(Client player, int factionID,string weaponModel,int slotId)
|
public void CmdAdminSetWeaponrack(Client player, int factionID, string weaponModel, int slotId)
|
||||||
{
|
{
|
||||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||||
{
|
{
|
||||||
@@ -2749,7 +2749,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ALevel1338
|
#region ALevel1338
|
||||||
[Command("whitelist", "~m~Benutzung: ~s~/whitelist [Add / Remove] [Socialclub Name]")]
|
[Command("whitelist", "~m~Benutzung: ~s~/whitelist [Add / Remove] [Socialclub Name]")]
|
||||||
public void CmdAdminWhitelist(Client player, string option, string scName)
|
public void CmdAdminWhitelist(Client player, string option, string scName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
public bool Active { get; set; }
|
public bool Active { get; set; }
|
||||||
public float DistanceDriven { get; set; }
|
public float DistanceDriven { get; set; }
|
||||||
public float TankAmount { get; set; }
|
public float TankAmount { get; set; }
|
||||||
|
public int Livery { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Vector3 Position => new Vector3(PositionX, PositionY, PositionZ);
|
public Vector3 Position => new Vector3(PositionX, PositionY, PositionZ);
|
||||||
@@ -43,6 +44,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
int c2 = this.SecondaryColor;
|
int c2 = this.SecondaryColor;
|
||||||
string np = this.NumberPlate;
|
string np = this.NumberPlate;
|
||||||
Vehicle veh = NAPI.Vehicle.CreateVehicle(Model, position, heading, c1, c2, "", 255, false, false);
|
Vehicle veh = NAPI.Vehicle.CreateVehicle(Model, position, heading, c1, c2, "", 255, false, false);
|
||||||
|
veh.Livery = Livery;
|
||||||
VehicleStreaming.SetEngineState(veh, false);
|
VehicleStreaming.SetEngineState(veh, false);
|
||||||
VehicleStreaming.SetLockStatus(veh, this.Locked);
|
VehicleStreaming.SetLockStatus(veh, this.Locked);
|
||||||
VehicleManager.AddVehicle(this, veh);
|
VehicleManager.AddVehicle(this, veh);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Vehicle SaveFactionVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
public static Vehicle SaveFactionVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int factionId)
|
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int factionId, int livery)
|
||||||
{
|
{
|
||||||
using (var saveData = new DatabaseContext())
|
using (var saveData = new DatabaseContext())
|
||||||
{
|
{
|
||||||
@@ -121,7 +121,8 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
PrimaryColor = vehiclePrimaryColor,
|
PrimaryColor = vehiclePrimaryColor,
|
||||||
SecondaryColor = vehicleSecondaryColor,
|
SecondaryColor = vehicleSecondaryColor,
|
||||||
Locked = vehicleLocked,
|
Locked = vehicleLocked,
|
||||||
Active = true
|
Active = true,
|
||||||
|
Livery = livery
|
||||||
};
|
};
|
||||||
saveData.FactionVehicles.Add(dataSet);
|
saveData.FactionVehicles.Add(dataSet);
|
||||||
saveData.SaveChanges();
|
saveData.SaveChanges();
|
||||||
|
|||||||
Reference in New Issue
Block a user