Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To make a Counter-Strike 2 server plugin with CounterStrikeSharp, install Metamod:Source first, add CounterStrikeSharp with its runtime, create a .NET 8 class-library project, reference CounterStrikeSharp.API, derive a class from BasePlugin, build a DLL, and place that DLL in the matching CounterStrikeSharp plugins folder. Verify the installation with meta list before debugging your own code.

What CounterStrikeSharp does

CounterStrikeSharp is a server-side framework that lets you write Counter-Strike 2 (CS2, Source 2) plugins in C#. Its project description calls it a “.NET 8 scripting layer on top of a Metamod Source Plugin.” In practical terms, your code runs on the dedicated server through Metamod:Source rather than as a client mod or a loose script file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A plugin can expose server console commands, player-facing chat commands, game-event handlers, lifecycle listeners, fake console variables (ConVars), and access to basic event values. The framework’s examples also show larger designs that combine events, commands, SQLite storage, and entity manipulation. That range lets you start with a stateless command and grow into a persistent gameplay system without changing frameworks.

What you need before writing code

  • A running vanilla CS2 dedicated server.
  • Metamod:Source 2.x development build 1467 or newer, with KHook support.
  • CounterStrikeSharp downloaded with its runtime.
  • The .NET 8 SDK on the machine where you build the plugin.
  • Access to the server files so you can edit gameinfo.gi and copy plugin files.

Metamod:Source and CounterStrikeSharp are both required for the documented vanilla-server setup. CounterStrikeSharp is not a replacement for Metamod; it loads through it.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Install Metamod:Source and CounterStrikeSharp

1. Add Metamod:Source to the game directory

  1. Stop the dedicated server before changing its files.
  2. Extract the Metamod:Source 2.x development build (build 1467 or newer with KHook support).
  3. Copy the extracted /addons/ directory into the server’s /game/csgo/ directory. Merge directories if the destination already contains other add-ons.
  4. Open /game/csgo/gameinfo.gi. Add Game csgo/addons/metamod immediately below the Game_LowViolence csgo_lv entry, following the formatting already used in that file.
  5. Save the file and restart the server.

The gameinfo.gi entry is what tells the game to load Metamod at startup. If it is missing or placed incorrectly, CounterStrikeSharp cannot load regardless of whether its files are present.

2. Add CounterStrikeSharp with runtime

  1. Download the CounterStrikeSharp package that includes the runtime.
  2. Extract it and copy its /addons/ directory into the same /game/csgo/ directory used for Metamod.
  3. Start or restart the server.
  4. In the server console, run meta list.

meta list is the first documented verification step. It should show Metamod and CounterStrikeSharp as loaded. Resolve this foundation before troubleshooting a plugin DLL; a plugin cannot load if the framework itself is absent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Updating the installation

When updating, download the latest release and copy it over the existing server installation. Stop the server first, preserve any local configuration, replace the framework files, then restart and run meta list again. Re-check plugins after an update because API or game changes can require a rebuild.

Create a first plugin project

1. Generate a .NET class library

Install the .NET 8 SDK, open a terminal in your development workspace, and create a class-library project:

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
dotnet new classlib --name HelloWorldPlugin
cd HelloWorldPlugin

This creates a normal .NET library project. CounterStrikeSharp plugins are compiled assemblies, not source files copied into a server folder.

2. Add the CounterStrikeSharp API

You can reference the CounterStrikeSharp.API.dll installed with your server files, or add the package from the command line:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
dotnet add package CounterStrikeSharp.API

Use one consistent API version for the project and the server. If you reference a local DLL, set its path in the project file and keep that reference available to every developer or build machine.

3. Replace the default class

Rename the generated class and derive it from BasePlugin. The plugin metadata properties identify the module in logs and administration tools. A minimal command-and-event skeleton looks like this:

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Events;

public class HelloWorldPlugin : BasePlugin
{
    public override string ModuleName => "Hello World Plugin";
    public override string ModuleVersion => "1.0.0";
    public override string ModuleAuthor => "Your name";
    public override string ModuleDescription => "A starter CounterStrikeSharp plugin";

    public override void Load(bool hotReload)
    {
        // Put startup registration here.
    }

    [ConsoleCommand("css_hello", "Print a greeting")]
    public void OnHello(CCSPlayerController? player, CommandInfo command)
    {
        player?.PrintToChat("Hello from CounterStrikeSharp");
    }

    [GameEventHandler]
    public HookResult OnPlayerConnect(EventPlayerConnect @event, GameEventInfo info)
    {
        return HookResult.Continue;
    }
}

