add selbsteinknasten

This commit is contained in:
michael.reiswich
2021-05-25 15:28:41 +02:00
parent 9fe9cb1466
commit d58a19033d
3 changed files with 58 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Server.Log;
using ReallifeGamemode.Server.Wanted;
/**
* @overview Life of German Reallife - Event Key (Key.cs)
@@ -241,6 +242,7 @@ namespace ReallifeGamemode.Server.Events
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
AmmunationPoint nearestAmmunationPoint = PositionManager.AmmunationPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
RentcarPoint nearestRentcarPoint = PositionManager.rentcarPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
JailPoint nearestjailPoint = PositionManager.jailPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
if (user?.FactionId != null)
{
@@ -502,8 +504,33 @@ namespace ReallifeGamemode.Server.Events
}
}
//Rentcar Points
if (nearestRentcarPoint != null)
using var dbcontext = new DatabaseContext();
User client = player.GetUser(dbcontext);
if (nearestjailPoint != null)
{
int oStaatsfrak = NAPI.Pools.GetAllPlayers().Where(p => !p.IsAfk() && p.IsLoggedIn() && p.GetUser(dbcontext).FactionId == 1).Count() +
NAPI.Pools.GetAllPlayers().Where(p => !p.IsAfk() && p.IsLoggedIn() && p.GetUser(dbcontext).FactionId == 3).Count();
if(oStaatsfrak > 0)
{
player.SendNotification("~y~[Info]~w~ Es sind genügend Beamte online!");
return;
}
if (client.Wanteds <= 0)
{
player.SendNotification("~y~[Info]~w~ Du wirst nicht gesucht!");
return;
}
client.SetJailTime(true, dbcontext);
Jail.Check_PutBehindBars(client, JailInLocations.Outside);
player.SendNotification("Du hast dich selbst eingeknastet");
ChatService.HQMessage(player.Name + " wurde ins Gefängnis eingeliefert.");
}
//Rentcar Points
if (nearestRentcarPoint != null)
{
if (player.IsInVehicle)
{