CS2ScreenMenuAPI 3.0.2

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

Config

{
    /* 
        Menu configuration file.
        Adjust your button settings and display texts as needed.
    */
    "Buttons": {
        "ScrollUpButton": "W",
        "ScrollDownButton": "S",
        "SelectButton": "E"
    },
    "DefaultSettings": {
        "MenuType": "Both",
        "TextColor": "Orange",
        "PositionX": -5.5,
        "PositionY": 0,
        "Background": true,
        "BackgroundHeight": 0,
        "BackgroundWidth": 0.2,
        "Font": "Arial Bold",
        "Size": 32,
        "Spacing": true
    },
    "Translations": {
        "NextButton": "Next",
        "BackButton": "Back",
        "ExitButton": "Exit",
        "DisabledOption": "(Disabled)",
        "ScrollInfo": "[W/S] Scroll",
        "SelectInfo": "[E] Select",
        "SelectPrefix": "‣ "
    }
    /* 
        Buttons mapping:
        
        Alt1       - Alt1
        Alt2       - Alt2
        Attack     - Attack
        Attack2    - Attack2
        Attack3    - Attack3
        Bullrush   - Bullrush
        Cancel     - Cancel
        Duck       - Duck
        Grenade1   - Grenade1
        Grenade2   - Grenade2
        Space      - Jump
        Left       - Left
        W          - Forward
        A          - Moveleft
        S          - Back
        D          - Moveright
        E          - Use
        R          - Reload
        F          - (Custom) 0x800000000
        Shift      - Speed
        Right      - Right
        Run        - Run
        Walk       - Walk
        Weapon1    - Weapon1
        Weapon2    - Weapon2
        Zoom       - Zoom
        Tab        - (Custom) 8589934592
    */
}

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 CS2ScreenMenuAPI.Enums;

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)
        {

        }

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

            ScreenMenu menu = new ScreenMenu("Test menu", this) // Creating the menu
            {
                PostSelectAction = PostSelectAction.Nothing,
                IsSubMenu = false, // this is not a sub menu
                TextColor = Color.DarkOrange, // if this not set it will be the API default color
                FontName = "Verdana Bold",
            };

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

                MenuAPI.GetActiveMenu(p)?.Display(); // with this you can directly change the menu and update vote counts
            });

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

            menu.AddOption("SubMenu", (p, option) =>
            {
                ScreenMenu subMenu = new ScreenMenu("SubMenu Title", this) // creating SubMenu
                {
                    IsSubMenu = true, // this is a sub menu
                    PostSelectAction = PostSelectAction.Nothing,
                    TextColor = Color.Blue, // You can use different colors for SubMenus if you want.
                    ParentMenu = menu, // always parent the sub menu to its main menu
                    FontName = "Verdana Bold"
                };
                subMenu.AddOption("SubOption 1", (p, option) =>
                {
                    p.PrintToChat("SubOption 1!");
                });

                MenuAPI.OpenSubMenu(this, p, subMenu); // open the SubMenu
            });

            MenuAPI.OpenMenu(this, player, menu); // open the MainMenu
        }
    }
}
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_testmenu")]
        public void OnTestMenu(CCSPlayerController player, CommandInfo info)
        {
            if (player == null)
                return;

            ScreenMenu menu = new ScreenMenu("Only key press menu", this) // Creating the menu
            {
                PostSelectAction = PostSelectAction.Nothing,
                IsSubMenu = false, // this is not a sub menu
                TextColor = Color.DarkOrange, // if this not set it will be the API default color
                FontName = "Verdana Bold",
                MenuType = MenuType.KeyPress,
            };
            ScreenMenu menu = new ScreenMenu("Only Scroll menu", this) // Creating the menu
            {
                PostSelectAction = PostSelectAction.Nothing,
                IsSubMenu = false, // this is not a sub menu
                TextColor = Color.DarkOrange, // if this not set it will be the API default color
                FontName = "Verdana Bold",
                MenuType = MenuType.Scrollable,
            };
            ScreenMenu menu = new ScreenMenu("Menu with both key press and scrollable", this) // Creating the menu
            {
                PostSelectAction = PostSelectAction.Nothing,
                IsSubMenu = false, // this is not a sub menu
                TextColor = Color.DarkOrange, // if this not set it will be the API default color
                FontName = "Verdana Bold",
                MenuType = MenuType.Both, // IF you wanna use both types you don't need to add this since default value is using Both Types.
            };
    }
}

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

TODO List

  • Allowing spectators to use the menu
  • Allowing dead players to use the menu
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.2 468 3/26/2025
3.0.1 225 3/14/2025
3.0.0 169 3/11/2025
2.9.0 166 3/3/2025
2.8.0 112 3/2/2025
2.7.0 83 3/1/2025
2.6.0 208 2/22/2025
2.5.0 84 2/22/2025
2.3.0 88 2/22/2025
2.2.0 114 2/21/2025
2.1.0 100 2/21/2025
2.0.0 104 2/20/2025
1.9.0 96 2/19/2025
1.8.0 113 2/19/2025
1.7.0 91 2/19/2025
1.6.0 103 2/17/2025
1.5.0 105 2/17/2025
1.4.0 88 2/16/2025
1.3.0 91 2/15/2025
1.0.0 88 2/22/2025