diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 0f30a33b..489658ee 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -686,23 +686,33 @@ namespace ReallifeGamemode.Server.Commands else player.SafeTeleport(player.GetData("mark")); } - [Command("flip", "")] + [Command("flip", "~m~Benutzung:~s~ /flip")] public void CmdAdminFlip(Player player) { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) { ChatService.NotAuthorized(player); return; } + Vehicle vehToFlip = null; + if (player.IsInVehicle) { - player.Vehicle.Rotation = new Vector3(0.0, 0.0, player.Vehicle.Rotation.Z); + vehToFlip = player.Vehicle; } else { - player.SendChatMessage("~r~Du befindest dich in keinem Fahrzeug!"); + vehToFlip = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).OrderBy(v => v.Position.DistanceTo(player.Position)).FirstOrDefault(); } + + if (vehToFlip == null) + { + ChatService.ErrorMessage(player, "Es wurde kein Fahrzeug zum Flippen gefunden"); + return; + } + + vehToFlip.Rotation = new Vector3(0, 0, vehToFlip.Rotation.Z); } [Command("up", "~m~Benutzung: ~s~/up [Wert]")]