CS2ScreenMenuAPI 3.0.4

dotnet add package CS2ScreenMenuAPI --version 3.0.4
                    
NuGet\Install-Package CS2ScreenMenuAPI -Version 3.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CS2ScreenMenuAPI" Version="3.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CS2ScreenMenuAPI" Version="3.0.4" />
                    
Directory.Packages.props
<PackageReference Include="CS2ScreenMenuAPI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CS2ScreenMenuAPI --version 3.0.4
                    
#r "nuget: CS2ScreenMenuAPI, 3.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=CS2ScreenMenuAPI&version=3.0.4
                    
Install CS2ScreenMenuAPI as a Cake Addin
#tool nuget:?package=CS2ScreenMenuAPI&version=3.0.4
                    
Install CS2ScreenMenuAPI as a Cake Tool

Config

# Screen Menu Configuration

[Settings]
FontName = "Tahoma Bold"
MenuType = "KeyPress"
Size = 25
PositionX = 0
PositionY = 0
HasExitOption = true
ShowResolutionOption = true
ShowDisabledOptionNum = true
ShowPageCount = true
FreezePlayer = true
ScrollPrefix = "\u2023"

[Settings.Resolutions."1920x1080"]
PositionX = -9.0
PositionY = 0.0

[Settings.Resolutions."1680x1050"]
PositionX = -8.2
PositionY = 0.0

[Settings.Resolutions."1600x900"]
PositionX = -9.0
PositionY = 0.0

[Settings.Resolutions."1440x1080"]
PositionX = -7.0
PositionY = 0.0

[Settings.Resolutions."1280x1080"]
PositionX = -6.0
PositionY = 0.0

[Settings.Resolutions."1280x720"]
PositionX = -9.0
PositionY = 0.0

[Settings.Resolutions."1280x1024"]
PositionX = -6.3
PositionY = 0.0

[Settings.Resolutions."1024x768"]
PositionX = -6.8
PositionY = 0.0

[Settings.Resolutions."800x600"]
PositionX = -7
PositionY = 0.0

[Controls]
ScrollUp = "W"
ScrollDown = "S"
Select = "E"

[Sounds]
Select = "menu.Select"
Next = "menu.Select"
Prev = "menu.Close"
Close = "menu.Close"
Volume = 1.0

[Lang.en]
Prev = "Back"
Next = "Next"
Close = "Close"
ControlInfo ="[{0}/{1}] Scroll\n[{2}] Select"
SelectRes = "Select Your Game Resolution"
ChangeRes = "Change Resolution"

NOTE: The config file creates automaticly when using a menu for the first time ex: !testmenu. It directly updates too so if you change the buttons and info and use !testmenu again it will be changed.

ANOTHER NOTE: When using the API in a plugin you don't need to do anything other than just adding the dll in the project and in the .csproj like this:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="CounterStrikeSharp.API" Version="1.0.305" />
        <Reference Include="CS2ScreenMenuAPI.dll" />
    </ItemGroup>
</Project>
using System.Drawing;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using CS2ScreenMenuAPI;
using static CS2ScreenMenuAPI.MenuType;
using static CS2ScreenMenuAPI.PostSelect;

namespace Example
{
    public class ExampleMenu : BasePlugin
    {
        public override string ModuleAuthor => "T3Marius";
        public override string ModuleName => "TestScrenMenu";
        public override string ModuleVersion => "1.0";

        private int voteCount = 0;

