Fix MM Ban detection

This commit is contained in:
LightCat 2019-03-21 18:24:33 +01:00
parent 43f068c659
commit f07598d48d
3 changed files with 13 additions and 19 deletions

View File

@ -11,7 +11,8 @@
#include "common.hpp"
#include "hitrate.hpp"
#include "hack.hpp"
extern settings::Bool die_if_vac;
static Timer checkmmban{};
namespace hooked_methods
{
@ -63,6 +64,14 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
g_IEngine->ClientCmd_Unrestricted(hack::command_stack().top().c_str());
hack::command_stack().pop();
}
#if !ENABLE_VISUALS
if (*die_if_vac && checkmmban.test_and_set(1000))
{
if (tfmm::isMMBanned())
*(int *) 0 = 0;
}
#endif
#if ENABLE_TEXTMODE_STDIN == 1
static auto last_stdin = std::chrono::system_clock::from_time_t(0);
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - last_stdin).count();

View File

@ -7,7 +7,7 @@
#include <settings/Bool.hpp>
#include "HookedMethods.hpp"
static settings::Bool die_if_vac{ "misc.die-if-vac", "false" };
settings::Bool die_if_vac{ "misc.die-if-vac", "false" };
static settings::Bool autoabandon{ "misc.auto-abandon", "false" };
static settings::String custom_disconnect_reason{ "misc.disconnect-reason", "" };
settings::Bool random_name{ "misc.random-name", "false" };
@ -15,12 +15,12 @@ extern settings::String force_name;
namespace hooked_methods
{
Timer t{};
DEFINE_HOOKED_METHOD(Shutdown, void, INetChannel *this_, const char *reason)
{
g_Settings.bInvalid = true;
logging::Info("Disconnect: %s", reason);
if (strstr(reason, "banned") || strstr(reason, "Generic_Kicked"))
if (strstr(reason, "banned") || (strstr(reason, "Generic_Kicked") && tfmm::isMMBanned()))
{
if (*die_if_vac)
{
@ -40,12 +40,8 @@ DEFINE_HOOKED_METHOD(Shutdown, void, INetChannel *this_, const char *reason)
{
original::Shutdown(this_, reason);
}
if (autoabandon)
{
t.update();
tfmm::disconnectAndAbandon();
}
hacks::shared::autojoin::onShutdown();
if (*random_name)
{

View File

@ -31,7 +31,6 @@ CatCommand join("mm_join", "Join mm Match", []() {
bool replaced = false;
namespace hooked_methods
{
Timer checkmmban{};
DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, unsigned int panel, bool force, bool allow_force)
{
if (!isHackActive())
@ -71,16 +70,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, unsigned int pane
}
scndwait++;
switcherido = !switcherido;
#if not ENABLE_VISUALS
if (checkmmban.test_and_set(1000))
{
{
if (tfmm::isMMBanned())
exit(1);
}
*(int *) nullptr = 0;
}
#endif
if (no_reportlimit && !replaced)
{
static BytePatch no_report_limit(gSignatures.GetClientSignature, "55 89 E5 57 56 53 81 EC ? ? ? ? 8B 5D ? 8B 7D ? 89 D8", 0x75, { 0xB8, 0x01, 0x00, 0x00, 0x00 });