This commit is contained in:
VegaZ
2021-05-05 00:03:30 +02:00
parent f860c2c2fe
commit 11b10ccadf

View File

@@ -1797,6 +1797,7 @@ namespace ReallifeGamemode.Server.Commands
}
Player target;
bool currentStatus = user.GetData<bool>("adminUnshow");
if (targetname != null)
{
@@ -1813,11 +1814,24 @@ namespace ReallifeGamemode.Server.Commands
return;
}
if (!currentStatus)
{
currentStatus = !currentStatus;
user.SetData("adminUnshow", currentStatus);
}
player.TriggerEvent("toggleAdminUnshowMode", currentStatus);
player.SetData<Vector3>("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<Vector3>("specPosition"));
}
}