even more minor fixes

This commit is contained in:
Lukas Moungos
2019-07-16 23:48:33 +02:00
parent bad89f61cb
commit ada071cc93
2 changed files with 12 additions and 32 deletions

View File

@@ -81,28 +81,28 @@ namespace ReallifeGamemode.Server.Wanted
foreach (var player in NAPI.Pools.GetAllPlayers()) foreach (var player in NAPI.Pools.GetAllPlayers())
{ {
User user = player.GetUser(); User user = player.GetUser();
if (jailtime.ContainsKey(user.Id)) if (!jailtime.ContainsKey(user.Id))
return;
foreach(var copPlayer in NAPI.Pools.GetAllPlayers())
{ {
User cop = copPlayer.GetUser(); foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
if (cop.GetData<bool>("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500)
{ {
if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) <= 7) User cop = copPlayer.GetUser();
if (cop.GetData<bool>("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500)
{ {
if (player.Position.DistanceTo2D(copPlayer.Position) < 5) if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) <= 7)
{ {
Check_PutBehindBars(player); if (player.Position.DistanceTo2D(copPlayer.Position) < 5)
{
Check_PutBehindBars(player);
}
} }
} }
} }
}
}
} }
} }
private static void brakeOut_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private static void brakeOut_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
foreach (var player in NAPI.Pools.GetAllPlayers()) foreach (var player in NAPI.Pools.GetAllPlayers())
@@ -133,26 +133,7 @@ namespace ReallifeGamemode.Server.Wanted
if (user.JailTime <= 0) if (user.JailTime <= 0)
{ {
Random rnd = new Random(); player.Position = new Vector3(461.7256, -988.6035, 24.91487);
int rndInt = rnd.Next(1, 5);
switch (rndInt)
{
case 1:
player.Position = new Vector3(462.0074, -991.5361, 24.91487);
break;
case 2:
player.Position = new Vector3(462.2939, -989.9335, 24.91487);
break;
case 3:
player.Position = new Vector3(461.7256, -988.6035, 24.91487);
break;
case 4:
player.Position = new Vector3(462.5977, -989.9182, 24.91487);
break;
case 5:
player.Position = new Vector3(462.4364, -991.4973, 24.91487);
break;
}
jailtime.Remove(user.Id); jailtime.Remove(user.Id);
return; return;
} }

View File

@@ -38,7 +38,6 @@ namespace ReallifeGamemode.Server.Wanted
waTimer[user.Id] = 300000; waTimer[user.Id] = 300000;
} }
private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
foreach (var player in NAPI.Pools.GetAllPlayers()) foreach (var player in NAPI.Pools.GetAllPlayers())