VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::PlayerRef Struct Reference

A storable reference to a player: the slot plus the SteamID that occupied it. More...

#include <PlayerRef.hpp>

Public Member Functions

 operator bool () const noexcept
bool operator== (const PlayerRef &) const noexcept=default

Public Attributes

int Slot = -1
int64_t SteamId = 0

Detailed Description

A storable reference to a player: the slot plus the SteamID that occupied it.

Controller and Pawn are frame-local, and a bare slot number is not enough on its own - a slot changes hands, so work scheduled against one can land on whoever sits there next. Keep a PlayerRef instead and check both halves when it is resolved: the slot says where to look and the SteamID says whether it is still the same player.

SteamId == 0 means a bot, which no reference can pin down across a reconnect.

Definition at line 18 of file PlayerRef.hpp.

Member Function Documentation

◆ operator bool()

VoltMod::PlayerRef::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 23 of file PlayerRef.hpp.

References Slot.

◆ operator==()

bool VoltMod::PlayerRef::operator== ( const PlayerRef & ) const
defaultnoexcept

Member Data Documentation

◆ Slot

int VoltMod::PlayerRef::Slot = -1

Definition at line 20 of file PlayerRef.hpp.

Referenced by VoltMod::PlayerManager::Get(), and operator bool().

◆ SteamId

int64_t VoltMod::PlayerRef::SteamId = 0

Definition at line 21 of file PlayerRef.hpp.

Referenced by VoltMod::PlayerManager::Get().


The documentation for this struct was generated from the following file: