Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.89 KB | None | 0 0
  1. #include "..\Features.h"
  2.  
  3. bool Swtich = false;
  4. static float SentYaw;
  5. static bool FreestandingSide = false;
  6. bool leftaa = false;
  7. bool backaa = false;
  8. bool rightaa = false;
  9.  
  10. struct angle_data
  11. {
  12. float angle;
  13. float thickness;
  14. angle_data(const float angle, const float thickness) : angle(angle), thickness(thickness) {}
  15. };
  16.  
  17. float quick_normalize(float degree, const float min, const float max) {
  18. while (degree < min)
  19. degree += max - min;
  20. while (degree > max)
  21. degree -= max - min;
  22.  
  23. return degree;
  24. }
  25.  
  26. inline void SinCos(float radians, float* sine, float* cosine)
  27. {
  28. *sine = sin(radians);
  29. *cosine = cos(radians);
  30. }
  31. inline void zxdAngleVectors(const QAngle& angles, Vector* forward)
  32. {
  33. float sp, sy, cp, cy;
  34.  
  35. SinCos(DEG2RAD(angles.y), &sy, &cy);
  36. SinCos(DEG2RAD(angles.x), &sp, &cp);
  37.  
  38. forward->x = cp * cy;
  39. forward->y = cp * sy;
  40. forward->z = -sp;
  41. }
  42. inline float sseSqrt(float x)
  43. {
  44. //return sqrtf(x);
  45.  
  46. float root = 0.0f;
  47.  
  48. __asm
  49. {
  50. sqrtss xmm0, x
  51. movss root, xmm0
  52. }
  53.  
  54. return root;
  55. }
  56. inline void zxdVectorAngles(Vector forward, QAngle& angles)
  57. {
  58. //Assert(s_bMathlibInitialized);
  59. float yaw, pitch;
  60.  
  61. if (forward[1] == 0 && forward[0] == 0)
  62. {
  63. yaw = 0;
  64. if (forward[2] > 0)
  65. pitch = 270;
  66. else
  67. pitch = 90;
  68. }
  69. else
  70. {
  71. yaw = (atan2(forward[1], forward[0]) * 180 / M_PI);
  72. if (yaw < 0)
  73. yaw += 360;
  74.  
  75. float tmp = sseSqrt(forward[0] * forward[0] + forward[1] * forward[1]);
  76. pitch = (atan2(-forward[2], tmp) * 180 / M_PI);
  77. if (pitch < 0)
  78. pitch += 360;
  79. }
  80.  
  81. angles[0] = pitch;
  82. angles[1] = yaw;
  83. angles[2] = 0;
  84. }
  85. inline QAngle zxdCalcAngle(const Vector& src, const Vector& dst)
  86. {
  87. Vector delta = dst - src;
  88. QAngle angles;
  89. zxdVectorAngles(delta, angles);
  90.  
  91. return angles;
  92. }
  93.  
  94.  
  95. void FreeStanding()
  96. {
  97. static float FinalAngle;
  98. bool bside1 = false;
  99. bool bside2 = false;
  100. bool autowalld = false;
  101.  
  102. float tempdis = 999999999.f;
  103. Vector2D LocalOrg = Vector2D(g::pLocalEntity->GetOrigin().x, g::pLocalEntity->GetOrigin().y);
  104.  
  105. float closeYaw = 999.f;
  106.  
  107. for (int i = 1; i <= g_pEngine->GetMaxClients(); ++i)
  108. {
  109. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  110.  
  111. if (!pPlayerEntity
  112. || !pPlayerEntity->IsAlive()
  113. || pPlayerEntity->IsDormant()
  114. || pPlayerEntity == g::pLocalEntity
  115. || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
  116. continue;
  117.  
  118. Vector2D EnemyOrg = Vector2D(pPlayerEntity->GetOrigin().x, pPlayerEntity->GetOrigin().y);
  119.  
  120.  
  121. if (tempdis > fabs(g_Math.Distance(EnemyOrg, LocalOrg)))
  122. {
  123. closeYaw = g_Math.NormalizeYaw(g_Math.CalcAngle(g::pLocalEntity->GetOrigin(), pPlayerEntity->GetOrigin()).y);
  124. tempdis = fabs(g_Math.Distance(EnemyOrg, LocalOrg));
  125. }
  126.  
  127. if (g_Menu.Config.Freestanding)
  128. {
  129. float angToLocal = g_Math.CalcAngle(g::pLocalEntity->GetOrigin(), pPlayerEntity->GetOrigin()).y;
  130. Vector ViewPoint = pPlayerEntity->GetOrigin() + Vector(0, 0, 90);
  131.  
  132. Vector2D Side1 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal))),(45 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
  133. Vector2D Side2 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(45 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  134.  
  135. Vector2D Side3 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal))),(50 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
  136. Vector2D Side4 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(50 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  137.  
  138. Vector Origin = g::pLocalEntity->GetOrigin();
  139.  
  140. Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
  141.  
  142. Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
  143.  
  144. for (int side = 0; side < 2; side++)
  145. {
  146. Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 80 };
  147. Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
  148.  
  149. if (Autowall::get().CanHitFloatingPoint(OriginAutowall, ViewPoint, pPlayerEntity))
  150. {
  151. if (side == 0)
  152. {
  153. FreestandingSide = true;
  154. bside1 = true;
  155. FinalAngle = angToLocal + 90;
  156. }
  157. else if (side == 1)
  158. {
  159. FreestandingSide = false;
  160. bside2 = true;
  161. FinalAngle = angToLocal - 90;
  162. }
  163. autowalld = true;
  164. }
  165. else
  166. {
  167. for (int side222 = 0; side222 < 2; side222++)
  168. {
  169. Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x, Origin.y - OriginLeftRight[side222].y , Origin.z + 80 };
  170.  
  171. if (Autowall::get().CanHitFloatingPoint(OriginAutowall222, OriginAutowall2, pPlayerEntity))
  172. {
  173. if (side222 == 0)
  174. {
  175. FreestandingSide = true;
  176. bside1 = true;
  177. FinalAngle = angToLocal + 90;
  178. }
  179. else if (side222 == 1)
  180. {
  181. FreestandingSide = false;
  182. bside2 = true;
  183. FinalAngle = angToLocal - 90;
  184. }
  185. autowalld = true;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193.  
  194. bool LBYUpdate()
  195. {
  196. static float NextUpdate = 0;
  197. float Curtime = g_pGlobalVars->curtime;
  198. auto* AnimState = g::pLocalEntity->AnimState();
  199.  
  200. if (!AnimState || !(g::pLocalEntity->GetFlags() & FL_ONGROUND))
  201. return false;
  202.  
  203. if (AnimState->speed_2d > 0.1f)
  204. NextUpdate = Curtime + 0.22f;
  205.  
  206. if (NextUpdate < Curtime)
  207. {
  208. NextUpdate = Curtime + 1.1f;
  209. return true;
  210. }
  211.  
  212. return false;
  213. }
  214.  
  215. void AntiAim::Real()
  216. {
  217. auto NetChannel = g_pEngine->GetNetChannel();
  218. if (!NetChannel)
  219. return;
  220. float Yaw = 0.f;
  221. if (g::bSendPacket)
  222. {
  223. switch (g_Menu.Config.Yaw)
  224. {
  225. case 0:
  226. Yaw += 180.f;
  227. break;
  228. case 1:
  229. Yaw += 0.f;//lol
  230. break;
  231. case 2:
  232. Yaw += Swtich ? -90.f : 90.f;
  233. break;
  234. case 3:
  235. Yaw = g_Math.NormalizeYaw(g_pGlobalVars->curtime * 360.f);
  236. break;
  237. case 4:
  238. {
  239. if (GetAsyncKeyState(Misc::get().keyBindings(g_Menu.Config.LeftKey)))
  240. {
  241. g::bSendPacket = (NetChannel->m_nChokedPackets = 1);
  242. leftaa = true;
  243. backaa = false;
  244. rightaa = false;
  245. }
  246. else if (GetAsyncKeyState(Misc::get().keyBindings(g_Menu.Config.BackKey)))
  247. {
  248. g::bSendPacket = (NetChannel->m_nChokedPackets = 1);
  249. leftaa = false;
  250. backaa = true;
  251. rightaa = false;
  252. }
  253. else if (GetAsyncKeyState(Misc::get().keyBindings(g_Menu.Config.RightKey)))
  254. {
  255. g::bSendPacket = (NetChannel->m_nChokedPackets = 1);
  256. leftaa = false;
  257. backaa = false;
  258. rightaa = true;
  259. }
  260.  
  261. if (leftaa)
  262. {
  263. g::pCmd->viewangles.y += 90.f;
  264. }
  265. else if (backaa)
  266. {
  267. g::pCmd->viewangles.y += 180.f;
  268. }
  269. else if (rightaa)
  270. {
  271. g::pCmd->viewangles.y -= 90.f;
  272. }
  273. }
  274. break;
  275.  
  276. SentYaw = Yaw;
  277.  
  278. FreeStanding();
  279.  
  280. if (g_Menu.Config.JitterRange != 0)
  281. {
  282. float Offset = g_Menu.Config.JitterRange / 2.f;
  283.  
  284. if (!g_Menu.Config.RandJitterInRange)
  285. {
  286. Swtich ? g::pCmd->viewangles.y -= Offset : g::pCmd->viewangles.y += Offset;
  287. }
  288. else
  289. {
  290. static bool oldSwtich = Swtich;
  291.  
  292. g::pCmd->viewangles.y -= Offset;
  293.  
  294. static int Add = 0;
  295.  
  296. if (oldSwtich != Swtich)
  297. {
  298. Add = rand() % g_Menu.Config.JitterRange;
  299. oldSwtich = Swtich;
  300. }
  301.  
  302. g::pCmd->viewangles.y += Add;
  303. }
  304. }
  305.  
  306. SentYaw = g::pCmd->viewangles.y;
  307. }
  308.  
  309. 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
  310. {
  311. auto NetChannel = g_pEngine->GetNetChannel();
  312. float Delta = g::pLocalEntity->GetMaxDesyncDelta();
  313. bool LBYUpdateb = LBYUpdate();
  314.  
  315. if (!g_Menu.Config.Freestanding)
  316. if (LBYUpdateb)
  317. FreestandingSide = !FreestandingSide;
  318.  
  319. if (FreestandingSide)
  320. {
  321. if (LBYUpdateb)
  322. g::pCmd->viewangles.y = SentYaw - 120.f;
  323. else
  324. g::pCmd->viewangles.y = SentYaw - g::pLocalEntity->AnimState()->speed_2d <= 0.1 ? (Delta + 30.f) : Delta;
  325. }
  326. else
  327. {
  328. if (LBYUpdateb)
  329. g::pCmd->viewangles.y = SentYaw + 120.f;
  330. else
  331. g::pCmd->viewangles.y = SentYaw + g::pLocalEntity->AnimState()->speed_2d <= 0.1 ? (Delta + 30.f) : Delta;
  332. }
  333. }
  334. else
  335. g::pCmd->viewangles.y = SentYaw;
  336. }
  337. }
  338.  
  339. void Pitch()
  340. {
  341. switch (g_Menu.Config.Pitch)
  342. {
  343. case 0:
  344. g::pCmd->viewangles.x = 89.9f;
  345. break;
  346. case 1:
  347. g::pCmd->viewangles.x = Swtich ? 991.f : 1080.f;
  348. break;
  349. case 2:
  350. g::pCmd->viewangles.x = 1080.f;
  351. break;
  352. case 3:
  353. {
  354. static bool chjang = false;
  355. static float spin = 0;
  356. if (chjang != Swtich)
  357. {
  358. spin += 10.f;
  359. chjang = Swtich;
  360. }
  361.  
  362. if (spin > 80.f)
  363. spin = 0.f;
  364.  
  365. g::pCmd->viewangles.x = 1080.f - spin;
  366. }
  367.  
  368. break;
  369.  
  370. case 4: g::pCmd->viewangles.x = -89.9f; break;
  371. case 5: g::pCmd->viewangles.x = 991.f; break;
  372. }
  373. }
  374.  
  375. void AntiAim::OnCreateMove()
  376. {
  377. if (!g_pEngine->IsInGame() || !g_Menu.Config.Antiaim || g_Menu.Config.LegitBacktrack)
  378. return;
  379.  
  380. if (g::CheatType != 1)
  381. return;
  382.  
  383. if (!g::pLocalEntity->IsAlive())
  384. return;
  385.  
  386.  
  387.  
  388. if (!g::pLocalEntity->GetActiveWeapon() || g::pLocalEntity->IsNade() && g::pLocalEntity->GetActiveWeapon()->m_fThrowTime() > 0.0f) return;
  389.  
  390. float flServerTime = g::pLocalEntity->GetTickBase() * g_pGlobalVars->intervalPerTick;
  391. bool canShoot = (g::pLocalEntity->GetActiveWeapon()->GetNextPrimaryAttack() <= flServerTime);
  392.  
  393. if (canShoot && (g::pCmd->buttons & IN_ATTACK))
  394. return;
  395.  
  396. if (g::pCmd->buttons & IN_USE)
  397. {
  398. g::bSendPacket = true;
  399. return;
  400. }
  401.  
  402. if (g::bSendPacket)
  403. Swtich = !Swtich;
  404.  
  405. Pitch();
  406. Real();
  407. }
  408. #include "../rankchanger/zal.h"
  409. C_AnimState* m_serverAnimState;
  410. CBaseHandle m_ulEntHandle;
  411. float m_flSpawnTime;
  412. void AntiAim::lbycorrectupdate()
  413. {
  414. bool allocate = (m_serverAnimState == nullptr);
  415. bool change = (!allocate) && (g::pLocalEntity->GetRefEHandle() != m_ulEntHandle);
  416. bool reset = (!allocate && !change) && (g::pLocalEntity->m_flSpawnTime() != m_flSpawnTime) /*&& g_pEngine->IsConnected() && new_round*/;
  417. if (change)
  418. g_pMemAlloc->Free(m_serverAnimState);
  419.  
  420. if (reset)
  421. {
  422. ResetAnimationState(m_serverAnimState);
  423. m_flSpawnTime = g::pLocalEntity->m_flSpawnTime();
  424. new_round = false;
  425. }
  426.  
  427. if (allocate || change)
  428. {
  429. auto state = reinterpret_cast<C_AnimState*> (g_pMemAlloc->Alloc(0x344));
  430.  
  431. if (state != nullptr)
  432. CreateAnimationState(state, g::pLocalEntity);
  433.  
  434. m_ulEntHandle = g::pLocalEntity->GetRefEHandle();
  435. m_flSpawnTime = g::pLocalEntity->m_flSpawnTime();
  436.  
  437. m_serverAnimState = state;
  438. }
  439.  
  440. else if (!g_pClientState->m_choked_commands)
  441. {
  442.  
  443. g_Math.ClampAngles(g::RealAngle);
  444.  
  445. UpdateAnimationState(m_serverAnimState, g::RealAngle);
  446.  
  447. float delta = std::abs(g::RealAngle.y - g::pLocalEntity->GetLowerBodyYaw());
  448.  
  449. if (m_serverAnimState->m_flSpeedNormalized > 0.1f)
  450. {
  451. m_flNextBodyUpdate = g_pGlobalVars->curtime + 0.22f;
  452. }
  453. else if (g_pGlobalVars->curtime > m_flNextBodyUpdate)
  454. {
  455. m_flNextBodyUpdate = g_pGlobalVars->curtime + 1.1f;
  456. }
  457. }
  458. }
  459.  
  460.  
  461.  
  462. void AntiAim::lbycorrectbreak()
  463. {
  464. static float last_real;
  465. bool no_active = true;
  466. float bestrotation = 0.f;
  467.  
  468. if (!g::pLocalEntity)
  469. return;
  470.  
  471. if (!g::pLocalEntity->GetHealth())
  472. return;
  473.  
  474. float server_time = 2.75 * ((float)g_pGlobalVars->intervalPerTick * g::pLocalEntity->GetTickBase());
  475.  
  476. m_bBreakLowerBody = false;
  477. m_bBreakBalance = false;
  478.  
  479. if (m_flNextBodyUpdate < server_time)
  480. {
  481. m_flNextBodyUpdate = server_time + 1.1;
  482. m_bBreakLowerBody = true;
  483. }
  484.  
  485. if (m_flNextBodyUpdate - g_pGlobalVars->intervalPerTick < server_time)
  486. m_bBreakBalance = true;
  487. else
  488. {
  489. if (!no_active)
  490. g::pCmd->viewangles.y = RAD2DEG(bestrotation) - 180;
  491.  
  492. last_real = g::pCmd->viewangles.y;
  493. }
  494.  
  495.  
  496. const bool moving_on_ground = g::pLocalEntity->GetVelocity().Length2D() > 0.1;
  497.  
  498. if (moving_on_ground)
  499. {
  500. m_bBreakLowerBody = false;
  501. m_bBreakBalance = false;
  502. }
  503.  
  504. if (!(g::pLocalEntity->GetFlags() & FL_ONGROUND))
  505. {
  506. m_bBreakLowerBody = false;
  507. m_bBreakBalance = false;
  508. }
  509. }
  510.  
  511.  
  512.  
  513. void AntiAim::ResetAnimationState(C_AnimState* state)
  514. {
  515. using ResetAnimState_t = void(__thiscall*)(C_AnimState*);
  516. static auto ResetAnimState = (ResetAnimState_t)Utils::FindSignature("client_panorama.dll", "56 6A 01 68 ? ? ? ? 8B F1");
  517. if (!ResetAnimState)
  518. return;
  519.  
  520. ResetAnimState(state);
  521. }
  522.  
  523. void AntiAim::CreateAnimationState(C_AnimState* state, C_BaseEntity* player)
  524. {
  525. using CreateAnimState_t = void(__thiscall*)(C_AnimState*, C_BaseEntity*);
  526. static auto CreateAnimState = (CreateAnimState_t)Utils::FindSignature("client_panorama.dll", "55 8B EC 56 8B F1 B9 ? ? ? ? C7 46");
  527. if (!CreateAnimState)
  528. return;
  529.  
  530. CreateAnimState(state, player);
  531. }
  532.  
  533. static uintptr_t UpdateAnimState;
  534. void AntiAim::UpdateAnimationState(C_AnimState* state, Vector angle)
  535. {
  536. if (!state)
  537. UpdateAnimState = Utils::FindSignature("client_panorama.dll", "55 8B EC 51 56 8B F1 80 BE ? ? ? ? ? 74 36");
  538. if (!UpdateAnimState)
  539. return;
  540. __asm
  541. {
  542. mov ecx, state
  543.  
  544. movss xmm1, dword ptr[angle + 4]
  545. movss xmm2, dword ptr[angle]
  546.  
  547. call UpdateAnimState
  548. }
  549. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement