A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/roflmuffin/CounterStrikeSharp below:

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

Table of Contents ↗️

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

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.

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

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");
    }
}

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.

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

Generate CMake Build Files

Build

cmake --build . --config Debug

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4