Fix ping value
This commit is contained in:
parent
125f240688
commit
4047857317
@ -115,10 +115,10 @@ namespace fps
|
|||||||
|
|
||||||
void cg_draw_ping()
|
void cg_draw_ping()
|
||||||
{
|
{
|
||||||
if (cg_drawping->current.integer > 0 && game::CL_IsCgameInitialized() && !game::VirtualLobby_Loaded())
|
if (cg_drawping->current.integer > 0 && game::CL_IsCgameInitialized() && !game::VirtualLobby_Loaded() && *game::mp::client_state)
|
||||||
{
|
{
|
||||||
const auto font = game::R_RegisterFont("fonts/consolefont", 20);
|
const auto font = game::R_RegisterFont("fonts/consolefont", 20);
|
||||||
const auto ping_string = utils::string::va("Ping: %i", *game::mp::ping);
|
const auto ping_string = utils::string::va("Ping: %i", (*game::mp::client_state)->ping);
|
||||||
|
|
||||||
const auto x = (game::ScrPlace_GetViewPlacement()->realViewportSize[0] - 375.0f) - game::R_TextWidth(
|
const auto x = (game::ScrPlace_GetViewPlacement()->realViewportSize[0] - 375.0f) - game::R_TextWidth(
|
||||||
ping_string, 0x7FFFFFFF, font);
|
ping_string, 0x7FFFFFFF, font);
|
||||||
|
@ -188,7 +188,12 @@ namespace ui_scripting
|
|||||||
|
|
||||||
game_type["getping"] = [](const game&)
|
game_type["getping"] = [](const game&)
|
||||||
{
|
{
|
||||||
return *::game::mp::ping;
|
if ((*::game::mp::client_state) == nullptr)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (*::game::mp::client_state)->ping;
|
||||||
};
|
};
|
||||||
|
|
||||||
game_type["issingleplayer"] = [](const game&)
|
game_type["issingleplayer"] = [](const game&)
|
||||||
|
@ -1460,10 +1460,15 @@ namespace game
|
|||||||
// made up
|
// made up
|
||||||
struct client_state_t
|
struct client_state_t
|
||||||
{
|
{
|
||||||
char __pad0[0x4A5C];
|
char __pad0[0x4A50];
|
||||||
|
int ping;
|
||||||
|
char __pad1[0x8];
|
||||||
int num_players;
|
int num_players;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(offsetof(client_state_t, ping) == 0x4A50);
|
||||||
|
static_assert(offsetof(client_state_t, num_players) == 0x4A5C);
|
||||||
|
|
||||||
enum PlayerHandIndex
|
enum PlayerHandIndex
|
||||||
{
|
{
|
||||||
WEAPON_HAND_DEFAULT = 0x0,
|
WEAPON_HAND_DEFAULT = 0x0,
|
||||||
|
@ -269,8 +269,6 @@ namespace game
|
|||||||
WEAK symbol<int> svs_numclients{0x0, 0x2DC338C};
|
WEAK symbol<int> svs_numclients{0x0, 0x2DC338C};
|
||||||
WEAK symbol<int> gameTime{0x0, 0x0};
|
WEAK symbol<int> gameTime{0x0, 0x0};
|
||||||
|
|
||||||
WEAK symbol<int> ping{0x0, 0x2ECCF40};
|
|
||||||
|
|
||||||
WEAK symbol<int> sv_serverId_value{0x0, 0x0};
|
WEAK symbol<int> sv_serverId_value{0x0, 0x0};
|
||||||
|
|
||||||
WEAK symbol<bool> virtualLobby_loaded{0x0, 0x2E6EC9D};
|
WEAK symbol<bool> virtualLobby_loaded{0x0, 0x2E6EC9D};
|
||||||
|
Loading…
Reference in New Issue
Block a user