neuer knast: punkte geändert
This commit is contained in:
@@ -148,7 +148,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (copNearby)
|
||||
{
|
||||
user.SetJailTime(true, dbContext);
|
||||
Jail.Check_PutBehindBars(user);
|
||||
Jail.Check_PutBehindBars(user, "cell");
|
||||
ChatService.HQMessage(user.Name + " wurde ins Gefängnis eingeliefert.");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
@@ -164,7 +164,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
else
|
||||
{
|
||||
Jail.Check_PutBehindBars(user);
|
||||
Jail.Check_PutBehindBars(user, "cell");
|
||||
}
|
||||
|
||||
player.Dimension = 0;
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace ReallifeGamemode.Server.Finance
|
||||
|
||||
if (putInJail != 0 && minusJail)
|
||||
{
|
||||
Jail.Check_PutBehindBars(u);
|
||||
Jail.Check_PutBehindBars(u, "cell");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,18 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
{
|
||||
private static Dictionary<int, int> Jailtime { get; set; } = new Dictionary<int, int>(); //time in seconds
|
||||
|
||||
public static void Check_PutBehindBars(User user)
|
||||
private static Vector3 JailIn_Point = new Vector3(1690.754, 2591.0464, 45.914402);
|
||||
private static int JailIn_Range = 3;
|
||||
private static Vector3 JailOut_Point = new Vector3(1848.3097, 2585.9036, 45.67201);
|
||||
|
||||
private static List<Vector3> prisonCells = new List<Vector3>() {
|
||||
new Vector3(1629.2026, 2569.8057, 45.564846),
|
||||
new Vector3(1642.7831, 2570.2622, 45.56483),
|
||||
new Vector3(1651.512, 2570.2249, 45.564907)
|
||||
};
|
||||
|
||||
//positionInJail: ENTWEDER "cell" ODER "outside"
|
||||
public static void Check_PutBehindBars(User user, String positionInJail)
|
||||
{
|
||||
user.SetBlipAndNametagColor();
|
||||
Player player = user.Player;
|
||||
@@ -31,15 +42,19 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
player.ClearAnimation();
|
||||
player.SafeSetHealth(100);
|
||||
player.Armor = 0;
|
||||
|
||||
Vector3 position = null;
|
||||
|
||||
if (positionInJail == "cell")
|
||||
{
|
||||
Random rnd = new Random();
|
||||
int rndInt = rnd.Next(1, 3);
|
||||
Vector3 position = new Vector3();
|
||||
if (rndInt == 1)
|
||||
position = new Vector3(458.9842, -997.2126, 24.91485); //send client to jail
|
||||
if (rndInt == 2)
|
||||
position = new Vector3(459.696, -994.3766, 24.91486); //send client to jail
|
||||
if (rndInt == 3)
|
||||
position = new Vector3(458.3372, -1001.258, 24.91485); //send client to jail
|
||||
position = prisonCells[rndInt];
|
||||
|
||||
} else if (positionInJail == "outside")
|
||||
{
|
||||
position = new Vector3(1691.42, 2562.77, 45.56);
|
||||
}
|
||||
|
||||
player.SafeTeleport(position, 0, true);
|
||||
|
||||
@@ -78,7 +93,7 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
using var dbContext = new DatabaseContext();
|
||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
if (player.Position.DistanceTo(new Vector3(458.9842, -997.2126, 24.91485)) > 7)
|
||||
if (player.Position.DistanceTo(JailIn_Point) > JailIn_Range)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -98,7 +113,8 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
user.SetBlipAndNametagColor();
|
||||
user.AnnouncePlayerJailedIn();
|
||||
dbContext.SaveChanges();
|
||||
Check_PutBehindBars(user);
|
||||
//HERE: Freilauf
|
||||
Check_PutBehindBars(user, "outside");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +155,7 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
if (user.JailTime <= 0)
|
||||
{
|
||||
Jailtime.Remove(user.Id);
|
||||
player.SafeTeleport(new Vector3(427.879, -984.65, 30.71));
|
||||
player.SafeTeleport(JailOut_Point);
|
||||
player.TriggerEvent("jailTime", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user