Improve Resolver And backtrack Aimbot

1. Proper resolver reset on dcing players
2. Backtracking now can properly headshot (lol)
This commit is contained in:
LightCat 2018-12-29 23:10:09 +01:00
parent e85990d105
commit 045fbbfc7e
3 changed files with 65 additions and 22 deletions

View File

@ -1003,20 +1003,12 @@ int BestHitbox(CachedEntity *target)
{
headonly = true;
}
// Head only
if (headonly)
{
IF_GAME(IsTF())
return hitbox_t::head;
IF_GAME(IsCSS())
return 12;
}
// If the prefered hitbox vis check passes, use it
namespace bt = hacks::shared::backtrack;
if (IsBacktracking() && !projectile_mode)
{
good_tick = { -1, -1 };
auto ticks = bt::headPositions[target->m_IDX];
namespace bt = hacks::shared::backtrack;
good_tick = { -1, -1 };
auto ticks = bt::headPositions[target->m_IDX];
for (int i = 0; i < 66; i++)
{
if (!ticks->tickcount)
@ -1038,6 +1030,20 @@ int BestHitbox(CachedEntity *target)
break;
}
}
}
// Head only
if (headonly)
{
IF_GAME(IsTF())
return hitbox_t::head;
IF_GAME(IsCSS())
return 12;
}
// If the prefered hitbox vis check passes, use it
if (IsBacktracking() && !projectile_mode)
{
namespace bt = hacks::shared::backtrack;
if (good_tick.first != -1)
if (IsEntityVectorVisible(target, bt::headPositions[target->m_IDX][good_tick.first].hitboxes.at(preferred).center))
return preferred;
@ -1047,6 +1053,7 @@ int BestHitbox(CachedEntity *target)
// Else attempt to find a hitbox at all
if (IsBacktracking() && !projectile_mode && good_tick.first != -1)
{
namespace bt = hacks::shared::backtrack;
for (int i = 0; i < 18; i++)
if (IsEntityVectorVisible(target, bt::headPositions[target->m_IDX][good_tick.first].hitboxes.at(i).center))
return i;

View File

@ -1,7 +1,8 @@
/*
Created on 29.07.18.
*/
* Created on 29.07.18.
*/
#include <common.hpp>
#include <hacks/AntiAntiAim.hpp>
static settings::Bool enable{ "anti-anti-aim.enable", "false" };
@ -45,6 +46,8 @@ void hacks::shared::anti_anti_aim::resolveEnt(int IDX, IClientEntity *entity)
g_Settings.brute.brutenum[IDX] = 0;
brutepitch = !brutepitch;
}
if (quota > 0.8f)
brutepitch = true;
angles.y = fmod(angles.y + 180.0f, 360.0f);
if (angles.y < 0)
angles.y += 360.0f;
@ -74,7 +77,7 @@ void hacks::shared::anti_anti_aim::resolveEnt(int IDX, IClientEntity *entity)
angles.y = 0.0f;
break;
}
if (brutepitch || quota < 0.8f)
if (brutepitch)
switch (g_Settings.brute.brutenum[IDX] % 4)
{
case 0:
@ -91,3 +94,36 @@ void hacks::shared::anti_anti_aim::resolveEnt(int IDX, IClientEntity *entity)
}
}
}
void ResetPlayer(int idx)
{
g_Settings.brute.choke[idx] = {};
g_Settings.brute.brutenum[idx] = 0;
g_Settings.brute.last_angles[idx] = {};
g_Settings.brute.lastsimtime = 0.0f;
}
class ResolverListener : public IGameEventListener
{
public:
virtual void FireGameEvent(KeyValues *event)
{
if (!enable)
return;
std::string name(event->GetName());
if (name == "player_activate")
{
int uid = event->GetInt("userid");
int entity = g_IEngine->GetPlayerForUserID(uid);
ResetPlayer(entity);
}
else if (name == "player_disconnect")
{
int uid = event->GetInt("userid");
int entity = g_IEngine->GetPlayerForUserID(uid);
ResetPlayer(entity);
}
}
};
static ResolverListener listener;
static InitRoutine init([]() { g_IGameEventManager->AddListener(&listener, false); });

View File

@ -50,32 +50,32 @@ public:
}
else if (name == "player_disconnect")
{
logging::Info("removePlayer %d", userid);
//logging::Info("removePlayer %d", userid);
controller->removePlayer(userid);
}
else if (name == "player_team")
{
logging::Info("updatePlayerTeam %d", userid);
//logging::Info("updatePlayerTeam %d", userid);
controller->updatePlayerTeam(userid, event->GetInt("team") - 1);
}
else if (name == "player_changeclass")
{
logging::Info("updatePlayerClass %d", userid);
//logging::Info("updatePlayerClass %d", userid);
controller->updatePlayerClass(userid, event->GetInt("class"));
}
else if (name == "player_changename")
{
logging::Info("updatePlayerName %d", userid);
//logging::Info("updatePlayerName %d", userid);
controller->updatePlayerName(userid, event->GetString("newname"));
}
else if (name == "player_death")
{
logging::Info("updatePlayerLifeState %d", userid);
//logging::Info("updatePlayerLifeState %d", userid);
controller->updatePlayerLifeState(userid, true);
}
else if (name == "player_spawn")
{
logging::Info("updatePlayerLifeState %d", userid);
//logging::Info("updatePlayerLifeState %d", userid);
controller->updatePlayerLifeState(userid, false);
}
}
@ -148,7 +148,7 @@ bool gui::handleSdlEvent(SDL_Event *event)
{
if (event->key.keysym.scancode == (*open_gui_button).scan)
{
logging::Info("GUI open button pressed");
//logging::Info("GUI open button pressed");
zerokernel::Menu::instance->setInGame(!zerokernel::Menu::instance->isInGame());
if (!zerokernel::Menu::instance->isInGame())
{