diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 460be668..90e92c2e 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -146,7 +146,7 @@ namespace ReallifeGamemode.Server.Events { if (copNearby) { - user.SetJailTime(true); + user.SetJailTime(true, dbContext); Jail.Check_PutBehindBars(user); ChatService.HQMessage(user.Name + " wurde ins Gefängnis eingeliefert."); } diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index 25f9c0a4..18342f10 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -88,7 +88,7 @@ namespace ReallifeGamemode.Server.Extensions player.Armor = armor; } - public static void SetJailTime(this User user, bool killed) + public static void SetJailTime(this User user, bool killed, DatabaseContext dbContext) { if (user == null) { @@ -101,6 +101,13 @@ namespace ReallifeGamemode.Server.Extensions time *= 2; } + int factionMoney = user.Wanteds * 6; + var executiveFactions = dbContext.Factions.Where(f => f.Id == 1 || f.Id == 3); + foreach(var faction in executiveFactions) + { + faction.BankAccount.Balance += factionMoney; + } + user.Wanteds = 0; user.JailTime = time; } diff --git a/ReallifeGamemode.Server/Wanted/Jail.cs b/ReallifeGamemode.Server/Wanted/Jail.cs index bee57db4..745a12e1 100644 --- a/ReallifeGamemode.Server/Wanted/Jail.cs +++ b/ReallifeGamemode.Server/Wanted/Jail.cs @@ -94,7 +94,7 @@ namespace ReallifeGamemode.Server.Wanted { if (player.Position.DistanceTo(copPlayer.Position) < 5) { - user.SetJailTime(false); + user.SetJailTime(false, dbContext); user.SetBlipAndNametagColor(); user.AnnouncePlayerJailedIn(); dbContext.SaveChanges();