This commit is contained in:
Lukas Moungos
2019-07-19 22:45:57 +02:00
parent 2a3d97265b
commit adfc6fe8e9
3 changed files with 35 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Factions.Medic;
using ReallifeGamemode.Server.Models;
using ReallifeGamemode.Server.Services;
namespace ReallifeGamemode.Server.Wanted
{
@@ -39,7 +40,7 @@ namespace ReallifeGamemode.Server.Wanted
User cop = copClient.GetUser();
if (cop?.FactionId == 1 || cop?.FactionId == 3)
{
if (cop.GetData<bool>("duty") && copClient.Position.DistanceTo2D(copClient.Position) <= 200 && (!copClient.HasData("isDead") || copClient.GetData("isDead") != true))
if (cop.GetData<bool>("duty") && copClient.Position.DistanceTo2D(client.Position) <= 200 && (!copClient.HasData("isDead") || copClient.GetData("isDead") != true))
{
client.SetData("isDead", false);
client.RemoveAllWeapons();
@@ -160,5 +161,32 @@ namespace ReallifeGamemode.Server.Wanted
}
}
public static void Release_Jail(Client player, string reason)
{
User user = player.GetUser();
if (Jailtime.ContainsKey(user.Id))
{
Jailtime.Remove(user.Id);
using (var dbContext = new DatabaseContext())
{
player.GetUser(dbContext).JailTime = 0;
dbContext.SaveChanges();
}
player.Health = 100;
player.Position = new Vector3(461.7256, -988.6035, 24.91487);
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
{
User copUser = copPlayer.GetUser();
if ((copUser.FactionId == 1 || copUser.FactionId == 3))
{
ChatService.SendMessage(copPlayer, "~r~HQ: Beamter " + copPlayer.Name + " hat " + user.Name + " aus dem Knast entlassen. Grund: " + reason + ".");
}
}
}
}
}
}