[*] Fix Autojail on death.

+ Added HQ message for wanteds
This commit is contained in:
Lukas Moungos
2019-07-19 21:23:58 +02:00
parent 80a04a2ee4
commit 409a8bc52a
4 changed files with 30 additions and 13 deletions

View File

@@ -76,8 +76,6 @@ namespace ReallifeGamemode.Server.Events
} }
} }
//JailTime.cs
Jail.Check_PutBehindBars(player);
//MEDIC AUFTRAG //MEDIC AUFTRAG
@@ -115,6 +113,9 @@ namespace ReallifeGamemode.Server.Events
userDeath.DeathLogs.Add(dead); userDeath.DeathLogs.Add(dead);
userDeath.SaveChanges(); userDeath.SaveChanges();
} }
//JailTime.cs
Jail.Check_PutBehindBars(player);
} }
[RemoteEvent("RespawnPlayerAtHospital")] [RemoteEvent("RespawnPlayerAtHospital")]
public void RespawnPlayerAtHospital(Client player) public void RespawnPlayerAtHospital(Client player)

View File

@@ -94,7 +94,7 @@ namespace ReallifeGamemode.Server.Extensions
{ {
if (user.Wanteds + amount > 50) if (user.Wanteds + amount > 50)
{ {
ChatService.ErrorMessage(cop, "Die Wanteds dürfen ein Limit von 40 nicht überschreiten"); ChatService.ErrorMessage(cop, "Die Wanteds dürfen ein Limit von 50 nicht überschreiten");
return; return;
} }
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
@@ -103,6 +103,19 @@ namespace ReallifeGamemode.Server.Extensions
dbUser.Wanteds += amount; dbUser.Wanteds += amount;
dbContext.SaveChanges(); dbContext.SaveChanges();
} }
foreach(var copPlayer in NAPI.Pools.GetAllPlayers())
{
User copUser = copPlayer.GetUser();
if((copUser.FactionId == 1 || copUser.FactionId == 2) && cop != null)
{
ChatService.SendMessage(copPlayer, "~r~HQ: Straftat gemeldet von" + cop + " - " + reason + ". Straftäter: "+ user.Name + ".");
}
else
{
ChatService.SendMessage(copPlayer, "~r~HQ: " + user.Name + " hat eine Straftat begangen - " + reason + ".");
}
}
} }
public static FactionRank GetFactionRank(this User user) public static FactionRank GetFactionRank(this User user)
{ {

View File

@@ -13,8 +13,9 @@ namespace ReallifeGamemode.Server.Wanted
public static void Check_AutoWanted(Client killerPlayer, Client copPlayer) public static void Check_AutoWanted(Client killerPlayer, Client copPlayer)
{ {
User killer = killerPlayer.GetUser(); User killer = killerPlayer.GetUser();
if(killer.FactionId != 1 || killer.FactionId != 3) if (killer.FactionId == 1 || killer.FactionId == 3)
{ return;
User cop = copPlayer.GetUser(); User cop = copPlayer.GetUser();
if(cop.FactionId == 1 || cop.FactionId == 3) if(cop.FactionId == 1 || cop.FactionId == 3)
{ {
@@ -25,7 +26,7 @@ namespace ReallifeGamemode.Server.Wanted
dbContext.SaveChanges(); dbContext.SaveChanges();
} }
} }
}
} }
} }
} }

View File

@@ -37,16 +37,18 @@ 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)
{ {
if (cop.GetData<bool>("duty") && copClient.Position.DistanceTo2D(copClient.Position) <= 200) if (cop.GetData<bool>("duty") && copClient.Position.DistanceTo2D(copClient.Position) <= 200 && (!copClient.HasData("isDead") || copClient.GetData("isDead") != true))
{ {
client.SetData("isDead", false);
client.RemoveAllWeapons();
Random rnd = new Random(); Random rnd = new Random();
int rndInt = rnd.Next(1, 3); int rndInt = rnd.Next(1, 3);
if (rndInt == 1) if (rndInt == 1)
client.Position = new Vector3(458.9842, -997.2126, 24.91485); //send client to jail NAPI.Player.SpawnPlayer(client, new Vector3(458.9842, -997.2126, 24.91485)); //send client to jail
if (rndInt == 2) if (rndInt == 2)
client.Position = new Vector3(459.696, -994.3766, 24.91486); //send client to jail NAPI.Player.SpawnPlayer(client, new Vector3(459.696, -994.3766, 24.91486)); //send client to jail
if (rndInt == 3) if (rndInt == 3)
client.Position = new Vector3(458.3372, -1001.258, 24.91485); //send client to jail NAPI.Player.SpawnPlayer(client, new Vector3(458.3372, -1001.258, 24.91485)); //send client to jail
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
@@ -86,7 +88,7 @@ namespace ReallifeGamemode.Server.Wanted
foreach (var copPlayer in NAPI.Pools.GetAllPlayers()) foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
{ {
User cop = copPlayer.GetUser(); User cop = copPlayer.GetUser();
if (cop.GetData<bool>("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500) if (cop.GetData<bool>("duty") && copPlayer.Position.DistanceTo2D(player.Position) <= 500 && (!copPlayer.HasData("isDead") || copPlayer.GetData("isDead") != true))
{ {
if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) <= 7) if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) <= 7)
{ {