CS2ScreenMenuAPI 3.0.9

dotnet add package CS2ScreenMenuAPI --version 3.0.9
                    
NuGet\Install-Package CS2ScreenMenuAPI -Version 3.0.9
                    
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.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CS2ScreenMenuAPI" Version="3.0.9" />
                    
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.9
                    
#r "nuget: CS2ScreenMenuAPI, 3.0.9"
                    
#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.9
                    
Install as a Cake Addin
#tool nuget:?package=CS2ScreenMenuAPI&version=3.0.9
                    
Install 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 = false
ShowPageCount = true
FreezePlayer = true
ShowControlsInfo = false
ScrollPrefix = "\u2023"

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

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

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

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

[Lang.en]
Prev = "Back"
Next = "Next"
Close = "Close"
ScrollKeys ="[{0}/{1}] Scroll"
SelectKey = "[{0}] 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>
 public void Command_Test(CCSPlayerController? player, CommandInfo info)
    {
        if (player == null)
            return;

        var mainMenu = new Menu(player, this) // this the main menu
        {
            Title = "Weapons Menu",
            ShowDisabledOptionNum = true,
        };

        mainMenu.AddItem("Select Pistol", (p, option) => {
            CreatePistolMenu(p, mainMenu); // Create the pistol menu with it's parent.
        });

        mainMenu.AddItem("Select Rifle", (p, option) => {
            CreateRifleMenu(p, mainMenu);
        });

        mainMenu.AddItem("Select SMG", (p, option) => {
            CreateSMGMenu(p, mainMenu);
        });

        mainMenu.AddItem("Select Heavy", (p, option) => {
            CreateHeavyMenu(p, mainMenu);
        });

        mainMenu.AddItem("Refresh Test", (p, o) =>
        {
            CreateVoteMenu(p, mainMenu);
        });

        mainMenu.Display();
    }
    private Menu CreateVoteMenu(CCSPlayerController player, Menu prevMenu)
    {
        Menu voteMenu = new Menu(player, this)
        {
            Title = $"Vote Test | {VoteCount}",
            IsSubMenu = true,
            PrevMenu = prevMenu
        };
        voteMenu.AddItem("Vote", (p, option) =>
        {
            VoteCount++;
            voteMenu.Title = $"Vote Test | {VoteCount}";
            voteMenu.Refresh(); // this will refresh the menu and update the title.
        });
        voteMenu.Display();
        return voteMenu;
    }
    private Menu CreatePistolMenu(CCSPlayerController player, Menu prevMenu)
    {
        Menu pistolMenu = new Menu(player, this)
        {
            Title = "Pistols",
            IsSubMenu = true,
            ShowDisabledOptionNum = true,
            PrevMenu = prevMenu // if prev menu is set when using 7. Back will send you to it.
        };

        foreach (var kvp in Pistols)
        {
            var key = kvp.Key;
            var value = kvp.Value;
            bool shouldBeDisabled = value.Contains("TEC");

            pistolMenu.AddItem(value, (p, option) =>
            {
                player.RemoveWeapons();
                p.PrintToChat($"You got pistol {value}");
                Server.NextFrame(() => p.GiveNamedItem(key));
            }, shouldBeDisabled);
        }

        pistolMenu.Display();
        return pistolMenu;
    }

    private Menu CreateRifleMenu(CCSPlayerController player, Menu prevMenu)
    {
        Menu rifleMenu = new Menu(player, this)
        {
            Title = "Rifles",
            IsSubMenu = true,
            ShowDisabledOptionNum = true,
            PrevMenu = prevMenu
        };

        foreach (var kvp in Rifles)
        {
            var key = kvp.Key;
            var value = kvp.Value;
            bool shouldBeDisabled = value.Contains("SCAR-20");

            rifleMenu.AddItem(value, (p, option) =>
            {
                player.RemoveWeapons();
                p.PrintToChat($"You got rifle {value}");
                Server.NextFrame(() => p.GiveNamedItem(key));
            }, shouldBeDisabled);
        }

        rifleMenu.Display();
        return rifleMenu;
    }

    private Menu CreateSMGMenu(CCSPlayerController player, Menu prevMenu)
    {
        Menu smgMenu = new Menu(player, this)
        {
            Title = "SMGs",
            IsSubMenu = true,
            ShowDisabledOptionNum = true,
            PrevMenu = prevMenu
        };

        foreach (var kvp in SMGs)
        {
            var key = kvp.Key;
            var value = kvp.Value;

            smgMenu.AddItem(value, (p, option) =>
            {
                player.RemoveWeapons();
                p.PrintToChat($"You got SMG {value}");
                Server.NextFrame(() => p.GiveNamedItem(key));
            });
        }

        smgMenu.Display();
        return smgMenu;
    }

    private Menu CreateHeavyMenu(CCSPlayerController player, Menu prevMenu)
    {
        Menu heavyMenu = new Menu(player, this)
        {
            Title = "Heavy Weapons",
            IsSubMenu = true,
            ShowDisabledOptionNum = true,
            PrevMenu = prevMenu
        };

        foreach (var kvp in Heavy)
        {
            var key = kvp.Key;
            var value = kvp.Value;
            bool shouldBeDisabled = value.Contains("Negev");

            heavyMenu.AddItem(value, (p, option) =>
            {
                player.RemoveWeapons();
                p.PrintToChat($"You got heavy weapon {value}");
                Server.NextFrame(() => p.GiveNamedItem(key));
            }, shouldBeDisabled);
        }

        heavyMenu.Display();
        return heavyMenu;
    }
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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.9 0 7/5/2025
3.0.8 125 6/29/2025
3.0.7 149 6/17/2025
3.0.6 131 6/17/2025
3.0.5 254 4/23/2025
3.0.4 376 4/6/2025
3.0.3 195 4/2/2025
3.0.2 502 3/26/2025
3.0.1 266 3/14/2025
3.0.0 187 3/11/2025
2.9.0 192 3/3/2025
2.8.0 126 3/2/2025
2.7.0 104 3/1/2025
2.6.0 380 2/22/2025
2.5.0 106 2/22/2025
2.3.0 106 2/22/2025
2.2.0 128 2/21/2025
2.1.0 119 2/21/2025
2.0.0 124 2/20/2025
1.9.0 114 2/19/2025
1.8.0 133 2/19/2025
1.7.0 110 2/19/2025
1.6.0 121 2/17/2025
1.5.0 126 2/17/2025
1.4.0 106 2/16/2025
1.3.0 112 2/15/2025
1.0.0 115 2/22/2025