Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "..\Features.h"
- bool Swtich = false;
- static float SentYaw;
- static bool FreestandingSide = false;
- bool leftaa = false;
- bool backaa = false;
- bool rightaa = false;
- struct angle_data
- {
- float angle;
- float thickness;
- angle_data(const float angle, const float thickness) : angle(angle), thickness(thickness) {}
- };
- float quick_normalize(float degree, const float min, const float max) {
- while (degree < min)
- degree += max - min;
- while (degree > max)
- degree -= max - min;
- return degree;
- }
- inline void SinCos(float radians, float* sine, float* cosine)
- {
- *sine = sin(radians);
- *cosine = cos(radians);
- }
- inline void zxdAngleVectors(const QAngle& angles, Vector* forward)
- {
- float sp, sy, cp, cy;
- SinCos(DEG2RAD(angles.y), &sy, &cy);
- SinCos(DEG2RAD(angles.x), &sp, &cp);
- forward->x = cp * cy;
- forward->y = cp * sy;
- forward->z = -sp;
- }
- inline float sseSqrt(float x)
- {
- //return sqrtf(x);
- float root = 0.0f;
- __asm
- {
- sqrtss xmm0, x
- movss root, xmm0
- }
- return root;
- }
- inline void zxdVectorAngles(Vector forward, QAngle& angles)
- {
- //Assert(s_bMathlibInitialized);
- float yaw, pitch;
- if (forward[1] == 0 && forward[0] == 0)
- {
- yaw = 0;
- if (forward[2] > 0)
- pitch = 270;
- else
- pitch = 90;
- }
- else
- {
- yaw = (atan2(forward[1], forward[0]) * 180 / M_PI);
- if (yaw < 0)
- yaw += 360;
- float tmp = sseSqrt(forward[0] * forward[0] + forward[1] * forward[1]);
- pitch = (atan2(-forward[2], tmp) * 180 / M_PI);
- if (pitch < 0)
- pitch += 360;
- }
- angles[0] = pitch;
- angles[1] = yaw;
- angles[2] = 0;
- }
- inline QAngle zxdCalcAngle(const Vector& src, const Vector& dst)
- {
- Vector delta = dst - src;
- QAngle angles;
- zxdVectorAngles(delta, angles);
- return angles;
- }
- void FreeStanding()
- {
- static float FinalAngle;
- bool bside1 = false;
- bool bside2 = false;
- bool autowalld = false;
- float tempdis = 999999999.f;
- Vector2D LocalOrg = Vector2D(g::pLocalEntity->GetOrigin().x, g::pLocalEntity->GetOrigin().y);
- float closeYaw = 999.f;
- for (int i = 1; i <= g_pEngine->GetMaxClients(); ++i)
- {
- C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
- if (!pPlayerEntity
- || !pPlayerEntity->IsAlive()
- || pPlayerEntity->IsDormant()
- || pPlayerEntity == g::pLocalEntity
- || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
- continue;
- Vector2D EnemyOrg = Vector2D(pPlayerEntity->GetOrigin().x, pPlayerEntity->GetOrigin().y);
- if (tempdis > fabs(g_Math.Distance(EnemyOrg, LocalOrg)))
- {
- closeYaw = g_Math.NormalizeYaw(g_Math.CalcAngle(g::pLocalEntity->GetOrigin(), pPlayerEntity->GetOrigin()).y);
- tempdis = fabs(g_Math.Distance(EnemyOrg, LocalOrg));
- }
- if (g_Menu.Config.Freestanding)
- {
- float angToLocal = g_Math.CalcAngle(g::pLocalEntity->GetOrigin(), pPlayerEntity->GetOrigin()).y;
- Vector ViewPoint = pPlayerEntity->GetOrigin() + Vector(0, 0, 90);
- Vector2D Side1 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal))),(45 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
- Vector2D Side2 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(45 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
- Vector2D Side3 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal))),(50 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
- Vector2D Side4 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(50 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
- Vector Origin = g::pLocalEntity->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) };
- for (int side = 0; side < 2; side++)
- {
- Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 80 };
- Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
- if (Autowall::get().CanHitFloatingPoint(OriginAutowall, ViewPoint, pPlayerEntity))
- {
- if (side == 0)
- {
- FreestandingSide = true;
- bside1 = true;
- FinalAngle = angToLocal + 90;
- }
- else if (side == 1)
- {
- FreestandingSide = false;
- bside2 = true;
- FinalAngle = angToLocal - 90;
- }
- autowalld = true;
- }
- else
- {
- for (int side222 = 0; side222 < 2; side222++)
- {
- Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x, Origin.y - OriginLeftRight[side222].y , Origin.z + 80 };
- if (Autowall::get().CanHitFloatingPoint(OriginAutowall222, OriginAutowall2, pPlayerEntity))
- {
- if (side222 == 0)
- {
- FreestandingSide = true;
- bside1 = true;
- FinalAngle = angToLocal + 90;
- }
- else if (side222 == 1)
- {
- FreestandingSide = false;
- bside2 = true;
- FinalAngle = angToLocal - 90;
- }
- autowalld = true;
- }
- }
- }
- }
- }
- }
- }
- bool LBYUpdate()
- {
- static float NextUpdate = 0;
- float Curtime = g_pGlobalVars->curtime;
- auto* AnimState = g::pLocalEntity->AnimState();
- if (!AnimState || !(g::pLocalEntity->GetFlags() & FL_ONGROUND))
- return false;
- if (AnimState->speed_2d > 0.1f)
- NextUpdate = Curtime + 0.22f;
- if (NextUpdate < Curtime)
- {
- NextUpdate = Curtime + 1.1f;
- return true;
- }
- return false;
- }
- void AntiAim::Real()
- {
- auto NetChannel = g_pEngine->GetNetChannel();
- if (!NetChannel)
- return;
- float Yaw = 0.f;
- if (g::bSendPacket)
- {
- switch (g_Menu.Config.Yaw)
- {
- case 0:
- Yaw += 180.f;
- break;
- case 1:
- Yaw += 0.f;//lol
- break;
- case 2:
- Yaw += Swtich ? -90.f : 90.f;
- break;
- case 3:
- Yaw = g_Math.NormalizeYaw(g_pGlobalVars->curtime * 360.f);
- break;
- case 4:
- {
- if (GetAsyncKeyState(Misc::get().keyBindings(g_Menu.Config.LeftKey)))
- {
- g::bSendPacket = (NetChannel->m_nChokedPackets = 1);
- leftaa = true;
- backaa = false;
- rightaa = false;
- }
- else if (GetAsyncKeyState(Misc::get().keyBindings(g_Menu.Config.BackKey)))
- {
- g::bSendPacket = (NetChannel->m_nChokedPackets = 1);
- leftaa = false;
- backaa = true;
- rightaa = false;
- }
- else if (GetAsyncKeyState(Misc::get().keyBindings(g_Menu.Config.RightKey)))
- {
- g::bSendPacket = (NetChannel->m_nChokedPackets = 1);
- leftaa = false;
- backaa = false;
- rightaa = true;
- }
- if (leftaa)
- {
- g::pCmd->viewangles.y += 90.f;
- }
- else if (backaa)
- {
- g::pCmd->viewangles.y += 180.f;
- }
- else if (rightaa)
- {
- g::pCmd->viewangles.y -= 90.f;
- }
- }
- break;
- SentYaw = Yaw;
- FreeStanding();
- if (g_Menu.Config.JitterRange != 0)
- {
- float Offset = g_Menu.Config.JitterRange / 2.f;
- if (!g_Menu.Config.RandJitterInRange)
- {
- Swtich ? g::pCmd->viewangles.y -= Offset : g::pCmd->viewangles.y += Offset;
- }
- else
- {
- static bool oldSwtich = Swtich;
- g::pCmd->viewangles.y -= Offset;
- static int Add = 0;
- if (oldSwtich != Swtich)
- {
- Add = rand() % g_Menu.Config.JitterRange;
- oldSwtich = Swtich;
- }
- g::pCmd->viewangles.y += Add;
- }
- }
- SentYaw = g::pCmd->viewangles.y;
- }
- if (!g::bSendPacket && g::pLocalEntity->AnimState() && g_pEngine->GetNetChannel() && g_Menu.Config.DesyncAngle) // yea i have absolutly no clue on how todo desync just pasted in someting stacker gave me
- {
- auto NetChannel = g_pEngine->GetNetChannel();
- float Delta = g::pLocalEntity->GetMaxDesyncDelta();
- bool LBYUpdateb = LBYUpdate();
- if (!g_Menu.Config.Freestanding)
- if (LBYUpdateb)
- FreestandingSide = !FreestandingSide;
- if (FreestandingSide)
- {
- if (LBYUpdateb)
- g::pCmd->viewangles.y = SentYaw - 120.f;
- else
- g::pCmd->viewangles.y = SentYaw - g::pLocalEntity->AnimState()->speed_2d <= 0.1 ? (Delta + 30.f) : Delta;
- }
- else
- {
- if (LBYUpdateb)
- g::pCmd->viewangles.y = SentYaw + 120.f;
- else
- g::pCmd->viewangles.y = SentYaw + g::pLocalEntity->AnimState()->speed_2d <= 0.1 ? (Delta + 30.f) : Delta;
- }
- }
- else
- g::pCmd->viewangles.y = SentYaw;
- }
- }
- void Pitch()
- {
- switch (g_Menu.Config.Pitch)
- {
- case 0:
- g::pCmd->viewangles.x = 89.9f;
- break;
- case 1:
- g::pCmd->viewangles.x = Swtich ? 991.f : 1080.f;
- break;
- case 2:
- g::pCmd->viewangles.x = 1080.f;
- break;
- case 3:
- {
- static bool chjang = false;
- static float spin = 0;
- if (chjang != Swtich)
- {
- spin += 10.f;
- chjang = Swtich;
- }
- if (spin > 80.f)
- spin = 0.f;
- g::pCmd->viewangles.x = 1080.f - spin;
- }
- break;
- case 4: g::pCmd->viewangles.x = -89.9f; break;
- case 5: g::pCmd->viewangles.x = 991.f; break;
- }
- }
- void AntiAim::OnCreateMove()
- {
- if (!g_pEngine->IsInGame() || !g_Menu.Config.Antiaim || g_Menu.Config.LegitBacktrack)
- return;
- if (g::CheatType != 1)
- return;
- if (!g::pLocalEntity->IsAlive())
- return;
- if (!g::pLocalEntity->GetActiveWeapon() || g::pLocalEntity->IsNade() && g::pLocalEntity->GetActiveWeapon()->m_fThrowTime() > 0.0f) return;
- float flServerTime = g::pLocalEntity->GetTickBase() * g_pGlobalVars->intervalPerTick;
- bool canShoot = (g::pLocalEntity->GetActiveWeapon()->GetNextPrimaryAttack() <= flServerTime);
- if (canShoot && (g::pCmd->buttons & IN_ATTACK))
- return;
- if (g::pCmd->buttons & IN_USE)
- {
- g::bSendPacket = true;
- return;
- }
- if (g::bSendPacket)
- Swtich = !Swtich;
- Pitch();
- Real();
- }
- #include "../rankchanger/zal.h"
- C_AnimState* m_serverAnimState;
- CBaseHandle m_ulEntHandle;
- float m_flSpawnTime;
- void AntiAim::lbycorrectupdate()
- {
- bool allocate = (m_serverAnimState == nullptr);
- bool change = (!allocate) && (g::pLocalEntity->GetRefEHandle() != m_ulEntHandle);
- bool reset = (!allocate && !change) && (g::pLocalEntity->m_flSpawnTime() != m_flSpawnTime) /*&& g_pEngine->IsConnected() && new_round*/;
- if (change)
- g_pMemAlloc->Free(m_serverAnimState);
- if (reset)
- {
- ResetAnimationState(m_serverAnimState);
- m_flSpawnTime = g::pLocalEntity->m_flSpawnTime();
- new_round = false;
- }
- if (allocate || change)
- {
- auto state = reinterpret_cast<C_AnimState*> (g_pMemAlloc->Alloc(0x344));
- if (state != nullptr)
- CreateAnimationState(state, g::pLocalEntity);
- m_ulEntHandle = g::pLocalEntity->GetRefEHandle();
- m_flSpawnTime = g::pLocalEntity->m_flSpawnTime();
- m_serverAnimState = state;
- }
- else if (!g_pClientState->m_choked_commands)
- {
- g_Math.ClampAngles(g::RealAngle);
- UpdateAnimationState(m_serverAnimState, g::RealAngle);
- float delta = std::abs(g::RealAngle.y - g::pLocalEntity->GetLowerBodyYaw());
- if (m_serverAnimState->m_flSpeedNormalized > 0.1f)
- {
- m_flNextBodyUpdate = g_pGlobalVars->curtime + 0.22f;
- }
- else if (g_pGlobalVars->curtime > m_flNextBodyUpdate)
- {
- m_flNextBodyUpdate = g_pGlobalVars->curtime + 1.1f;
- }
- }
- }
- void AntiAim::lbycorrectbreak()
- {
- static float last_real;
- bool no_active = true;
- float bestrotation = 0.f;
- if (!g::pLocalEntity)
- return;
- if (!g::pLocalEntity->GetHealth())
- return;
- float server_time = 2.75 * ((float)g_pGlobalVars->intervalPerTick * g::pLocalEntity->GetTickBase());
- m_bBreakLowerBody = false;
- m_bBreakBalance = false;
- if (m_flNextBodyUpdate < server_time)
- {
- m_flNextBodyUpdate = server_time + 1.1;
- m_bBreakLowerBody = true;
- }
- if (m_flNextBodyUpdate - g_pGlobalVars->intervalPerTick < server_time)
- m_bBreakBalance = true;
- else
- {
- if (!no_active)
- g::pCmd->viewangles.y = RAD2DEG(bestrotation) - 180;
- last_real = g::pCmd->viewangles.y;
- }
- const bool moving_on_ground = g::pLocalEntity->GetVelocity().Length2D() > 0.1;
- if (moving_on_ground)
- {
- m_bBreakLowerBody = false;
- m_bBreakBalance = false;
- }
- if (!(g::pLocalEntity->GetFlags() & FL_ONGROUND))
- {
- m_bBreakLowerBody = false;
- m_bBreakBalance = false;
- }
- }
- void AntiAim::ResetAnimationState(C_AnimState* state)
- {
- using ResetAnimState_t = void(__thiscall*)(C_AnimState*);
- static auto ResetAnimState = (ResetAnimState_t)Utils::FindSignature("client_panorama.dll", "56 6A 01 68 ? ? ? ? 8B F1");
- if (!ResetAnimState)
- return;
- ResetAnimState(state);
- }
- void AntiAim::CreateAnimationState(C_AnimState* state, C_BaseEntity* player)
- {
- using CreateAnimState_t = void(__thiscall*)(C_AnimState*, C_BaseEntity*);
- static auto CreateAnimState = (CreateAnimState_t)Utils::FindSignature("client_panorama.dll", "55 8B EC 56 8B F1 B9 ? ? ? ? C7 46");
- if (!CreateAnimState)
- return;
- CreateAnimState(state, player);
- }
- static uintptr_t UpdateAnimState;
- void AntiAim::UpdateAnimationState(C_AnimState* state, Vector angle)
- {
- if (!state)
- UpdateAnimState = Utils::FindSignature("client_panorama.dll", "55 8B EC 51 56 8B F1 80 BE ? ? ? ? ? 74 36");
- if (!UpdateAnimState)
- return;
- __asm
- {
- mov ecx, state
- movss xmm1, dword ptr[angle + 4]
- movss xmm2, dword ptr[angle]
- call UpdateAnimState
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement