diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index e423885c..9dc24c1e 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -234,18 +234,19 @@ namespace ReallifeGamemode.Server.Commands [Command("setweaponrank", "~m~Benutzung: ~s~/setweaponrank [Waffen Name] [Rank]")] public void CmdFactionWeaponRank(Player player, string weaponModel, int rank) { - if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false) + User user = player.GetUser(); + if (user == null || user.FactionId == null || user.FactionLeader == false) { ChatService.NotAuthorized(player); return; } + if (rank > 12 || rank < 1) { ChatService.ErrorMessage(player, "Gebe einen gültigen Rang ein"); return; } - User user = player.GetUser(); WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId); if (nearestWeapon == null) {