From af4e46c04bf12c86726c9ef77610b20f9b62edd9 Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Wed, 30 Oct 2024 10:32:06 -0500 Subject: [PATCH] Added CloseCommand example --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 6afa00a..7091f14 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,15 @@ private void CreateUi(BasePlayer player builder.AddUi(player); //By default the builder will auto destroy the previous UI if it exists on the client } + + +[ConsoleCommand(nameof(CloseCommand))] +private void CloseCommand(ConsoleSystem.Arg arg) +{ + BasePlayer player = arg.Player(); + if (player) + { + UiBuilder.DestroyUi(player, MainUi); + } +} ``` \ No newline at end of file