RepositoryC#AUAustralia
roflmuffin

roflmuffin/CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2

1.4kstars
260forks
97issues
2views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: metamod-source

#1 Repository of the week

2
TINIX TRENDING·Topic: counter-strike-2

#2 Repository of the week

2
TINIX TRENDING·Topic: source2

#2 Repository of the week

Table of Contents ↗️

CounterStrikeSharp

downloads chat on discord

CounterStrikeSharp is a server side modding framework for Counter-Strike 2. This project implements a .NET 8 scripting layer on top of a Metamod Source Plugin, allowing developers to create plugins that interact with the game server in a modern language (C#) to facilitate the creation of maintainable and testable code.

Come and join our Discord

Install

Download the latest build from here. (Download the with runtime version if this is your first time installing).

Detailed installation instructions can be found in the docs.

What works?

These features are the core of the platform and work pretty well/have a low risk of causing issues.

  • Console Commands, Server Commands (e.g. css_mycommand)
  • Chat Commands with ! and / prefixes (e.g. !mycommand)
  • Fake Console Variables (commands which mimic ConVar behaviour as these have not been fully reverse engineered)
  • Game Event Handlers & Firing of Events (e.g. player_death)
    • Basic event value get/set (string, bool, int32, float)
    • Complex event values get/set (ehandle, pawn, player controller)
  • Game Tick Based Timers (e.g. repeating map timers)
    • Timer Flags (REPEAT, STOP_ON_MAPCHANGE)
  • Listeners (e.g. client connected, disconnected, map start etc.)
    • Client Listeners (e.g. connect, disconnect, put in server)
    • OnMapStart
    • OnTick
  • Server Information (current map, game time)
  • Schema System Access (access player values like current weapon, money, location etc.)

Examples

You can view the example Warcraft plugin migrated from the previous VSP.NET project to give you an idea of the kind of power this scripting runtime is capable of. This plugin shows how you can hook events, create commands, use third party libraries (SQLite) and do basic entity manipulation.

Basic Example with Game Event & Console Commands

using CounterStrikeSharp.API.Core;

namespace HelloWorldPlugin;

public class HelloWorldPlugin : BasePlugin
{
    public override string ModuleName => "Hello World Plugin";

    public override string ModuleVersion => "0.0.1";

    public override string ModuleAuthor => "roflmuffin";

    public override string ModuleDescription => "Simple hello world plugin";

    public override void Load(bool hotReload)
    {
        Logger.LogInformation("Plugin loaded successfully!");
    }

    [GameEventHandler]
    public HookResult OnPlayerConnect(EventPlayerConnect @event, GameEventInfo info)
    {
        // Userid will give you a reference to a CCSPlayerController class
        Logger.LogInformation("Player {Name} has connected!", @event.Userid.PlayerName);

        return HookResult.Continue;
    }

    [ConsoleCommand("css_issue_warning", "Issue warning to player")]
    public void OnCommand(CCSPlayerController? player, CommandInfo command)
    {
        Logger.LogWarning("Player shouldn't be doing that");
    }
}

Credits

A lot of code has been borrowed from SourceMod as well as Source.Python, two pioneering source engine plugin frameworks which this project lends a lot of its credit to. I've also used the scripting context & native system that is implemented in FiveM for GTA5. Also shoutout to the CS2Fixes project for providing good reverse-engineering information so shortly after CS2 release.

How to Build

Building requires CMake.

Clone the repository

git clone https://github.com/roflmuffin/counterstrikesharp

Init and update submodules

git submodule update --init --recursive

Make build folder

mkdir build
cd build

Generate CMake Build Files

cmake ..

Build

cmake --build . --config Debug

License

CounterStrikeSharp is licensed under the GNU General Public License version 3. A special exemption is outlined regarding published plugins, which you can find in the LICENSE file.

Similar Projects

Discover other similar projects and AI models.

RepositoryC#
nickj609/GameModeManager

A Counter-Strike 2 server plugin to help administrators manage custom game modes, settings, and map rotations.

72
Nov 23, 2026
RepositoryRust
LaihoE/demoparser

Counter-Strike 2 replay parser for Python and JavaScript

750
Nov 29, 2026
RepositoryC#
shobhit-pathak/MatchZy

MatchZy is a plugin for CS2 (Counter Strike 2) for running and managing practice/pugs/scrims/matches with easy configuration and Get5 (G5API/G5V) support as well!

510
Nov 13, 2026
RepositoryC#
B3none/cs2-retakes

CS2 implementation of retakes. Based on the version for CS:GO by Splewis.

323
Nov 25, 2026
RepositoryC#
antonpup/CounterStrike2GSI

A C# library to interface with the Game State Integration found in Counter-Strike 2.

185
Nov 18, 2026
RepositoryC#
ianlucas/cs2-css-inventory-simulator

A CounterStrikeSharp plugin for integrating with CS2 Inventory Simulator

149
Nov 18, 2026
RepositoryC#
samyycX/CS2-PlayerModelChanger

A lightweighted counterstrikesharp plugin to change player model.

138
Oct 9, 2026
RepositoryRust
Valthrun/valthrun-cs2

Valthrun an open source external CS2 read only kernel gameplay enhancer.

817
Oct 6, 2026
RepositoryC++
IMXNOOBX/cs2-external-esp

Simple external ESP for Counter-Strike 2, after many years, the codebase has been modernized for clarity and ease of use, with a redesigned interface, noticeable performance improvements, and several new quality-of-life features.

636
Nov 18, 2026