diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index df0105a5..fd7217f2 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -1797,6 +1797,7 @@ namespace ReallifeGamemode.Server.Commands } Player target; + bool currentStatus = user.GetData("adminUnshow"); if (targetname != null) { @@ -1812,12 +1813,25 @@ namespace ReallifeGamemode.Server.Commands ChatService.ErrorMessage(player, "Du kannst dich nicht selbst spectaten"); return; } + + if (!currentStatus) + { + currentStatus = !currentStatus; + user.SetData("adminUnshow", currentStatus); + } + player.TriggerEvent("toggleAdminUnshowMode", currentStatus); + player.SetData("specPosition", player.Position); + + player.SafeTeleport(target.Position); player.TriggerEvent("SERVER:ADMIN_SPECTATE", target); } else { + currentStatus = !currentStatus; + user.SetData("adminUnshow", currentStatus); player.TriggerEvent("SERVER:ADMIN_STOP_SPECTATE"); + player.SafeTeleport(player.GetData("specPosition")); } }