diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index e423885c..92134b64 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -355,15 +355,15 @@ namespace ReallifeGamemode.Server.Commands public void CmdFactionMedicHealive(Player player, string receiver, int price = 10) { Player target = PlayerService.GetPlayerByNameOrId(receiver); - if (player.GetUser()?.FactionId != 2) + if(target == null || !target.IsLoggedIn()) { - ChatService.NotAuthorized(player); + ChatService.PlayerNotFound(player); return; } - if (player.Position.DistanceTo(target.Position) > 5) + if (player.GetUser()?.FactionId != 2) { - ChatService.ErrorMessage(player, "Der Patient ist zu weit entfernt"); + ChatService.NotAuthorized(player); return; } @@ -390,6 +390,12 @@ namespace ReallifeGamemode.Server.Commands return; } + if (player.Position.DistanceTo(target.Position) > 5) + { + ChatService.ErrorMessage(player, "Der Patient ist zu weit entfernt"); + return; + } + if (target.Health == 100) { ChatService.ErrorMessage(player, "Der Spieler ist bereits voll geheilt");