evtl fix crash bei tot
This commit is contained in:
@@ -27,7 +27,11 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
[ServerEvent(Event.PlayerDeath)]
|
[ServerEvent(Event.PlayerDeath)]
|
||||||
public void OnPlayerDeath(Player player, Player killer, uint reason)
|
public void OnPlayerDeath(Player player, Player killer, uint reason)
|
||||||
{
|
{
|
||||||
if (!player.IsLoggedIn()) player.Kick();
|
if (!player.IsLoggedIn())
|
||||||
|
{
|
||||||
|
player.Kick();
|
||||||
|
return;
|
||||||
|
}
|
||||||
player.SetData("isDead", true);
|
player.SetData("isDead", true);
|
||||||
|
|
||||||
//TODO: Zum Full Release entfernen
|
//TODO: Zum Full Release entfernen
|
||||||
@@ -49,7 +53,12 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
killerId = killer.GetUser().Id;
|
var killerUser = killer.GetUser();
|
||||||
|
if (killerUser == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
killerId = killerUser.Id;
|
||||||
killerPosX = killer.Position.X;
|
killerPosX = killer.Position.X;
|
||||||
killerPosY = killer.Position.Y;
|
killerPosY = killer.Position.Y;
|
||||||
killerPosZ = killer.Position.Z;
|
killerPosZ = killer.Position.Z;
|
||||||
|
|||||||
@@ -9,11 +9,19 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
{
|
{
|
||||||
public static void Check_AutoWanted(Player killerPlayer, Player copPlayer)
|
public static void Check_AutoWanted(Player killerPlayer, Player copPlayer)
|
||||||
{
|
{
|
||||||
User killer = killerPlayer.GetUser();
|
User killer = killerPlayer?.GetUser();
|
||||||
|
if (killer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (killer.FactionId == 1 || killer.FactionId == 3)
|
if (killer.FactionId == 1 || killer.FactionId == 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
User cop = copPlayer.GetUser();
|
User cop = copPlayer?.GetUser();
|
||||||
|
if (cop == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!cop.GetData<bool>("duty")) return;
|
if (!cop.GetData<bool>("duty")) return;
|
||||||
if (cop.FactionId == 1 || cop.FactionId == 3)
|
if (cop.FactionId == 1 || cop.FactionId == 3)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user