From 3117baa69be21c1ef33d1aebe22d897176a1b07b Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Tue, 24 May 2022 22:36:17 +0200 Subject: [PATCH] Fix discord player count --- src/client/component/discord.cpp | 11 ++++++++++- src/client/game/structs.hpp | 7 +++++++ src/client/game/symbols.hpp | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/client/component/discord.cpp b/src/client/component/discord.cpp index a567fa92..9d48adfe 100644 --- a/src/client/component/discord.cpp +++ b/src/client/component/discord.cpp @@ -101,7 +101,16 @@ namespace discord discord_presence.partyPrivacy = DISCORD_PARTY_PUBLIC; } - discord_presence.partySize = 1; //*reinterpret_cast(0x1429864C4); + const auto client_state = *game::mp::client_state; + if (client_state != nullptr) + { + discord_presence.partySize = client_state->num_players; + } + else + { + discord_presence.partySize = 0; + } + discord_presence.partyMax = max_clients; discord_presence.state = clean_hostname; discord_presence.largeImageKey = map; diff --git a/src/client/game/structs.hpp b/src/client/game/structs.hpp index c8bf2469..db37f353 100644 --- a/src/client/game/structs.hpp +++ b/src/client/game/structs.hpp @@ -1448,6 +1448,13 @@ namespace game { }; + // made up + struct client_state_t + { + char __pad0[0x4A5C]; + int num_players; + }; + enum PlayerHandIndex { WEAPON_HAND_DEFAULT = 0x0, diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 1ac0746c..775e1d63 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -257,6 +257,8 @@ namespace game WEAK symbol sv_serverId_value{0x0, 0x0}; WEAK symbol virtualLobby_loaded{0x0, 0x2E6EC9D}; + + WEAK symbol client_state{0x0, 0x2EC84F0}; } namespace sp