demotrain demotrain demotrain

This commit is contained in:
LightCat 2018-09-29 17:52:41 +02:00
parent a32379271f
commit 2a28ea8f88
6 changed files with 133 additions and 93 deletions

View File

@ -1,71 +0,0 @@
//
// Created by bencat07 on 28.09.18.
//
#include "common.hpp"
#include <settings/Bool.hpp>
#include <settings/Int.hpp>
#include <settings/Key.hpp>
static settings::Bool enable{ "sandwichaim.enable", "false" };
static settings::Button aimkey{ "sandwichaim.aimkey", "<null>" };
static settings::Int aimkey_mode{ "sandwichaim.aimkey-mode", "0" };
float sandwich_speed = 350.0f;
float grav = 0.5f;
static HookedFunction
CreateMove(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
if (!*enable)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
return;
if (aimkey)
{
switch (*aimkey_mode)
{
case 1:
if (!aimkey.isKeyDown())
return;
break;
case 2:
if (aimkey.isKeyDown())
return;
break;
default:
break;
}
}
if (LOCAL_W->m_iClassID() != CL_CLASS(CTFLunchBox))
return;
Vector Predict;
CachedEntity *bestent = nullptr;
float bestscr = FLT_MAX;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !(ent->m_bAlivePlayer()) ||
ent->m_iTeam() != LOCAL_E->m_iTeam() || ent == LOCAL_E)
continue;
Vector target = ProjectilePrediction(ent, 1, sandwich_speed, grav,
PlayerGravityMod(ent));
if (!IsEntityVectorVisible(ent, target))
continue;
float scr = ent->m_flDistance();
if (scr < bestscr)
{
bestent = ent;
Predict = target;
bestscr = scr;
}
}
if (bestent)
{
Vector tr = Predict - g_pLocalPlayer->v_Eye;
Vector angles;
VectorAngles(tr, angles);
// Clamping is important
fClampAngle(angles);
current_user_cmd->viewangles = angles;
current_user_cmd->buttons |= IN_ATTACK2;
g_pLocalPlayer->bUseSilentAngles = true;
}
});

View File

@ -7,7 +7,7 @@ if(NOT LagbotMode)
target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Achievement.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Aimbot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/AimSandwich.cpp"
"${CMAKE_CURRENT_LIST_DIR}/MiscAimbot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Announcer.cpp"
"${CMAKE_CURRENT_LIST_DIR}/AntiAim.cpp"
"${CMAKE_CURRENT_LIST_DIR}/AntiAntiAim.cpp"

View File

