PickupsApi 1.7.0
dotnet add package PickupsApi --version 1.7.0
NuGet\Install-Package PickupsApi -Version 1.7.0
<PackageReference Include="PickupsApi" Version="1.7.0" />
<PackageVersion Include="PickupsApi" Version="1.7.0" />
<PackageReference Include="PickupsApi" />
paket add PickupsApi --version 1.7.0
#r "nuget: PickupsApi, 1.7.0"
#:package PickupsApi@1.7.0
#addin nuget:?package=PickupsApi&version=1.7.0
#tool nuget:?package=PickupsApi&version=1.7.0
PickupsApi
Shared API for CS2-Pickups, a CounterStrikeSharp plugin suite for running CS2 pickup (PUG) games. Reference this package to read match state and hook match lifecycle events from your own plugin.
The API is implemented by PickupsCore, so the server needs CS2-Pickups installed at runtime.
Install
<PackageReference Include="PickupsApi" Version="1.4.0" ExcludeAssets="runtime" />
ExcludeAssets="runtime" matters: the DLL is loaded by the server from
addons/counterstrikesharp/shared/PickupsApi, so shipping a second copy next to your plugin
breaks the shared-assembly load.
Usage
Grab the capability once all plugins are loaded, then read state or subscribe to events:
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using PickupsApi;
using PickupsApi.Types;
public class MyPlugin : BasePlugin
{
private IPickupsApi? _pickups;
public override void OnAllPluginsLoaded(bool hotReload)
{
_pickups = IPickupsApi.PluginCapability.Get();
if (_pickups is null)
return; // CS2-Pickups is not installed
_pickups.OnMatchStart += () => Server.PrintToChatAll("Match started!");
_pickups.OnMatchEnd += winner => Server.PrintToChatAll($"Team {winner} won!");
}
public bool IsLive() =>
_pickups?.IsMatchRunning() == true && _pickups.GetRoundType() == RoundType.Normal;
}
Surface
| Member | Purpose |
|---|---|
IsMatchRunning() |
Whether a match is currently running |
GetRoundType() |
Current RoundType: Warmup, Normal, LeaderKnife, SelectingPlayers, Knife, SelectingTeam |
GetLeader(Team) |
That team's leader, or null if unset or disconnected |
GetTeamForSide(CsTeam) |
The team identity on a side, or Team.None |
GetSideForTeam(Team) |
The side a team is currently on, or CsTeam.None |
GetTeamPlayers(Team) |
Snapshot of the connected human players on a team |
CurrentMatchId |
UUIDv7 for the current or most recent match. Set at OnMatchPreStartPost(true), not cleared when the match ends, so every terminal hook can name it. Not a liveness flag — use GetRoundType() == RoundType.Normal for that |
LastMatchEndReason |
Normal, Surrender, Stopped, or None while a match runs |
SurrenderedByTeam |
The team that surrendered, when that is how the match ended |
OnMatchPreStart |
Func<bool> — return false to veto the match start. Every subscriber is asked until one vetoes, so it is for the veto only, never for notifications |
OnMatchPreStartPost |
The verdict of OnMatchPreStart: true when the match is starting, false when it was vetoed. This is where a start notification belongs |
OnMatchStart / OnHalftimeStart / OnMatchStop |
Match lifecycle |
OnMatchEnd / OnMatchEndPost |
Winning Team. OnMatchEnd is the last hook with players still connected — snapshot rosters there. OnMatchEndPost runs after every player has been kicked |
OnMoveLeaders / OnMovePlayer |
Fired as leader selection assigns teams |
OnGameStats |
Game stats were requested to be updated |
OnPreparingRoundStart |
A preparing round started (LeaderKnife, SelectingPlayers, Knife, SelectingTeam), passed as the argument |
Teams are Team.A / Team.B (Team.None when unassigned), not CS2's T/CT sides — sides
swap at halftime, team identity does not. Game events report sides, so GetTeamForSide is
how a side becomes something worth storing. A round record should keep both: the side is what
the game said, the team is what a reader wants to see.
License
Apache-2.0
| 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
- CounterStrikeSharp.API (>= 1.0.371)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.