Juegos
Counter-Strike 2 (CounterStrikeSharp)
Cómo conectar Counter-Strike 2 (CounterStrikeSharp) a valkyr: instala el puente, configúralo y mira qué eventos y acciones admite.
- Método
- CounterStrikeSharp plugin (C#)
- Estado
- ejemplo sin probar
- Eventos
frameshotsoundspawn
Status: untested example. The plugin (ValkyrPlugin.cs) was not compiled: no .NET SDK and no CounterStrikeSharp package were available where it was written. The unit conversion (Units.cs) was compiled and checked on its own with tests/ (all checks pass).
Scope, read first
- This plugin runs only on the operator's own community or private CS2 dedicated server, as a CounterStrikeSharp plugin. It never runs on players' machines and installs nothing on them.
- It reads only state the server already has (player pawn positions, eye angles, game events) and sends it to a valkyr-server the operator runs.
- It does not interact with VAC or any other anti-cheat, and does not try to bypass, replace or inspect them.
- Server operators must follow the game's rules for server operators. Kicks and admin notices are the operator's decisions; valkyr only provides evidence and a suggested action.
What it sends
| Game source | valkyr event |
|---|---|
| every N ticks, each alive human player: pawn origin, eye angles, on ground flag, jump event | frame |
weapon_ | shot (weapon id from the config table) and a sound unless silenced |
player_ in the same tick | fills target and bone of that shot (hit group 1 head; 2, 3, 8 body; 4 to 7 limb) |
player_, round_ | spawn with the team number |
player_ | sound with the configured radius |
Events are batched (BatchIntervalSeconds) to POST /v1/. The match id is <MatchIdPrefix>-<map>-<unix time> and the match is ended with POST /v1/ on map end. Actions are polled from GET /v1/ and applied on the game thread: actions listed in KickOnActions kick the player (kickid), actions in NotifyAdminsOnActions print a chat notice to players with AdminPermission. Player ids are SteamID64 values. Bots are ignored.
CS2 does not give plugins the client's own clock, so client_ equals the server time and valkyr's client clock checks have nothing to work with; movement, view, combat, aim and information checks still apply.
Units and axes
Source 2 positions are inches (Hammer units), Z up, yaw 0 along +X and 90 along +Y, pitch positive looking down. valkyr is meters, Y up, yaw 0 along +Z and 90 along +X, pitch positive looking up:
valkyr (x, y, z) = (X, Z, Y) * 0.0254valkyr yaw = 90 - source yaw (wrapped to -180..180)valkyr pitch = -source pitch
Set the valkyr-server movement limits in meters per second accordingly (CS2 run speed is about 250 units/s, about 6.4 m/s).
Build and install
Requirements: .NET 8 SDK, a CS2 dedicated server with Metamod:Source and CounterStrikeSharp installed.
cd integrations/cs2-counterstrikesharpdotnet build -c Release
Copy bin/ to game/ on the server. On first load CounterStrikeSharp writes the config to game/; see ValkyrCS2. for the fields. Set ApiKey to a valkyr-server key with the ingest role and declare matching weapons (by id) in the valkyr-server combat config.
Check the conversion without the game:
csc -nullable:enable -out:UnitsCheck.exe Units.cs tests/UnitsCheck.cs && UnitsCheck.exe
API names to verify
Written from the CounterStrikeSharp documentation without a compiler. Check these when you build it: pawn. (QAngle X pitch, Y yaw), pawn. bit 0 as on ground, CCSPlayerController., EventPlayerHurt., EventWeaponFire., EventPlayerFootstep, EventPlayerJump, and whether Server. is available during Load.
Los nombres de juegos y plataformas pertenecen a sus dueños y se usan solo para describir la compatibilidad. valkyr no está afiliado a ellos.