From 11b10ccadfb8559b8d5c3b6ea6628189146ee3d8 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Wed, 5 May 2021 00:03:30 +0200 Subject: [PATCH] Fix Spec --- ReallifeGamemode.Server/Commands/AdminCommands.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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")); } }