-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Boom here you can have it, its very bad, but also its my first try with a source so. Have a nice day.
Edit: forgot to put Resolver.h xd
C++:
#include "Hooks.h"
#include "Resolver.h"
#include "RageBacktracking.h"
#include "Ragebot.h"
#include "AnimationFix.h"
#include "AntiAims.h"
std::string ResolverMode[65];
int last_ticks[65];
int IBasePlayer::GetChokedPackets() {
auto ticks = TIME_TO_TICKS(GetSimulationTime() - GetOldSimulationTime());
if (ticks == 0 && last_ticks[GetIndex()] > 0) {
return last_ticks[GetIndex()] - 1;
}
else {
last_ticks[GetIndex()] = ticks;
return ticks;
}
}
float CResolver::GetAngle(IBasePlayer* player) {
return Math::NormalizeYaw(player->GetEyeAngles().y); // player->GetEyeAngles().y
}
float CResolver::GetForwardYaw(IBasePlayer* player) {
return Math::NormalizeYaw(GetBackwardYaw(player) - 180.f);
}
float CResolver::GetBackwardYaw(IBasePlayer* player) {
return Math::CalculateAngle(csgo->local->GetOrigin(), player->GetOrigin()).y;
}
float CResolver::GetLeftYaw(IBasePlayer* player) {
return Math::NormalizeYaw(Math::CalculateAngle(csgo->local->GetOrigin(), player->GetOrigin()).y - 90.f);
}
float CResolver::GetRightYaw(IBasePlayer* player) {
return Math::NormalizeYaw(Math::CalculateAngle(csgo->local->GetOrigin(), player->GetOrigin()).y + 90.f);
}
bool CResolver::TargetJitter(IBasePlayer* player, bool v2) {
float yaw = v2 ? GetRightYaw(player) : GetLeftYaw(player);
return fabsf(GetAngle(player) - Math::NormalizeYaw(yaw + 90.f))
>= fabsf(GetAngle(player) - Math::NormalizeYaw(yaw - 90.f));
}
bool CResolver::TargetSide(IBasePlayer* player) {
float yaw = Math::NormalizeYaw(GetBackwardYaw(player));
float angle = GetAngle(player);
return fabsf(angle - Math::NormalizeYaw(yaw + 90.f))
>= fabsf(angle - Math::NormalizeYaw(yaw - 90.f));
}
void CResolver::DetectSide(IBasePlayer* player, int *side)
{
Vector src3D, dst3D, forward, right, up, src, dst;
float back_two, right_two, left_two;
trace_t tr;
Ray_t ray, ray2, ray3, ray4, ray5;
CTraceFilter filter;
Math::AngleVectors(Vector(0, GetBackwardYaw(player), 0), &forward, &right, &up);
filter.pSkip = player;
src3D = player->GetEyePosition();
dst3D = src3D + (forward * 384); //Might want to experiment with other numbers, incase you don't know what the number does, its how far the trace will go. Lower = shorter.
ray.Init(src3D, dst3D);
interfaces.trace->TraceRay(ray, MASK_SHOT, &filter, &tr);
back_two = (tr.endpos - tr.startpos).Length();
ray2.Init(src3D + right * 35, dst3D + right * 35);
interfaces.trace->TraceRay(ray2, MASK_SHOT, &filter, &tr);
right_two = (tr.endpos - tr.startpos).Length();
ray3.Init(src3D - right * 35, dst3D - right * 35);
interfaces.trace->TraceRay(ray3, MASK_SHOT, &filter, &tr);
left_two = (tr.endpos - tr.startpos).Length();
if (left_two > right_two) {
*side = -1;
//Body should be right
}
else if (right_two > left_two) {
*side = 1;
}
else
*side = 0;
}
bool CResolver::DoesHaveJitter(IBasePlayer* player, int *new_side) {
static float LastAngle[64];
static int LastBrute[64];
static bool Switch[64];
static float LastUpdateTime[64];
int i = player->GetIndex();
float CurrentAngle = player->GetEyeAngles().y;
if (!Math::IsNearEqual(CurrentAngle, LastAngle[i], 50.f)) {
Switch[i] = !Switch[i];
LastAngle[i] = CurrentAngle;
*new_side = Switch[i] ? 1 : -1;
LastBrute[i] = *new_side;
LastUpdateTime[i] = interfaces.global_vars->curtime;
return true;
}
else {
if (fabsf(LastUpdateTime[i] - interfaces.global_vars->curtime >= TICKS_TO_TIME(17))
|| player->GetSimulationTime() != player->GetOldSimulationTime()) {
LastAngle[i] = CurrentAngle;
}
*new_side = LastBrute[i];
}
return false;
}
void CResolver::StoreAntifreestand()
{
if (!csgo->local->isAlive())
return;
if (!csgo->weapon->IsGun())
return;
for (int i = 1; i < interfaces.engine->GetMaxClients(); ++i)
{
auto player = interfaces.ent_list->GetClientEntity(i);
if (!player || !player->isAlive() || player->IsDormant() || player->GetTeam() == csgo->local->GetTeam())
continue;
bool Autowalled = false, HitSide1 = false, HitSide2 = false;
auto idx = player->GetIndex();
float angToLocal = Math::CalculateAngle(csgo->local->GetOrigin(), player->GetOrigin()).y;
Vector ViewPoint = csgo->local->GetOrigin() + Vector(0, 0, 90);
Vector2D Side1 = { (45 * sin(DEG2RAD(angToLocal))),(45 * cos(DEG2RAD(angToLocal))) };
Vector2D Side2 = { (45 * sin(DEG2RAD(angToLocal + 180))) ,(45 * cos(DEG2RAD(angToLocal + 180))) };
Vector2D Side3 = { (50 * sin(DEG2RAD(angToLocal))),(50 * cos(DEG2RAD(angToLocal))) };
Vector2D Side4 = { (50 * sin(DEG2RAD(angToLocal + 180))) ,(50 * cos(DEG2RAD(angToLocal + 180))) };
Vector Origin = player->GetOrigin();
Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
float niggaangle = GetAngle(player);
for (int side = 0; side < 2; side++)
{
Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
Vector ViewPointAutowall = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
if (g_AutoWall.CanHitFloatingPoint(OriginAutowall, ViewPoint))
{
if (niggaangle >= 45.f || niggaangle <= -45.f)
{
if (side == 0)
{
HitSide1 = true;
FreestandSide[idx] = 1; // -1
}
else if (side == 1)
{
HitSide2 = true;
FreestandSide[idx] = -1; // 1
}
}
else {
if (side == 0)
{
HitSide1 = true;
FreestandSide[idx] = -1; // -1
}
else if (side == 1)
{
HitSide2 = true;
FreestandSide[idx] = 1; // 1
}
}
Autowalled = true;
}
else
{
for (int sidealternative = 0; sidealternative < 2; sidealternative++)
{
Vector ViewPointAutowallalternative = { Origin.x + OriginLeftRight[sidealternative].x, Origin.y - OriginLeftRight[sidealternative].y , Origin.z + 90 };
if (g_AutoWall.CanHitFloatingPoint(ViewPointAutowallalternative, ViewPointAutowall))
{
if (niggaangle >= 45.f)
{
if (sidealternative == 0)
{
HitSide1 = true;
FreestandSide[idx] = 1;
}
else if (sidealternative == 1)
{
HitSide2 = true;
FreestandSide[idx] = -1;
}
}
else {
if (sidealternative == 0)
{
HitSide1 = true;
FreestandSide[idx] = -1;
}
else if (sidealternative == 1)
{
HitSide2 = true;
FreestandSide[idx] = 1;
}
}
Autowalled = true;
}
}
}
}
}
}
void CResolver::Do(IBasePlayer* player) {
auto animstate = player->GetPlayerAnimState();
if (!animstate)
return;
animstate->m_flGoalFeetYaw = GetAngle(player);
if (!vars.ragebot.resolver)
return;
if (!csgo->local->isAlive())
return;
if (player->GetChokedPackets() <= 0)
return;
int idx = player->GetIndex();
if (player->GetPlayerInfo().fakeplayer)
return;
if (!(player->GetFlags() & FL_ONGROUND))
return;
float angle = GetAngle(player);
{
int dumbynigga = GetAngle(player);
int* dumbnigga = &dumbynigga;
DoesHaveJitter(player, dumbnigga);
if (angle >= 45.f) { // angle >= 45.f
switch (csgo->missedshots[player->GetIndex()] % 4) {
case 0:
for (int i = 1; i <= interfaces.global_vars->maxClients; i++)
{
auto player = csgo->local;
if (!player || !player->isAlive() || player->IsDormant() || player == csgo->local)
continue;
auto feet_yaw = player->GetAnimOverlay(3)->m_flCycle > 0.9f && player->GetAnimOverlay(3)->m_flWeight > 0.9f && player->GetVelocity().Length2D() < 0.1f;
auto body_max_rotation = 89.f;
if (feet_yaw <= 89)
{
if (-89 > feet_yaw)
player->GetEyeAngles().y == body_max_rotation + player->GetEyeAngles().y;
}
else
{
player->GetEyeAngles().y == body_max_rotation - player->GetEyeAngles().y;
}
if (player->GetAnimOverlay(3)->m_flCycle > 0.9)
{
for (int resol_delta = 89.f; resol_delta < -89.f; resol_delta = resol_delta - 90.f)
{
player->GetEyeAngles().y == resol_delta;
}
}
}
break;
case 1:
for (int i = 1; i <= interfaces.global_vars->maxClients; i++)
{
auto player = csgo->local;
if (!player || !player->isAlive() || player->IsDormant() || player == csgo->local)
continue;
auto feet_yaw = player->GetAnimOverlay(3)->m_flCycle > 0.9f && player->GetAnimOverlay(3)->m_flWeight > 0.9f && player->GetVelocity().Length2D() < 0.1f;
auto body_max_rotation = 19.f;
if (feet_yaw <= 19)
{
if (-19 > feet_yaw)
player->GetEyeAngles().y == body_max_rotation + player->GetEyeAngles().y;
}
else
{
player->GetEyeAngles().y == body_max_rotation - player->GetEyeAngles().y;
}
if (player->GetAnimOverlay(3)->m_flCycle > 0.9)
{
for (int resol_delta = 19.f; resol_delta < -19.f; resol_delta = resol_delta - 20.f)
{
player->GetEyeAngles().y == resol_delta;
}
}
}
break;
case 2:
for (int i = 1; i <= interfaces.global_vars->maxClients; i++)
{
auto player = csgo->local;
if (!player || !player->isAlive() || player->IsDormant() || player == csgo->local)
continue;
auto feet_yaw = player->GetAnimOverlay(3)->m_flCycle > 0.9f && player->GetAnimOverlay(3)->m_flWeight > 0.9f && player->GetVelocity().Length2D() < 0.1f;
auto body_max_rotation = 119.f;
if (feet_yaw <= 119)
{
if (-119 > feet_yaw)
player->GetEyeAngles().y == body_max_rotation + player->GetEyeAngles().y;
}
else
{
player->GetEyeAngles().y == body_max_rotation - player->GetEyeAngles().y;
}
if (player->GetAnimOverlay(3)->m_flCycle > 0.9)
{
for (int resol_delta = 119.f; resol_delta < -119.f; resol_delta = resol_delta - 120.f)
{
player->GetEyeAngles().y == resol_delta;
}
}
}
case 3:
for (int i = 1; i <= interfaces.global_vars->maxClients; i++)
{
auto player = csgo->local;
if (!player || !player->isAlive() || player->IsDormant() || player == csgo->local)
continue;
auto feet_yaw = player->GetAnimOverlay(3)->m_flCycle > 0.9f && player->GetAnimOverlay(3)->m_flWeight > 0.9f && player->GetVelocity().Length2D() < 0.1f;
auto body_max_rotation = 179.f;
if (feet_yaw <= 179)
{
if (-179 > feet_yaw)
player->GetEyeAngles().y == body_max_rotation + player->GetEyeAngles().y;
}
else
{
player->GetEyeAngles().y == body_max_rotation - player->GetEyeAngles().y;
}
if (player->GetAnimOverlay(3)->m_flCycle > 0.9)
{
for (int resol_delta = 179.f; resol_delta < -179.f; resol_delta = resol_delta - 180.f)
{
player->GetEyeAngles().y == resol_delta;
}
}
}
break;
default:
for (int i = 1; i <= interfaces.global_vars->maxClients; i++)
{
auto player = csgo->local;
if (!player || !player->isAlive() || player->IsDormant() || player == csgo->local)
continue;
auto feet_yaw = player->GetAnimOverlay(3)->m_flCycle > 0.9f && player->GetAnimOverlay(3)->m_flWeight > 0.9f && player->GetVelocity().Length2D() < 0.1f;
auto body_max_rotation = 90.f;
if (feet_yaw <= 90)
{
if (-90 > feet_yaw)
player->GetEyeAngles().y == body_max_rotation + player->GetEyeAngles().y;
}
else
{
player->GetEyeAngles().y == body_max_rotation - player->GetEyeAngles().y;
}
if (player->GetAnimOverlay(3)->m_flCycle > 0.9)
{
for (int resol_delta = 90.f; resol_delta < -90.f; resol_delta = resol_delta - 90.f)
{
player->GetEyeAngles().y == resol_delta;
}
}
}
}
}
animstate->m_flGoalFeetYaw = Math::NormalizeYaw(animstate->m_flGoalFeetYaw);
}
}
CResolver g_resolver{ };;
void CResolver::ResolveAngles(IBasePlayer* player, CCSGOPlayerAnimState* laino) {
CCSGOPlayerAnimState* state = csgo->local->GetPlayerAnimState();
int idx = player->EntIndex();
float angle = GetAngle(player);
if (!player || !player->isAlive() || player->IsDormant() || player == csgo->local)
auto feet_yaw = player->GetAnimOverlay(3)->m_flCycle > 0.9f && player->GetAnimOverlay(3)->m_flWeight > 0.9f && player->GetVelocity().Length2D() < 0.1f;
auto body_max_rotation = 89.f;
auto animstate = player->GetPlayerAnimState();
int new_side = 0;
//big taps skeet resolver lolololol
if (!player->GetShootsFired()) {
if (angle >= 45.f) {
switch (csgo->missedshots[player->GetIndex()] % 13) {
case 0:
case 1:
animstate->m_flGoalFeetYaw = Math::NormalizeYaw(angle = 90.f * new_side);
break;
case 2:
case 3:
animstate->m_flGoalFeetYaw = Math::NormalizeYaw(angle = 0.f * new_side);
break;
case 4:
case 5:
animstate->m_flGoalFeetYaw = Math::NormalizeYaw(angle = -90.f * new_side);
case 6:
case 7:
state->m_flGoalFeetYaw += 59.0f;
break;
case 8:
state->m_flGoalFeetYaw -= 59.0f;
break;
case 9:
state->m_flGoalFeetYaw -= 78.0f;
break;
case 10:
state->m_flGoalFeetYaw += 78.0f;
break;
case 11:
state->m_flGoalFeetYaw -= state->m_flGoalFeetYaw ? -180 : 180;
break;
case 12:
state->m_flGoalFeetYaw += state->m_flGoalFeetYaw ? -180 : 180;
break;
default:
break;
}
}
// we arrived here we can do the acutal resolve.
//if (record->m_mode == Modes::RESOLVE_STAND)
ResolveStand(player, laino);
}
}
void CResolver::Logic(IBasePlayer* Dlayer)
{
if (!vars.ragebot.resolver)
float tilbake;
for (int i = 1; i <= interfaces.global_vars->maxClients; i++)
{
auto player = csgo->local;
if (!player || !player->isAlive() || player->IsDormant() || player == csgo->local)
return;
auto feet_yaw = player->GetAnimOverlay(3)->m_flCycle > 0.9f && player->GetAnimOverlay(3)->m_flWeight > 0.9f && player->GetVelocity().Length2D() < 0.1f;
auto body_max_rotation = 60.f;
if (feet_yaw <= 60)
{
if (-60 > feet_yaw)
player->GetEyeAngles().y == body_max_rotation + player->GetEyeAngles().y;
}
else
{
player->GetEyeAngles().y == body_max_rotation - player->GetEyeAngles().y;
}
if (player->GetAnimOverlay(3)->m_flCycle > 0, 9)
{
for (int resol_delta = 60.f; resol_delta < -60.f; resol_delta = resol_delta - 60.f)
{
player->GetEyeAngles().y == resol_delta;
}
}
}
}
bool CResolver::Logic1(IBasePlayer* player, int* new_side)
{
int i = player->GetIndex();
float simtime = player->GetSimulationTime();
float oldsimtime = player->GetOldSimulationTime();
float simdiff = simtime - oldsimtime;
auto chokedpackets = TIME_TO_TICKS(max(0, simdiff)); //I may include latency, but i think its not needed, since it would automatically do it for me
if (player->GetPlayerInfo().fakeplayer) // player is a bot
return 0;
if (chokedpackets < 1) // player not desyncing
return 0;
}
__forceinline float GetMaxBodyRotation(IBasePlayer* player, CCSGOPlayerAnimState* laino) {
auto animstate = player->GetPlayerAnimState();
float speedfactor;
if (animstate->m_flFeetSpeedForwardsOrSideWays < 0.f)
speedfactor = 0.f;
else
speedfactor = fminf(animstate->m_flFeetSpeedForwardsOrSideWays, 1.f);
float flYawModifier = (animstate->m_flStopToFullRunningFraction * -.30000001f - .19999999f) * speedfactor;
flYawModifier += 1.f;
if (animstate->m_fDuckAmount > 0.f && animstate->m_flFeetSpeedUnknownForwardOrSideways >= 0.f)
flYawModifier = fminf(animstate->m_flFeetSpeedUnknownForwardOrSideways, 1.f);
return *(float*)((uintptr_t)animstate + 0x334) * flYawModifier;
};
void CResolver::ResolveStand(IBasePlayer* player, CCSGOPlayerAnimState* laino)
{
// get the players max rotation.
float max_rotation = GetMaxBodyRotation(player, laino);
// setup a starting brute angle.
float resolve_value = 90.f;
if (!player->GetBaseEntity())
return;
const auto info = player->GetBaseEntity();
if (!info)
return;
float eye_yaw = laino->m_flEyeYaw;
// clamp our starting brute angle, to not brute an angle, we most likely can't hit.
if (max_rotation < resolve_value)
resolve_value = max_rotation;
// detect if player is using maximum desync.
csgo->should_update_animations = player->GetAnimOverlays()[3].m_flCycle == 0.f && player->GetAnimOverlays()[3].m_flWeight == 0.f;
if (csgo->should_update_animations)
resolve_value = max_rotation;
// resolve shooting players separately.
if (player->GetShootsFired())
return;
// bruteforce player accordingly.
else {
csgo->delta = std::abs(Math::NormalizeYaw(eye_yaw));
float resolve_yaw = ((csgo->delta < 0.f) ? resolve_value : resolve_value);
}
}
// end bro.
C++:
#pragma once
struct animation;
class CResolver
{
private:
float GetLeftYaw(IBasePlayer*);
float GetRightYaw(IBasePlayer*);
bool TargetSide(IBasePlayer*);
void DetectSide(IBasePlayer*, int*);
bool TargetJitter(IBasePlayer*, bool);
bool DoesHaveJitter(IBasePlayer*, int*);
void Logic(IBasePlayer* Dlayer);
bool Logic1(IBasePlayer*, int*);
int FreestandSide[64];
public:
float GetAngle(IBasePlayer*);
float GetForwardYaw(IBasePlayer*);
float GetBackwardYaw(IBasePlayer*);
void Do(IBasePlayer*);
void ResolveAngles(IBasePlayer* player, CCSGOPlayerAnimState* laino);
void ResolveStand(IBasePlayer* player, CCSGOPlayerAnimState* laino);
float ResolveShot(IBasePlayer* player, CCSGOPlayerAnimState* laino);
void StoreAntifreestand();
};
extern CResolver* resolver;
extern std::string ResolverMode[65];