Skip to content

Commit e823436

Browse files
authored
updated: readme
1 parent 6454ab6 commit e823436

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,32 @@ namespace Example
239239
}
240240
```
241241

242+
# Storing items and spacers to change them later:
243+
```c#
244+
[ConsoleCommand("css_menuspacer")]
245+
public void MenuSpacer(CCSPlayerController player, CommandInfo info)
246+
{
247+
if (player == null)
248+
return;
249+
250+
Menu menu = new Menu(this)
251+
{
252+
Title = "Test Spacer Menu"
253+
};
254+
255+
var spacer1 = menu.AddSpacer("Spacer Test"); // we store this in a variable
256+
menu.AddItem("Change Spacer Text", (p, o) =>
257+
{
258+
spacer1.Text = "Changed Spacer Text"; // then just change the text here then refresh.
259+
p.PrintToChat("Spacer text changed!");
260+
261+
menu.Refresh();
262+
});
263+
264+
menu.Display(player);
265+
}
266+
```
267+
242268
You can use this API in your project by installing it from Manage NuGet Packages or add it with this command
243269
```cmd
244270
dotnet add package CS2ScreenMenuAPI

0 commit comments

Comments
 (0)