@ -25,14 +25,14 @@ const std::string tf_classes_killsay[] = { "class", "scout", "sniper",
const std::string tf_teams_killsay[] = { "RED", "BLU" };
static std::string lastmsg = "";
static std::string lastmsg{};
TextFile file{};
std::string ComposeKillSay(IGameEvent *event)
{
const std::vector<std::string> *source = nullptr;
switch ((int) killsay_mode)
switch (*killsay_mode)
{
case 1:
source = &file.lines;
@ -46,8 +46,10 @@ std::string ComposeKillSay(IGameEvent *event)
case 4:
source = &builtin_nonecore_mlg;
break;
default:
break;
}
if (!source || source->size() == 0)
if (!source || source->empty())
return "";
if (!event)
return "";
@ -58,23 +60,18 @@ std::string ComposeKillSay(IGameEvent *event)
if (g_IEngine->GetPlayerForUserID(kid) != g_IEngine->GetLocalPlayer())
return "";
std::string msg = source->at(rand() % source->size());
if (source->size() != 1)
{
// checks if the killsays.txt file is not 1 line. 100% sure it's going
//to crash if it is.
while (msg == lastmsg)
{
msg = source->at(rand() % source->size());
}
lastmsg = msg;
}
player_info_s info;
// checks if the killsays.txt file is not 1 line. 100% sure it's going
// to crash if it is.
while (msg == lastmsg && source->size() > 1)
msg = source->at(rand() % source->size());
lastmsg = msg;
player_info_s info{};
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(vid), &info);
ReplaceString(msg, "%name%", std::string(info.name));
CachedEntity *ent = ENTITY(g_IEngine->GetPlayerForUserID(vid));
int clz = g_pPlayerResource->GetClass(ent);
ReplaceString(msg, "%class%", tf_classes_killsay[clz]);
player_info_s infok;
player_info_s infok{};
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(kid), &infok);
ReplaceString(msg, "%killer%", std::string(infok.name));
ReplaceString(msg, "%team%", tf_teams_killsay[ent->m_iTeam() - 2]);
@ -92,10 +89,8 @@ class KillSayEventListener : public IGameEventListener2
if (!killsay_mode)
return;
std::string message = hacks::shared::killsay::ComposeKillSay(event);
if (message.size())
{
if (!message.empty())
chat_stack::Say(message, false);
}
}
};
@ -128,7 +123,7 @@ const std::vector<std::string> builtin_default = {
"You must really like that respawn timer, %name%.",
"If your main is %class%, you should give up.",
"Hey %name%, i see you can't play %class%. Try quitting the game."
"Hey %name%, i see you can't play %class%. Try quitting the game.",
"%team% is filled with spergs",
"%name%@gmail.com to vacreview@valvesoftware.com\nFOUND CHEATER",
"\n☐ Not rekt\n ☑ Rekt\n ☑ Really Rekt\n ☑ Tyrannosaurus Rekt"

116
src/hacks/MiscAimbot.cpp Normal file
View File

@ -0,0 +1,116 @@
//
// Created by bencat07 on 28.09.18.
//
#include "common.hpp"
#include <settings/Bool.hpp>
#include <settings/Int.hpp>
#include <settings/Key.hpp>
static settings::Bool enable{ "sandwichaim.enable", "false" };
static settings::Button aimkey{ "sandwichaim.aimkey", "<null>" };
static settings::Int aimkey_mode{ "sandwichaim.aimkey-mode", "0" };
float sandwich_speed = 350.0f;
float grav = 0.25f;
std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool zcheck)
{
CachedEntity *bestent = nullptr;
float bestscr = FLT_MAX;
Vector predicted{};
for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !(ent->m_bAlivePlayer()) ||
(teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) || ent == LOCAL_E)
continue;
if (!teammate && ent->m_iTeam() == LOCAL_E->m_iTeam())
continue;
if (!ent->hitboxes.GetHitbox(1))
continue;
Vector target{};
if (Predict)
target = ProjectilePrediction(ent, 1, sandwich_speed, grav,
PlayerGravityMod(ent));
else
target = ent->hitboxes.GetHitbox(1)->center;
if (!IsEntityVectorVisible(ent, target))
continue;
if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f)
continue;
float scr = ent->m_flDistance();
if (g_pPlayerResource->GetClass(ent) == tf_medic)
scr *= 0.1f;
if (scr < bestscr)
{
bestent = ent;
predicted = target;
bestscr = scr;
}
}
return {bestent, predicted};
}
static HookedFunction
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
if (!*enable)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
return;
if (aimkey)
{
switch (*aimkey_mode)
{
case 1:
if (!aimkey.isKeyDown())
return;
break;
case 2:
if (aimkey.isKeyDown())
return;
break;
default:
break;
}
}
if (LOCAL_W->m_iClassID() != CL_CLASS(CTFLunchBox))
return;
Vector Predict;
CachedEntity *bestent = nullptr;
std::pair<CachedEntity *, Vector> result{};
result = FindBestEnt(true, true, false);
bestent = result.first;
Predict = result.second;
if (bestent)
{
Vector tr = Predict - g_pLocalPlayer->v_Eye;
Vector angles;
VectorAngles(tr, angles);
// Clamping is important
fClampAngle(angles);
current_user_cmd->viewangles = angles;
current_user_cmd->buttons |= IN_ATTACK2;
g_pLocalPlayer->bUseSilentAngles = true;
}
});
static settings::Bool charge_aim{ "chargeaim.enable", "false"};
static HookedFunction ChargeAimbot(HookedFunctions_types::HF_CreateMove, "ChargeAim", 1, [](){
if (!*charge_aim)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;
std::pair<CachedEntity *, Vector> result{};
result = FindBestEnt(false, false, true);
CachedEntity *bestent = result.first;
if (bestent && result.second.IsValid())
{
Vector tr = result.second - g_pLocalPlayer->v_Eye;
Vector angles;
VectorAngles(tr, angles);
// Clamping is important
fClampAngle(angles);
current_user_cmd->viewangles = angles;
current_user_cmd->buttons |= IN_ATTACK2;
g_pLocalPlayer->bUseSilentAngles = true;
}
});

View File

@ -150,7 +150,7 @@ CatCommand debug_get_ingame_ipc(
int count = 0;
unsigned highest = 0;
std::vector<unsigned> botlist{};
for (unsigned i = 1; 0 < cat_ipc::max_peers; i++)
for (unsigned i = 1; i < cat_ipc::max_peers; i++)
{
if (!ipc::peer->memory->peer_data[i].free)
{

View File

@ -42,7 +42,7 @@ void Update()
Vector abs_orig = RAW_ENT(ent)->GetAbsOrigin();
float movement = prevloc[i].DistTo(abs_orig);
logging::Info("movement: %f", movement);
prevloc[i] = abs_orig;
prevloc[i] = abs_orig;
const Vector &v = ent->m_vecVelocity;
const Vector &a = ent->m_vecAcceleration;
Vector eav;