diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index ceda43a9..88e8b8cf 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -211,7 +211,7 @@ namespace ReallifeGamemode.Server.Commands User targetCop = target.GetUser(); if(targetCop.FactionId == 1 || targetCop.FactionId == 2) { - ChatService.ErrorMessage(player, "Du kannst dieser Person keine Wanteds geben."); + ChatService.ErrorMessage(player, "Du kannst dieser Person keine Wanteds geben"); return; } User targetUser = target.GetUser(); diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index a4ec7bda..f60663c6 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -70,6 +70,7 @@ namespace ReallifeGamemode.Server.Events killerHeading = killer.Heading; if (player != killer) { + Autowanted.Check_AutoWanted(killer, player); string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + NAPI.Player.GetPlayerCurrentWeapon(killer) + ")"; ChatService.BroadcastAdmin(message, AdminLevel.ADMIN); } diff --git a/ReallifeGamemode.Server/Wanted/Autowanted.cs b/ReallifeGamemode.Server/Wanted/Autowanted.cs new file mode 100644 index 00000000..85dfb96c --- /dev/null +++ b/ReallifeGamemode.Server/Wanted/Autowanted.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GTANetworkAPI; +using ReallifeGamemode.Server.Entities; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Models; + +namespace ReallifeGamemode.Server.Wanted +{ + public class Autowanted + { + public static void Check_AutoWanted(Client killerPlayer, Client copPlayer) + { + User killer = killerPlayer.GetUser(); + if(killer.FactionId != 1 || killer.FactionId != 3) + { + User cop = copPlayer.GetUser(); + if(cop.FactionId == 1 || cop.FactionId == 3) + { + using (var dbContext = new DatabaseContext()) + { + killer = killerPlayer.GetUser(dbContext); + killer.GiveWanteds(copPlayer, 10, "Beamten-Mord"); + dbContext.SaveChanges(); + } + } + } + } + } +} diff --git a/ReallifeGamemode.Server/Wanted/Jail.cs b/ReallifeGamemode.Server/Wanted/Jail.cs index d5d9d5c9..42d7a6f6 100644 --- a/ReallifeGamemode.Server/Wanted/Jail.cs +++ b/ReallifeGamemode.Server/Wanted/Jail.cs @@ -112,8 +112,9 @@ namespace ReallifeGamemode.Server.Wanted if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) > 7 && Jailtime.ContainsKey(user.Id)) { using (var dbContext = new DatabaseContext()) - { + { user = player.GetUser(dbContext); + user.JailTime = 0; user.GiveWanteds(null, 50, "Knast-Ausbruch"); dbContext.SaveChanges(); Jailtime.Remove(user.Id);