knastausbruch im neuen knast
This commit is contained in:
@@ -86,5 +86,13 @@ export default function polygonHandler() {
|
|||||||
mp.events.call('toggleNoDmZone', false);
|
mp.events.call('toggleNoDmZone', false);
|
||||||
isInAnyNoDMPolygon = false;
|
isInAnyNoDMPolygon = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (polygon == polygon_prison) {
|
||||||
|
mp.events.callRemote("SERVER:CheckPlayerInJail");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add('CLIENT:PrisonBreakout', () => {
|
||||||
|
mp.events.callRemote("SERVER:PrisonBreakout");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
timer5000.Start();
|
timer5000.Start();
|
||||||
timer5000.Elapsed += Timer5000_Elapsed;
|
timer5000.Elapsed += Timer5000_Elapsed;
|
||||||
|
|
||||||
timer10000.Start();
|
|
||||||
timer10000.Elapsed += Timer10000_Elapsed;
|
|
||||||
|
|
||||||
timer60000.Start();
|
timer60000.Start();
|
||||||
timer60000.Elapsed += Timer60000_Elapsed;
|
timer60000.Elapsed += Timer60000_Elapsed;
|
||||||
}
|
}
|
||||||
@@ -78,14 +75,6 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Timer10000_Elapsed(object sender, ElapsedEventArgs e)
|
|
||||||
{
|
|
||||||
NAPI.Task.Run(() =>
|
|
||||||
{
|
|
||||||
Jail.BrakeOut_Elapsed();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Timer2500_Elapsed(object sender, ElapsedEventArgs e)
|
private static void Timer2500_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
NAPI.Task.Run(() =>
|
NAPI.Task.Run(() =>
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
int rndInt = rnd.Next(1, 3);
|
int rndInt = rnd.Next(1, 3);
|
||||||
position = prisonCells[rndInt];
|
position = prisonCells[rndInt];
|
||||||
|
|
||||||
} else if (positionInJail == "outside")
|
}
|
||||||
|
else if (positionInJail == "outside")
|
||||||
{
|
{
|
||||||
position = new Vector3(1691.42, 2562.77, 45.56);
|
position = new Vector3(1691.42, 2562.77, 45.56);
|
||||||
}
|
}
|
||||||
@@ -123,27 +124,6 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void BrakeOut_Elapsed()
|
|
||||||
{
|
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
|
||||||
{
|
|
||||||
User user = player.GetUser();
|
|
||||||
|
|
||||||
if (user != null && 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");
|
|
||||||
player.TriggerEvent("jailTime", 0);
|
|
||||||
dbContext.SaveChanges();
|
|
||||||
Jailtime.Remove(user.Id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void JailOut_Elapsed()
|
public static void JailOut_Elapsed()
|
||||||
{
|
{
|
||||||
using var dbContext = new DatabaseContext();
|
using var dbContext = new DatabaseContext();
|
||||||
@@ -227,5 +207,31 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
target.TriggerEvent("jailTime", 0);
|
target.TriggerEvent("jailTime", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("SERVER:PrisonBreakout")]
|
||||||
|
public static void BrakeOut_Elapsed(Player player)
|
||||||
|
{
|
||||||
|
User user = player.GetUser();
|
||||||
|
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
user = player.GetUser(dbContext);
|
||||||
|
user.JailTime = 0;
|
||||||
|
user.GiveWanteds(null, 50, "Knast-Ausbruch");
|
||||||
|
player.TriggerEvent("jailTime", 0);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
Jailtime.Remove(user.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("SERVER:CheckPlayerInJail")]
|
||||||
|
public void checkPlayerInJail(Player player)
|
||||||
|
{
|
||||||
|
User user = player.GetUser();
|
||||||
|
if (Jailtime.ContainsKey(user.Id))
|
||||||
|
{
|
||||||
|
player.TriggerEvent("CLIENT:PrisonBreakout");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user