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
<PackageReference Include="YappersHQ.WeaponLimit.Shared" Version="1.0.1" />
<PackageVersion Include="YappersHQ.WeaponLimit.Shared" Version="1.0.1" />
<PackageReference Include="YappersHQ.WeaponLimit.Shared" />
paket add YappersHQ.WeaponLimit.Shared --version 1.0.1
#r "nuget: YappersHQ.WeaponLimit.Shared, 1.0.1"
#:package YappersHQ.WeaponLimit.Shared@1.0.1
#addin nuget:?package=YappersHQ.WeaponLimit.Shared&version=1.0.1
#tool nuget:?package=YappersHQ.WeaponLimit.Shared&version=1.0.1
<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 inAllowedWeapons, gives any missingGiveOnSpawnweapons, and refills ammo ifRefillAmmoOnSpawn. The strip is deferred a frame so it doesn't race the engine's own equip path. - On pickup (
PlayerWeaponCanEquip/PlayerWeaponCanUse, whenBlockPickup): refuses any classname not in the allowlist, so map equip entities and dropped weapons are inert. - On kill (
PlayerKilledPost, whenRefillOnKill): 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 | Versions 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. |
-
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.