From 95e424161023cf75f644158d6db6b928a1fa0f4a Mon Sep 17 00:00:00 2001 From: hydrant Date: Sat, 20 Jul 2019 14:15:56 +0200 Subject: [PATCH] fix jailtime --- ReallifeGamemode.Server/Wanted/Jail.cs | 42 ++++++++++++-------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/ReallifeGamemode.Server/Wanted/Jail.cs b/ReallifeGamemode.Server/Wanted/Jail.cs index 2ab0ec17..639559c7 100644 --- a/ReallifeGamemode.Server/Wanted/Jail.cs +++ b/ReallifeGamemode.Server/Wanted/Jail.cs @@ -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("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() {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() { 1, 3 }); } } - } public static void JailTimer()