VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Player.cpp
Go to the documentation of this file.
3
4namespace VoltMod
5{
6
8{
9 return _entities ? _entities->Controller(_slot) : VoltMod::Controller{};
10}
11
13{
14 return _entities ? _entities->Pawn(_slot) : VoltMod::Pawn{};
15}
16
18{
19 return IsBot() && Controller().IsHLTV();
20}
21
22std::string Player::Name() const
23{
24 if (_entities)
25 {
26 // The controller carries the live scoreboard name. It is empty before the player has a
27 // controller, and the engine also reports an empty name for a moment around connect.
28 if (const VoltMod::Controller controller = _entities->Controller(_slot))
29 {
30 std::string live(controller.PlayerName());
31 if (!live.empty())
32 {
33 return live;
34 }
35 }
36 }
37 return _connectName;
38}
39
40} // namespace VoltMod
A player's identity behind a slot: name, money, team, scoreboard row. It survives death and respawn; ...
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Co...
Definition Pawn.hpp:35
bool IsSourceTV() const
Definition Player.cpp:17
bool IsBot() const noexcept
Definition Player.hpp:45
VoltMod::Pawn Pawn() const
Definition Player.cpp:12
std::string Name() const
Definition Player.cpp:22
VoltMod::Controller Controller() const
Definition Player.cpp:7