YappersHQ.WeaponLimit.Shared 1.0.1

dotnet add package YappersHQ.WeaponLimit.Shared --version 1.0.1
                    
NuGet\Install-Package YappersHQ.WeaponLimit.Shared -Version 1.0.1
                    
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="YappersHQ.WeaponLimit.Shared" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YappersHQ.WeaponLimit.Shared" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="YappersHQ.WeaponLimit.Shared" />
                    
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 YappersHQ.WeaponLimit.Shared --version 1.0.1
                    
#r "nuget: YappersHQ.WeaponLimit.Shared, 1.0.1"
                    
#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.
#:package YappersHQ.WeaponLimit.Shared@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=YappersHQ.WeaponLimit.Shared&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=YappersHQ.WeaponLimit.Shared&version=1.0.1
                    
Install as a Cake Tool

<div align="center"> <h1><strong>WeaponLimit</strong></h1> <p>Restrict a CS2 server to a configured weapon allowlist — deagle-only, AWP-only, and similar gamemodes.</p> </div>

<p align="center"> <a href="https://github.com/Kxnrl/modsharp-public"><img src="https://img.shields.io/badge/framework-ModSharp-5865F2?logo=github" alt="ModSharp"></a> <img src="https://img.shields.io/badge/game-CS2-orange" alt="CS2"> <img src="https://img.shields.io/gitlab/stars/cs2-server-plugins/cs2-weaponlimit?gitlab_url=https%3A%2F%2Fgitlab.com" alt="Stars"> </p>


A ModSharp plugin that holds players to a list of allowed weapon classnames. Anything outside the list is stripped on spawn and refused on pickup, while the configured loadout is handed out (and optionally kept topped up with ammo). Drop it in, set weapon_deagle to weapon_awp, and you have an AWP-only server.

🚀 Install

Copy the build output into your ModSharp install (<sharp> = your sharp directory):

From To
.build/modules/WeaponLimit/ <sharp>/modules/WeaponLimit/

Start the server once. If no config exists, the plugin writes <sharp>/configs/weaponlimit.json with deagle defaults and logs a [WeaponLimit] warning so you don't miss it. Edit it for your gamemode and restart.

⚙️ Configuration

<sharp>/configs/weaponlimit.json (auto-generated on first run):

Setting Default Meaning
AllowedWeapons ["weapon_deagle"] Weapon classnames players may hold. Anything else is stripped on spawn and refused on pickup.
GiveOnSpawn ["weapon_deagle"] Weapons handed out on spawn if the player doesn't already have them. Keep empty to rely on map game_player_equip / pickups.
RefillAmmoOnSpawn true Top up clip + reserve ammo on spawn.
RefillOnKill true Refill the killer's weapons after a kill — handy for one-shot deagle/AWP modes.
BlockPickup true Refuse equip/use of disallowed weapons via the PlayerWeaponCanEquip / PlayerWeaponCanUse hooks.
KnifeAlwaysAllowed true Always allow the knife regardless of AllowedWeapons (covers all melee skins).

AWP-only:

{
  "AllowedWeapons": ["weapon_awp"],
  "GiveOnSpawn":    ["weapon_awp"]
}

Multi-pistol:

{
  "AllowedWeapons": ["weapon_deagle", "weapon_glock", "weapon_usp_silencer"],
  "GiveOnSpawn":    ["weapon_deagle"]
}

🔧 How it works

  • On spawn (PlayerSpawnPost): on the next frame, strips every weapon whose classname isn't in AllowedWeapons, gives any missing GiveOnSpawn weapons, and refills ammo if RefillAmmoOnSpawn. The strip is deferred a frame so it doesn't race the engine's own equip path.
  • On pickup (PlayerWeaponCanEquip / PlayerWeaponCanUse, when BlockPickup): refuses any classname not in the allowlist, so map equip entities and dropped weapons are inert.
  • On kill (PlayerKilledPost, when RefillOnKill): refills the killer's non-knife weapons.
  • Knife: when KnifeAlwaysAllowed, the knife is matched by weapon type (IsKnife), so every melee skin — bayonet, karambit, butterfly — is covered without listing classnames.

📦 Build

dotnet build -c Release

Outputs .build/modules/WeaponLimit/WeaponLimit.dll. The config is created by the plugin at runtime, not shipped in the build.


<div align="center"> <p>Made with ❤️ by <a href="https://gitlab.com/cs2-server-plugins">yappershq</a></p> <p>⭐ Star this repo if you find it useful!</p> </div>

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • 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
1.0.1 100 8/10/2026
1.0.0 115 8/1/2026