The command attribute creates a server command named css_hello; the event attribute registers a handler for the player-connect game event. Keep the first version small: prove that the module loads, the command is recognized, and the event reaches your method before adding gameplay state.

4. Build the assembly

Compile the project with:

dotnet build

The build produces a DLL in the project’s build output. Use the exact filename emitted by the build when preparing the server directory. Resolve compiler errors locally; the server can only load a successfully built .NET assembly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deploy the DLL to the server

  1. Under /game/csgo/addons/counterstrikesharp/plugins, create a subfolder whose name matches the DLL filename. For HelloWorldPlugin.dll, use HelloWorldPlugin.
  2. Copy HelloWorldPlugin.dll into that folder.
  3. If the plugin uses another library, copy that dependency into the same plugin directory as documented by the dependency.
  4. Start or restart the server and inspect the server console and logs.

Keep the DLL and its dependency files together. A correct build in the wrong directory is indistinguishable from a missing plugin to the loader, so check spelling, capitalization, and the nested folder path first.

Choose the right CounterStrikeSharp trigger

CounterStrikeSharp exposes several trigger surfaces. Select the one that matches how the feature should begin, rather than polling continuously.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
Trigger Best fit Typical scope State and engine access
Console command Administrative actions Server operators and automation Usually stateless; can call server-side APIs
Chat command using ! or / Player shortcuts In-match interaction Often stateless, with the issuing player as context
Game-event handler Events such as player_death or player connection Reactive automation Reads event values supplied by the engine
Lifecycle listener Client connect/disconnect and map start Setup, cleanup, and round or map orchestration Useful for maintaining in-memory state across lifecycle points

Fake ConVars provide server-tunable settings without requiring a native engine variable. Basic event-value access is enough for many notifications and counters; deeper gameplay systems can use entity manipulation, but that increases coupling to the game and to API changes.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Design decisions before you expand the plugin

Stateless logic versus persistence

A warning command, chat response, or event notification can keep all its logic in memory and reload cleanly. Statistics, player unlocks, or long-lived configuration need persistence. The project’s Warcraft example demonstrates SQLite alongside commands and events, which is a practical model for a plugin that must survive restarts. Treat database schema, migrations, and failure handling as part of the plugin rather than an afterthought.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Event data versus entity manipulation

Start with event data when you only need to react to what happened. Move to entity manipulation when the feature must create, modify, or control game entities. Entity-level code has a larger maintenance surface: game updates and API changes can affect handles, fields, and valid lifecycle timing.

One DLL versus dependencies

A small plugin may deploy as one DLL in one plugin directory. Adding a third-party library or SQLite creates additional files and version-compatibility concerns. Keep every required dependency beside the plugin DLL and document the versions used to build it.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Verify and troubleshoot a first plugin

Metamod or CounterStrikeSharp does not appear

  • Run meta list in the server console.
  • Confirm the Metamod /addons/ directory was copied into /game/csgo/, not into a parent directory.
  • Check that gameinfo.gi contains Game csgo/addons/metamod directly below Game_LowViolence csgo_lv.
  • Confirm the installed Metamod build is 1467 or newer and includes KHook support.
  • Restart the server after correcting files.

The framework loads but the plugin does not

  • Verify the DLL is under /game/csgo/addons/counterstrikesharp/plugins.
  • Verify the subfolder name matches the DLL filename and that the DLL was produced by a successful .NET 8 build.
  • Copy every required dependency into that same plugin folder.
  • Read the server console and logs for assembly-load or dependency errors.

The command is missing

Confirm the command attribute is present, the command begins with the intended css_ name, and the plugin loaded without errors. Restart after replacing the DLL so the server is not running an older assembly.

The event handler never runs

Check that the method has the GameEventHandler attribute and the event type matches the event you expect. Test with a known event such as player connection, then inspect logs or add a visible server-side response. For lifecycle behavior, use the appropriate client or map listener rather than waiting for a game event that is never emitted for that transition.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An update breaks the plugin

Rebuild against the updated CounterStrikeSharp API and retest commands, event values, listeners, and any entity code. Keep a copy of the last working DLL so you can restore service while adapting to the new framework or game version.

A practical growth path

  1. Begin with one console or chat command and confirm deployment.
  2. Add one game-event handler, such as a player connection or death event, and log the values you consume.
  3. Move repeated startup and cleanup work into lifecycle listeners.
  4. Expose balancing or feature switches through fake ConVars.
  5. Add SQLite only when the feature genuinely needs data across restarts.
  6. Use entity manipulation after event-driven logic is stable, then test after every game or API update.

This sequence keeps the deployment surface understandable: first one DLL, then explicit dependencies and persistent state only when the feature requires them.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.