CS2 server plugins: installing Metamod:Source and CounterStrikeSharp on a dedicated server

A forum for players to discuss different multiplayer servers, share server IPs, and organize games.
Post Reply
ice
Site Admin
Posts: 93
Joined: Tue Aug 27, 2024 5:17 am

CS2 server plugins: installing Metamod:Source and CounterStrikeSharp on a dedicated server

Post by ice »

Quick summary

CounterStrikeSharp is how you write Counter-Strike 2 server plugins in C#, and it does not run on its own. It sits on top of Metamod:Source, so both layers have to be installed before any of your own code can load.[1][2]

The install is two directory copies and one line in gameinfo.gi. The three failures that usually follow it are a missing .NET runtime, the wrong Metamod build, and a gameinfo.gi edit that did not take.

What each layer does
  • Metamod:Source is the loader. It hooks the game server so plugins can load without rebuilding the game. The official site calls 1.12 the stable branch and keeps the 2.0 branch in development for Source 2 support.[3]
  • CounterStrikeSharp is the framework you write against. It implements a .NET scripting layer on top of a Metamod Source plugin, so plugins are written in C#.[2]
Prerequisites
  • Metamod:Source 2.X dev build, build 1467 or newer, with KHook support.[1]
  • The CounterStrikeSharp with-runtime release from the project's GitHub releases page.[1]
  • On Windows servers, the Visual Studio Redistributables. Without them CounterStrikeSharp will not work.[1]
The two projects do not agree on which Metamod branch to use. The CounterStrikeSharp docs point at the 2.x dev build, while the Metamod:Source site still labels 1.12 as stable. For CS2, follow the CounterStrikeSharp docs, because Source 2 support lives in the 2.0 branch.[1][3]

Installing Metamod:Source
  1. Extract Metamod and copy its /addons/ directory to /game/csgo/.
  2. Inside /game/csgo/, open gameinfo.gi.
  3. Underneath the line Game_LowViolence csgo_lv, add a new line: Game csgo/addons/metamod.
  4. Restart the server.
  5. Type meta list in the server console to confirm Metamod loaded.[1]
Installing CounterStrikeSharp
  1. Extract CounterStrikeSharp and copy its /addons/ directory to /game/csgo/.
  2. Restart the server.
  3. Run meta list again. It should list one plugin:

    Code: Select all

    meta list
    Listing 1 plugin:
      [01] CounterStrikeSharp (0.1.0) by Roflmuffin
    That one line is the proof the framework loaded.[1]

    Folder layout after install

    Code: Select all

    addons
    ├── counterstrikesharp
    │   ├── api
    │   ├── bin
    │   ├── dotnet
    │   ├── plugins
    │   └── gamedata
    ├── metamod
    │   ├── bin
    │   ├── counterstrikesharp.vdf
    │   ├── metaplugins.ini
    │   └── README.txt
    ├── metamod.vdf
    └── metamod_x64.vdf
    Upgrading

    Download the newest release and copy it over the old one. Configuration files are not overwritten, so plugins and settings survive. Once CounterStrikeSharp is installed you can switch to the non-runtime build, but then you keep the .NET runtime current yourself.[1]

    Troubleshooting
    • The first install must use the with-runtime build. It ships a copy of the .NET runtime, which the plugin needs.[1]
    • Getting Unknown Command when you type meta list means the folders were not copied correctly or gameinfo.gi was not edited. Check both.[1]
    • On Linux, install libicu, icu-libs or libicu-dev from your package manager so .NET can run.[1]
    • On Windows, install the Visual Studio Redistributables or the framework will not start.[1]
    FAQ

    Do I need SourceMod?
    No. CounterStrikeSharp needs Metamod:Source, not SourceMod.[1][2]

    Can I run it on a listen server?
    The documentation covers installing it on a vanilla dedicated CS2 server, which is the setup to follow.[1]

    Where do plugins come from?
    The framework is only the loader. Plugins are separate releases. The project credits SourceMod and Source.Python as the earlier frameworks it borrowed from.[2]

    Is it free?
    CounterStrikeSharp is licensed under GPL version 3, with a special exemption for published plugins.[2]

    Sources
    CounterStrikeSharp Getting Started docs
    CounterStrikeSharp GitHub repository
    Metamod:Source official site
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests