fix jailtime

This commit is contained in:
hydrant
2019-07-20 14:15:56 +02:00
parent 0a3efd8f63
commit 95e4241610

View File

@@ -48,9 +48,9 @@ namespace ReallifeGamemode.Server.Wanted
User cop = copClient.GetUser();
if (cop?.FactionId == 1 || cop?.FactionId == 3)
{
int jailTime = user.Wanteds * 54;
if (cop.GetData<bool>("duty") && copClient.Position.DistanceTo2D(client.Position) <= 200 && (!copClient.HasData("isDead") || copClient.GetData("isDead") != true))
{
int jailTime = user.Wanteds * 54; ;
using (var dbContext = new DatabaseContext())
{
if (!client.HasData("isDead") || client.GetData("isDead") == false)
@@ -65,30 +65,28 @@ namespace ReallifeGamemode.Server.Wanted
dbContext.SaveChanges();
}
}
client.SetData("isDead", false);
client.RemoveAllWeapons();
Random rnd = new Random();
int rndInt = rnd.Next(1, 3);
if (rndInt == 1)
NAPI.Player.SpawnPlayer(client, new Vector3(458.9842, -997.2126, 24.91485)); //send client to jail
if (rndInt == 2)
NAPI.Player.SpawnPlayer(client, new Vector3(459.696, -994.3766, 24.91486)); //send client to jail
if (rndInt == 3)
NAPI.Player.SpawnPlayer(client, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail
client.TriggerEvent("onPlayerRevived");
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == client.Name);
Medic.RemoveTaskFromList(task);
client.Health = 100;
ChatService.SendMessage(client, "Du bist im Gefängnis für " + jailTime + " Sekunden.");
ChatService.BroadcastFaction("~r~HQ: " + user.Name + " wurde ins Gefängnis geliefert.", new List<int>() {1,3});
}
client.SetData("isDead", false);
client.RemoveAllWeapons();
Random rnd = new Random();
int rndInt = rnd.Next(1, 3);
if (rndInt == 1)
NAPI.Player.SpawnPlayer(client, new Vector3(458.9842, -997.2126, 24.91485)); //send client to jail
if (rndInt == 2)
NAPI.Player.SpawnPlayer(client, new Vector3(459.696, -994.3766, 24.91486)); //send client to jail
if (rndInt == 3)
NAPI.Player.SpawnPlayer(client, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail
client.TriggerEvent("onPlayerRevived");
MedicTask task = Medic.ReviveTasks.FirstOrDefault(t => t.Victim == client.Name);
Medic.RemoveTaskFromList(task);
client.Health = 100;
ChatService.SendMessage(client, "Du bist im Gefängnis für " + jailTime + " Sekunden.");
ChatService.BroadcastFaction("~r~HQ: " + user.Name + " wurde ins Gefängnis geliefert.", new List<int>() { 1, 3 });
}
}
}
public static void JailTimer()