Merge pull request #357 from nullifiedcat/b1g

B1g merge for Events and chatprint
This commit is contained in:
BenCat07 2018-02-25 14:41:02 +01:00 committed by GitHub
commit 4ba8368fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 137 additions and 3 deletions

22
include/hacks/Events.hpp Normal file
View File

@ -0,0 +1,22 @@
/*
* Events.hpp
*
* Created on: Feb 24, 2018
* Author: bencat07
*/
#pragma once
#include "common.hpp"
namespace hacks
{
namespace shared
{
namespace event
{
void CreateMove();
char *inttochar(int i);
}
}
}

View File

@ -24,6 +24,7 @@
#include "AutoReflect.hpp"
#include "AutoSticky.hpp"
#include "AntiCheat.hpp"
#include "Events.hpp"
#include "Bunnyhop.hpp"
#include "LagExploit.hpp"
#include "Walkbot.hpp"

88
src/hacks/Events.cpp Normal file
View File

@ -0,0 +1,88 @@
/*
* Events.cpp
*
* Created on: Feb 24, 2018
* Author: bencat07
*/
#include "common.hpp"
namespace hacks
{
namespace shared
{
namespace event
{
std::array<int, 2048> data;
void CreateMove()
{
if (!event_log)
return;
for (int i; i < g_IEngine->GetMaxClients(); ++i)
{
CachedEntity *ent = ENTITY(i);
if (!CE_GOOD(ent))
continue;
player_info_s info;
g_IEngine->GetPlayerInfo(ent->m_IDX, &info);
if (!data[i])
data[i] = CE_INT(ent, netvar.iClass);
if (data[i] != CE_INT(ent, netvar.iClass))
{
int skin = RAW_ENT(ent)->GetSkin();
if (skin == 1) {
PrintChat("\x07%06X%s\x01 changed from \"\x07%06X%s\x01\" to "
"\"\x07%06X%s\x01\"",
0xb8383b, info.name, 0x6b9ca0, inttochar(data[i]),
0x6ba072, inttochar(CE_INT(ent, netvar.iClass)));
}
else if (skin == 2) {
PrintChat("\x07%06X%s\x01 changed from \"\x07%06X%s\x01\" to "
"\"\x07%06X%s\x01\"",
0x5885a2, info.name, 0x6b9ca0, inttochar(data[i]),
0x6ba072, inttochar(CE_INT(ent, netvar.iClass)));
}
data[i] = CE_INT(ent, netvar.iClass);
}
}
}
char *inttochar(int i)
{
switch (i)
{
case tf_scout:
return "Scout";
break;
case tf_sniper:
return "Sniper";
break;
case tf_soldier:
return "Soldier";
break;
case tf_demoman:
return "Demoman";
break;
case tf_medic:
return "Medic";
break;
case tf_heavy:
return "Heavy";
break;
case tf_pyro:
return "Pyro";
break;
case tf_spy:
return "Spy";
break;
case tf_engineer:
return "Engineer";
break;
default:
return "Invalid";
break;
}
}
}
}
}

View File

@ -424,10 +424,14 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
hacks::shared::spam::CreateMove();
}
{
PROF_SECTION(CM_AC);
PROF_SECTION(CM_AC);
angles::Update();
hacks::shared::anticheat::CreateMove();
}
{
PROF_SECTION(CM_EVENTS);
hacks::shared::event::CreateMove();
}
}
if (time_replaced)
g_GlobalVars->curtime = curtime_old;

View File

@ -692,13 +692,22 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
message.push_back(c);
}
}
static const char *lastfilter;
static const char *lastname;
static bool retrun = false;
if (data[0] != LOCAL_E->m_IDX) {
if (retrun)
PrintChat("\x07%06X%s\x01: \x07%06X%s\x01", 0xe05938, lastname,
0xefec1f, lastfilter);
}
retrun = false;
if (chat_filter_enabled && data[0] != LOCAL_E->m_IDX)
{
if (!strcmp(chat_filter.GetString(), ""))
{
std::string tmp = {};
std::string tmp = {};
std::string tmp2 = {};
int iii = 0;
int iii = 0;
player_info_s info;
g_IEngine->GetPlayerInfo(LOCAL_E->m_IDX, &info);
std::string name1 = info.name;
@ -798,6 +807,8 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
boost::replace_all(message2, "7", "t");
for (auto filter : res)
{
if (retrun)
break;
if (boost::contains(message2, filter))
{
@ -807,6 +818,9 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
clear += "\n";
}
chat_stack::Say(". " + clear, true);
retrun = true;
lastfilter = filter.c_str();
lastname = name.c_str();
}
}
}
@ -825,6 +839,8 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
boost::replace_all(message2, "7", "t");
for (auto filter : result)
{
if (retrun)
break;
if (boost::contains(message2, filter))
{
if (clear == "")
@ -834,6 +850,9 @@ bool DispatchUserMessage_hook(void *_this, int type, bf_read &buf)
clear += "\n";
}
chat_stack::Say(". " + clear, true);
retrun = true;
lastfilter = filter.c_str();
lastname = name.c_str();
}
}
}