Day 254 : Fixes

This commit is contained in:
Lukas Moungos
2019-07-20 15:25:38 +02:00
parent dbb6f49c8b
commit 28e6a461f0
5 changed files with 45 additions and 51 deletions

View File

@@ -83,9 +83,6 @@ namespace ReallifeGamemode.Server.Events
}
//TODO PICTURE NOTIFICATION + SOUND für Medics
}
using (var userDeath = new DatabaseContext())
{
@@ -106,6 +103,11 @@ namespace ReallifeGamemode.Server.Events
userDeath.DeathLogs.Add(dead);
userDeath.SaveChanges();
}
}
//JailTime.cs
Jail.Check_PutBehindBars(player);

View File

@@ -115,12 +115,12 @@ namespace ReallifeGamemode.Server.Extensions
{
ChatService.SendMessage(copPlayer, "~r~HQ: Straftat gemeldet von " + cop.Name + " mit Fahndungslevel "+ amount +". Straftäter: "+ user.Name + ".");
ChatService.SendMessage(copPlayer, "~r~HQ: Grund: " + reason + ".");
ChatService.SendMessage(copPlayer, "~r~HQ: Der Straftäter: " + user.Name + " wird nun mit "+ user.Wanteds +" gesucht.");
ChatService.SendMessage(copPlayer, "~r~HQ: Der Straftäter: " + user.Name + " wird nun mit Fahndungslevel " + newWanteds + " gesucht.");
}
else if((copUser.FactionId == 1 || copUser.FactionId == 3) && cop == null)
{
ChatService.SendMessage(copPlayer, "~r~HQ: " + user.Name + " hat eine Straftat begangen. Grund: " + reason + ".");
ChatService.SendMessage(copPlayer, "~r~HQ: Der Straftäter: " + user.Name + " wird nun mit " + user.Wanteds + " gesucht.");
ChatService.SendMessage(copPlayer, "~r~HQ: Der Straftäter: " + user.Name + " wird nun mit Fahndungslevel " + newWanteds + " gesucht.");
}
}

View File

@@ -21,8 +21,6 @@ namespace ReallifeGamemode.Server.Wanted
User user = client.GetUser();
if (user.JailTime > 0)
{
client.SetData("isDead", false);
client.RemoveAllWeapons();
client.Health = 100;
client.Armor = 0;
@@ -34,12 +32,6 @@ namespace ReallifeGamemode.Server.Wanted
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;
Jailtime[user.Id] = user.JailTime; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
return;
}
@@ -66,9 +58,6 @@ namespace ReallifeGamemode.Server.Wanted
client.GetUser(dbContext).Wanteds = 0;
dbContext.SaveChanges();
}
}
client.SetData("isDead", false);
client.RemoveAllWeapons();
Random rnd = new Random();
@@ -90,6 +79,9 @@ namespace ReallifeGamemode.Server.Wanted
}
}
}
}
public static void JailTimer()
{

View File

@@ -52,7 +52,7 @@ namespace ReallifeGamemode.Server.Wanted
foreach (var playerCop in NAPI.Pools.GetAllPlayers())
{
User cop = playerCop.GetUser();
if (cop.FactionId == 1 || cop.FactionId == 3)
if (cop != null && (cop.FactionId == 1 || cop.FactionId == 3))
{
if (cop.GetData<bool>("duty") && playerCop.Position.DistanceTo2D(player.Position) <= 500)
{