MfG, DimGamer
This commit is contained in:
@@ -195,7 +195,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
PositionY = spawnPos.Y,
|
||||
PositionZ = spawnPos.Z,
|
||||
Locked = false,
|
||||
FactionId = player.GetUser().FactionId,
|
||||
Owners = JsonConvert.SerializeObject(new int[] { player.GetUser(dbContext).FactionId.Value }),
|
||||
Model = shopVehicle.Model,
|
||||
PrimaryColor = 111,
|
||||
SecondaryColor = 111,
|
||||
|
||||
@@ -5,6 +5,7 @@ using ReallifeGamemode.Database.Entities.Saves;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
@@ -133,14 +134,14 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
|
||||
public static Vehicle SaveFactionVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int factionId, int livery)
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int[] factionId, int livery)
|
||||
{
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new FactionVehicle
|
||||
{
|
||||
Model = vehicleModel,
|
||||
FactionId = factionId,
|
||||
Owners = JsonConvert.SerializeObject(factionId),
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
|
||||
@@ -31,10 +31,11 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
colShape.OnEntityEnterColShape += (cs, c) =>
|
||||
{
|
||||
using var dbContext = new DatabaseContext();
|
||||
if (c.IsInVehicle)
|
||||
{
|
||||
Vehicle v = c.Vehicle;
|
||||
if (v.GetServerVehicle() is FactionVehicle fV && fV.GetFaction().StateOwned)
|
||||
if (v.GetServerVehicle() is FactionVehicle fV && fV.GetOwners().TrueForAll(fV => dbContext.Factions.Where(f => f.Id == fV).First().StateOwned))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user