Files
2021-04-08 23:58:28 +02:00

38 lines
927 B
C#

using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
namespace ReallifeGamemode.Server.Wanted
{
public class Autowanted
{
public static void Check_AutoWanted(Player killerPlayer, Player copPlayer)
{
User killer = killerPlayer?.GetUser();
if (killer == null)
{
return;
}
if (killer.FactionId == 1 || killer.FactionId == 3)
return;
User cop = copPlayer?.GetUser();
if (cop == null)
{
return;
}
if (!cop.GetData<bool>("duty")) return;
if (cop.FactionId == 1 || cop.FactionId == 3)
{
using (var dbContext = new DatabaseContext())
{
killer = killerPlayer.GetUser(dbContext);
killer.GiveWanteds(copPlayer, 14, "Beamten-Mord");
dbContext.SaveChanges();
}
}
}
}
}