VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
NetChannel.cpp
Go to the documentation of this file.
1
#include <
VoltMod/Core/Slots/Slot.hpp
>
2
#include <
VoltMod/Engine/Interfaces.hpp
>
3
#include <
VoltMod/Engine/Net/NetChannel.hpp
>
4
#include <inetchannelinfo.h>
5
#include <string>
6
7
namespace
VoltMod
8
{
9
10
INetChannelInfo
*
NetChannels::GetNetInfo
(
int
slot
)
const
11
{
12
auto
*
engine
=
IsValidSlot
(
slot
) ? _interfaces.
Engine
:
nullptr
;
13
return
engine
?
engine
->GetPlayerNetInfo(
CPlayerSlot
(
slot
)) :
nullptr
;
14
}
15
16
float
NetChannels::EngineLatency
(
int
slot
)
const
17
{
18
auto
*
info
=
GetNetInfo
(
slot
);
19
return
info
?
info
->GetEngineLatency() : 0.0f;
20
}
21
22
std::string_view
NetChannels::GetUserInfoCvar
(
int
slot
, std::string_view name)
const
23
{
24
auto
*
engine
=
IsValidSlot
(
slot
) ? _interfaces.
Engine
:
nullptr
;
25
if
(!
engine
|| name.empty())
26
{
27
return
{};
28
}
29
30
const
char
* value =
engine
->GetClientConVarValue(
CPlayerSlot
(
slot
), std::string(name).
c_str
());
31
return
value ? std::string_view(value) : std::string_view{};
32
}
33
34
}
// namespace VoltMod
Interfaces.hpp
NetChannel.hpp
Slot.hpp
VoltMod::NetChannels::GetUserInfoCvar
std::string_view GetUserInfoCvar(int slot, std::string_view name) const
Definition
NetChannel.cpp:22
VoltMod::NetChannels::EngineLatency
float EngineLatency(int slot) const
Definition
NetChannel.cpp:16
VoltMod::NetChannels::GetNetInfo
INetChannelInfo * GetNetInfo(int slot) const
Definition
NetChannel.cpp:10
VoltMod
Definition
Options.hpp:13
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
VoltMod::IsValidSlot
constexpr bool IsValidSlot(int slot)
Definition
Slot.hpp:13
VoltMod::Interfaces::Engine
IVEngineServer2 * Engine
Definition
Interfaces.hpp:26
src
Engine
Net
NetChannel.cpp
Generated by
1.9.8