        public override void Load(bool hotReload)
        {

        }
        public Menu TestMenu(CCSPlayerController player)
        {
            if (player == null)
                return;

            var menu = new CS2ScreenMenuAPI.Menu(player, this) // Creating the menu
            {
                Title = "TestMenu",
                ShowDisabledOptionNum = false,
                HasExitButon = true
                PostSelect = PostSelect.Nothing
            };

            menu.AddItem($"Vote Option ({voteCount})", (p, option) =>
            {
                voteCount++;
                p.PrintToChat($"Vote registered! Total votes: {voteCount}");
                
                option.Text = $"Vote Option ({voteCount})";
                menu.Refresh();
            });

            menu.AddItem("Enabled Option", (p, option) =>
            {
                p.PrintToChat("This is an enabled option!");
            });
            
            menu.AddItem("Disabled Option", (p, option) => { }, true);
            
            menu.AddItem("Another Enabled Option", (p, option) =>
            {
                p.PrintToChat("This is another enabled option!");
            });

            menu.Display(); // Display the main menu
            return menu
        }
        private void CreateSubMenu(CCSPlayerController player, Menu prevMenu)
        {
            Menu subMenu = new (player, this)
            {
                IsSubMenu = true,
                PrevMenu = TestMenu // when you hit 7. Back it will send you to the TestMenu
            };

            subMenu.AddItem("SubOption 1", (p, o) =>
            {
                p.PrintToChat("SubOption 1!");
            });
               
            subMenu.Display();
        }
    }
}
using System.Drawing;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using CS2ScreenMenuAPI;
using CS2ScreenMenuAPI.Enums;

namespace Example
{
    public class ExampleMenu : BasePlugin
    {
        public override string ModuleAuthor => "T3Marius";
        public override string ModuleName => "TestScrenMenu";
        public override string ModuleVersion => "1.0";
        public override void Load(bool hotReload)
        {

        }

        [ConsoleCommand("css_menu_types")]
        public void OnMenuTypes(CCSPlayerController player, CommandInfo info)
        {
            if (player == null)
                return;

            // KeyPress menu example
            var keyPressMenu = new CS2ScreenMenuAPI.Menu(player, this)
            {
                Title = "Only key press menu",
                MenuType = MenuType.KeyPress,
                HasExitButon = true
            };
            
            keyPressMenu.AddItem("Key Press Option", (p, option) => 
            {
                p.PrintToChat("Selected from key press menu!");
            });
            
            // Uncomment to display this menu
            // keyPressMenu.Display();

            // Scroll menu example
            var scrollMenu = new CS2ScreenMenuAPI.Menu(player, this)
            {
                Title = "Only Scroll menu",
                MenuType = MenuType.Scrollable,
                HasExitButon = true
            };
            
            scrollMenu.AddItem("Scroll Option", (p, option) => 
            {
                p.PrintToChat("Selected from scroll menu!");
            });
            
            // Uncomment to display this menu
            // scrollMenu.Display();

            // Both types menu example (default)
            var bothTypesMenu = new CS2ScreenMenuAPI.Menu(player, this)
            {
                Title = "Menu with both key press and scrollable",
                MenuType = MenuType.Both, // This is the default, so it's optional
                HasExitButon = true
            };
            
            bothTypesMenu.AddItem("Option works with both", (p, option) => 
            {
                p.PrintToChat("Selected from menu supporting both input types!");
            });
            
            bothTypesMenu.Display();
        }
}

You can use this API in your project by installing it from Manage NuGet Packages or add it with this command

dotnet add package CS2ScreenMenuAPI
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.4 39 4/6/2025
3.0.3 134 4/2/2025
3.0.2 481 3/26/2025
3.0.1 235 3/14/2025
3.0.0 172 3/11/2025
2.9.0 169 3/3/2025
2.8.0 115 3/2/2025
2.7.0 87 3/1/2025
2.6.0 231 2/22/2025
2.5.0 87 2/22/2025
2.3.0 91 2/22/2025
2.2.0 117 2/21/2025
2.1.0 103 2/21/2025
2.0.0 107 2/20/2025
1.9.0 99 2/19/2025
1.8.0 116 2/19/2025
1.7.0 94 2/19/2025
1.6.0 106 2/17/2025
1.5.0 108 2/17/2025
1.4.0 91 2/16/2025
1.3.0 94 2/15/2025
1.0.0 91 2/22/2025