diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index f60663c6..eac4fce0 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -76,8 +76,6 @@ namespace ReallifeGamemode.Server.Events } } - //JailTime.cs - Jail.Check_PutBehindBars(player); //MEDIC AUFTRAG @@ -95,7 +93,7 @@ namespace ReallifeGamemode.Server.Events Medic.AddTaskToList(reviveTask); //TODO PICTURE NOTIFICATION + SOUND für Medics - + using (var userDeath = new DatabaseContext()) { var dead = new Entities.Logs.Death @@ -115,6 +113,9 @@ namespace ReallifeGamemode.Server.Events userDeath.DeathLogs.Add(dead); userDeath.SaveChanges(); } + //JailTime.cs + Jail.Check_PutBehindBars(player); + } [RemoteEvent("RespawnPlayerAtHospital")] public void RespawnPlayerAtHospital(Client player) diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index cbf9b7da..5d7d8408 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -94,7 +94,7 @@ namespace ReallifeGamemode.Server.Extensions { if (user.Wanteds + amount > 50) { - ChatService.ErrorMessage(cop, "Die Wanteds dürfen ein Limit von 40 nicht überschreiten"); + ChatService.ErrorMessage(cop, "Die Wanteds dürfen ein Limit von 50 nicht überschreiten"); return; } using (var dbContext = new DatabaseContext()) @@ -103,6 +103,19 @@ namespace ReallifeGamemode.Server.Extensions dbUser.Wanteds += amount; dbContext.SaveChanges(); } + foreach(var copPlayer in NAPI.Pools.GetAllPlayers()) + { + User copUser = copPlayer.GetUser(); + if((copUser.FactionId == 1 || copUser.FactionId == 2) && cop != null) + { + ChatService.SendMessage(copPlayer, "~r~HQ: Straftat gemeldet von" + cop + " - " + reason + ". Straftäter: "+ user.Name + "."); + } + else + { + ChatService.SendMessage(copPlayer, "~r~HQ: " + user.Name + " hat eine Straftat begangen - " + reason + "."); + } + } + } public static FactionRank GetFactionRank(this User user) { diff --git a/ReallifeGamemode.Server/Wanted/Autowanted.cs b/ReallifeGamemode.Server/Wanted/Autowanted.cs index 85dfb96c..ac795689 100644 --- a/ReallifeGamemode.Server/Wanted/Autowanted.cs +++ b/ReallifeGamemode.Server/Wanted/Autowanted.cs @@ -13,8 +13,9 @@ namespace ReallifeGamemode.Server.Wanted public static void Check_AutoWanted(Client killerPlayer, Client copPlayer) { User killer = killerPlayer.GetUser(); - if(killer.FactionId != 1 || killer.FactionId != 3) - { + if (killer.FactionId == 1 || killer.FactionId == 3) + return; + User cop = copPlayer.GetUser(); if(cop.FactionId == 1 || cop.FactionId == 3) { @@ -25,7 +26,7 @@ namespace ReallifeGamemode.Server.Wanted dbContext.SaveChanges(); } } - } + } } } diff --git a/ReallifeGamemode.Server/Wanted/Jail.cs b/ReallifeGamemode.Server/Wanted/Jail.cs index 42d7a6f6..31838489 100644 --- a/ReallifeGamemode.Server/Wanted/Jail.cs +++ b/ReallifeGamemode.Server/Wanted/Jail.cs @@ -37,18 +37,20 @@ namespace ReallifeGamemode.Server.Wanted User cop = copClient.GetUser(); if (cop?.FactionId == 1 || cop?.FactionId == 3) { - if (cop.GetData("duty") && copClient.Position.DistanceTo2D(copClient.Position) <= 200) + if (cop.GetData("duty") && copClient.Position.DistanceTo2D(copClient.Position) <= 200 && (!copClient.HasData("isDead") || copClient.GetData("isDead") != true)) { + client.SetData("isDead", false); + client.RemoveAllWeapons(); Random rnd = new Random(); int rndInt = rnd.Next(1, 3); if (rndInt == 1) - client.Position = new Vector3(458.9842, -997.2126, 24.91485); //send client to jail + NAPI.Player.SpawnPlayer(client, new Vector3(458.9842, -997.2126, 24.91485)); //send client to jail if (rndInt == 2) - client.Position = new Vector3(459.696, -994.3766, 24.91486); //send client to jail + NAPI.Player.SpawnPlayer(client, new Vector3(459.696, -994.3766, 24.91486)); //send client to jail if (rndInt == 3) - client.Position = new Vector3(458.3372, -1001.258, 24.91485); //send client to jail - + NAPI.Player.SpawnPlayer(client, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail + using (var dbContext = new DatabaseContext()) { client.GetUser(dbContext).JailTime = user.Wanteds * 54; // 54 sec for each wanted star -> in total 45min for 50 Wanteds @@ -86,7 +88,7 @@ namespace ReallifeGamemode.Server.Wanted foreach (var copPlayer in NAPI.Pools.GetAllPlayers()) { User cop = copPlayer.GetUser(); - if (cop.GetData("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500) + if (cop.GetData("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500 && (!copPlayer.HasData("isDead") || copPlayer.GetData("isDead") != true)) { if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) <= 7) {