working weapon concealment

This commit is contained in:
2026-08-10 16:59:45 +02:00
parent 4e9500f0ea
commit 9a23169b6b
13 changed files with 927 additions and 66 deletions

View File

@@ -57,11 +57,10 @@ The C# wrapper is in:
examples/CounterStrikeSharp/SendProxyNative.cs
```
It loads the native addon with `NativeLibrary.Load` and exposes byte-oriented and typed helpers. In a CSS plugin, resolve the native library from `Server.GameDirectory`:
It loads the native addon with `NativeLibrary.Load` and exposes byte-oriented and typed helpers. In a CSS plugin, construct it from `Server.GameDirectory`:
```csharp
string libraryPath = Path.Combine(Server.GameDirectory, "addons", "sendproxy", "bin", "linuxsteamrt64", "sendproxy.so");
var sendProxy = new SendProxyNative(libraryPath);
var sendProxy = SendProxyNative.FromGameDirectory(Server.GameDirectory);
int ruleId = sendProxy.SetInt32(
recipientSlot: viewer.Slot,
@@ -75,9 +74,17 @@ sendProxy.RemoveOverride(ruleId);
Use `SetBytes` for custom/fixed-layout fields and typed helpers such as `SetInt32`, `SetUInt32`, `SetFloat`, `SetBool`, and `SetColor` for common values.
## Example CSS Plugin
## Example CSS Plugins
Example source:
Health spoof smoke test:
```text
examples/CounterStrikeSharp/SendProxyHealth23/
```
It spoofs every player pawn's `CBaseEntity::m_iHealth` to `23` for all recipients without changing real health.
Weapon visibility experiment:
```text
examples/CounterStrikeSharp/SendProxyWeaponVisibility/
@@ -90,6 +97,20 @@ It demonstrates:
- Coloring dropped AK-47s red for Terrorist viewers.
- Coloring dropped M4A1-S blue for CT viewers.
Concealed-carry handle spoof:
```text
examples/CounterStrikeSharp/SendProxyConcealedCarry/
```
It hides owned primary weapons, secondary weapons, and grenades from every recipient except the owning player by spoofing weapon-related handles to `0xffffffff`:
- `CBasePlayerPawn::m_pWeaponServices.m_hActiveWeapon`
- `CBasePlayerPawn::m_pWeaponServices.m_hLastWeapon`
- `CBaseEntity::m_hOwnerEntity` on carried weapon entities
It intentionally does not set `EF_NODRAW` and does not remove or drop the real weapons.
This sample periodically reconciles desired rules and diffs them against active rule IDs. For production, prefer event-driven updates on player connect/disconnect/team changes/spawn/death and weapon pickup/drop/create/delete.
## Building the Metamod Addon
@@ -159,6 +180,8 @@ Install the built CSS plugin under:
game/csgo/addons/counterstrikesharp/plugins/SendProxyWeaponVisibility/
```
Use the matching example directory name when building/installing another sample, for example `SendProxyHealth23` or `SendProxyConcealedCarry`.
Make sure `SendProxyNative.cs` is included in your CSS project or copied into your plugin source.
The example plugin expects the Metamod addon at: