fix jailtime
This commit is contained in:
@@ -48,9 +48,9 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
User cop = copClient.GetUser();
|
User cop = copClient.GetUser();
|
||||||
if (cop?.FactionId == 1 || cop?.FactionId == 3)
|
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))
|
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())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
if (!client.HasData("isDead") || client.GetData("isDead") == false)
|
if (!client.HasData("isDead") || client.GetData("isDead") == false)
|
||||||
@@ -65,30 +65,28 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
dbContext.SaveChanges();
|
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()
|
public static void JailTimer()
|
||||||
|
|||||||
Reference in New Issue
Block a user