vlt fix kfz id bug??

This commit is contained in:
hydrant
2021-04-22 01:15:38 +02:00
parent 57e7455abf
commit 3546ba7f99
6 changed files with 42 additions and 27 deletions

View File

@@ -168,13 +168,13 @@ namespace ReallifeGamemode.Server.Managers
player.TriggerEvent("SERVER:Util_setWaypoint", spawnPos.X, spawnPos.Y);
User u = player.GetUser(dbContext);
User user = player.GetUser(dbContext);
ServerVehicle newVeh = null;
if (target == "Spieler")
{
TransactionResult result = BankManager.TransferMoney(u, business, price, "Auto gekauft", dbContext);
TransactionResult result = BankManager.TransferMoney(user, business, price, "Auto gekauft", dbContext);
if (result == TransactionResult.SENDER_NOT_ENOUGH_MONEY)
{
player.SendNotification("~r~Du hast nicht genug Geld: " + price.ToMoneyString());
@@ -190,7 +190,7 @@ namespace ReallifeGamemode.Server.Managers
PositionY = spawnPos.Y,
PositionZ = spawnPos.Z,
Locked = false,
UserId = player.GetUser().Id,
UserId = user.Id,
Model = shopVehicle.Model,
PrimaryColor = 111,
SecondaryColor = 111,
@@ -200,7 +200,7 @@ namespace ReallifeGamemode.Server.Managers
}
else if (target == "Fraktion")
{
var faction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == u.FactionId).First();
var faction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == user.FactionId).First();
TransactionResult result = BankManager.TransferMoney(faction, business, (int)(price * FACTION_CAR_MULTIPLIER), "Auto gekauft", dbContext);
if (result == TransactionResult.SENDER_NOT_ENOUGH_MONEY)
{
@@ -216,7 +216,7 @@ namespace ReallifeGamemode.Server.Managers
PositionY = spawnPos.Y,
PositionZ = spawnPos.Z,
Locked = false,
Owners = JsonConvert.SerializeObject(new int[] { player.GetUser(dbContext).FactionId.Value }),
Owners = JsonConvert.SerializeObject(new int[] { user.FactionId.Value }),
Model = shopVehicle.Model,
PrimaryColor = 111,
SecondaryColor = 111,
@@ -243,7 +243,7 @@ namespace ReallifeGamemode.Server.Managers
dbContext.ServerVehicles.Add(newVeh);
dbContext.SaveChanges();
newVeh.Spawn();
newVeh.Spawn(null);
}
}