diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index a1d4d914..e20a998e 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -109,7 +109,7 @@ namespace ReallifeGamemode.Server.Extensions public static bool IsAlive(this Player player) { - return !player.HasData("isDead") || (bool)player.GetData("isDead") == false; + return !player.HasData("isDead") || player.GetData("isDead") == false; } public static T GetServerData(this Player player, string key, T defaultValue = default) diff --git a/ReallifeGamemode.Server/Wanted/Jail.cs b/ReallifeGamemode.Server/Wanted/Jail.cs index 12d21685..4a92c263 100644 --- a/ReallifeGamemode.Server/Wanted/Jail.cs +++ b/ReallifeGamemode.Server/Wanted/Jail.cs @@ -81,9 +81,10 @@ namespace ReallifeGamemode.Server.Wanted if (user != null && user.Wanteds > 0 && !Jailtime.ContainsKey(user.Id)) { - foreach (var copPlayer in NAPI.Pools.GetAllPlayers().Where(u => u.IsLoggedIn() && u.IsDuty()) + foreach (var copPlayer in NAPI.Pools.GetAllPlayers().Where(u => u.IsLoggedIn() && u.IsDuty() && u.IsAlive())) { - if (!copPlayer.HasData("isDead") || copPlayer.GetData("isDead") != true) + User copUser = copPlayer.GetUser(dbContext); + if (copUser.FactionId == 1 || copUser.FactionId == 3) { if (player.Position.DistanceTo(copPlayer.Position) < 5) { @@ -91,6 +92,7 @@ namespace ReallifeGamemode.Server.Wanted user.AnnouncePlayerJailedIn(); dbContext.SaveChanges(); Check_PutBehindBars(user); + break; } } }