From 5a3662d9714b65b459d14c09577e148ecbffce7f Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sat, 5 Aug 2017 11:28:50 +0300 Subject: [PATCH] option to kill bot when it gets VAC banned --- src/hooks/others.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 089d706a..0176c423 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -225,10 +225,21 @@ bool SendNetMsg_hook(void* _this, INetMessage& msg, bool bForceReliable = false, return false; } +static CatVar die_if_vac(CV_SWITCH, "die_if_vac", "0", "Die if VAC banned"); + void Shutdown_hook(void* _this, const char* reason) { // This is a INetChannel hook - it SHOULDN'T be static because netchannel changes. const Shutdown_t original = (Shutdown_t)hooks::netchannel.GetMethod(offsets::Shutdown()); logging::Info("Disconnect: %s", reason); + if (strstr(reason, "VAC banned")) { + if (die_if_vac) { + logging::Info("VAC banned"); + *(int*)0 = 0; + exit(1); + } + } else if (strstr(reason, "VAC")) { + logging::Info("VAC error?"); + } #if IPC_ENABLED ipc::UpdateServerAddress(true); #endif