From 37b9f234c1805e0a99db3fad22ac96fc5cb62c0b Mon Sep 17 00:00:00 2001 From: LightCat Date: Sun, 14 Oct 2018 17:39:01 +0200 Subject: [PATCH] IRC upgrades --- src/irc.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/irc.cpp b/src/irc.cpp index fb62c186..496a7222 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -268,6 +268,17 @@ static bool restarting{ false }; static HookedFunction paint(HookedFunctions_types::HF_Paint, "IRC", 16, []() { if (!restarting) { + if (last_sent_steamid.check(8000) && !last_sent_steamid.check(9500)) + { + static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 57 56 53 83 EC ? 8B 7D ? 8B 77 ? 85 F6 0F 84"); + typedef int (*GetNumOnlineMembers_t)(re::CTFPartyClient *); + auto GetNumOnlineMembers_fn = GetNumOnlineMembers_t(addr); + auto party_client = re::CTFPartyClient::GTFPartyClient(); + if (party_client && GetNumOnlineMembers_fn(party_client) != 6 && !steamidvec.empty()) + { + hack::command_stack().push("tf_party_leave"); + } + } if (last_steamid_received.test_and_set(10000)) { static uintptr_t addr = gSignatures.GetClientSignature( @@ -288,14 +299,8 @@ static HookedFunction paint(HookedFunctions_types::HF_Paint, "IRC", 16, []() { lowest = steamidvec[i]; idx = i; } - if (idx != -1 && - steamidvec[idx] != - g_ISteamUser->GetSteamID().GetAccountID()) - { - hack::command_stack().push("tf_party_leave"); - hack::command_stack().push(format( - "tf_party_request_join_user ", steamidvec[idx])); - } + if (idx != -1 && steamidvec[idx] != g_ISteamUser->GetSteamID().GetAccountID()) + hack::command_stack().push(format("tf_party_request_join_user ", steamidvec[idx])); steamidvec.clear(); } }