Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.15 KB | None | 0 0
  1. #include "hooks.h"
  2. #include "global.h"
  3. #include "Menu.h"
  4. #include "BacktrackingHelper.h"
  5. #include "xor.h"
  6. #include <intrin.h>
  7. #include "SpoofedConvar.h"
  8. #include "Math.h"
  9. #include "Skinchanger.h"
  10. #include "Items.h"
  11. #include <deque>
  12.  
  13. #define INVALID_EHANDLE_INDEX 0xFFFFFFFF
  14.  
  15. #define TICK_INTERVAL (g_pGlobals->interval_per_tick)
  16. #define TIME_TO_TICKS(dt) ((int)(0.5f + (float)(dt) / TICK_INTERVAL))
  17. #define TICKS_TO_TIME(t) (TICK_INTERVAL * (t))
  18.  
  19. ConVar* mp_facefronttime;
  20. ConVar* r_DrawSpecificStaticProp;
  21.  
  22. DWORD eyeangles;
  23. int Shots;
  24.  
  25.  
  26. struct STickRecord
  27. {
  28. void SaveRecord(CBaseEntity *player)
  29. {
  30. m_flLowerBodyYawTarget = player->LowerBodyYaw();;
  31. m_angEyeAngles = player->GetEyeAngles();
  32. m_flSimulationTime = player->GetSimulationTime();
  33. m_flPoseParameter = player->m_flPoseParameter();
  34. m_flCurTime = g_pGlobals->curtime;
  35. m_nFlags = *player->GetFlags();
  36. m_flVelocity = player->Velocity().Length2D();
  37. m_vecVelocity = player->Velocity();
  38.  
  39. m_iLayerCount = player->GetNumAnimOverlays();
  40. for (int i = 0; i < m_iLayerCount; i++)
  41. animationLayer[i] = player->GetAnimOverlays()[i];
  42. }
  43.  
  44. bool operator==(STickRecord &other)
  45. {
  46. return other.m_flSimulationTime == m_flSimulationTime;
  47. }
  48. int tickcount = 0;
  49. float m_flVelocity = 0.f;
  50. Vector m_vecVelocity = Vector(0, 0, 0);
  51. float m_flSimulationTime = 0.f;
  52. float m_flLowerBodyYawTarget = 0.f;
  53. Vector m_angEyeAngles = Vector(0, 0, 0);
  54. std::array<float, 24> m_flPoseParameter = {};
  55. float m_flCurTime = 0.f;
  56. int m_nFlags = 0;
  57.  
  58. int m_iLayerCount = 0;
  59. AnimationLayer animationLayer[15];
  60. };
  61.  
  62.  
  63. struct SResolveInfo
  64. {
  65. std::deque<STickRecord> arr_tickRecords;
  66.  
  67. STickRecord curTickRecord;
  68. STickRecord prevTickRecord;
  69.  
  70. float m_flLastLbyTime = 0.f;
  71.  
  72. Vector m_angDirectionFirstMoving = Vector(0, 0, 0);
  73. };
  74.  
  75. bool IsAdjustingBalance(CBaseEntity *player, STickRecord &record, AnimationLayer *layer)
  76. {
  77. for (int i = 0; i < record.m_iLayerCount; i++)
  78. {
  79. const int activity = player->GetSequenceActivity(record.animationLayer[i].m_nSequence);
  80. if (activity == 979)
  81. {
  82. *layer = record.animationLayer[i];
  83. return true;
  84. }
  85. }
  86. return false;
  87. }
  88.  
  89.  
  90. int get_model_index(int item_def_index)
  91. {
  92. int ret = 0;
  93. switch (item_def_index) {
  94. case KNIFE:
  95. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_default_ct.mdl"));
  96. break;
  97. case KNIFE_T:
  98. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_default_t.mdl"));
  99. break;
  100. case KNIFE_KARAMBIT:
  101. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_karam.mdl"));
  102. break;
  103. case KNIFE_BAYONET:
  104. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_bayonet.mdl"));
  105. break;
  106. case KNIFE_M9_BAYONET:
  107. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_m9_bay.mdl"));
  108. break;
  109. case KNIFE_TACTICAL:
  110. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_tactical.mdl"));
  111. break;
  112. case KNIFE_GUT:
  113. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_gut.mdl"));
  114. break;
  115. case KNIFE_FALCHION:
  116. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_falchion_advanced.mdl"));
  117. break;
  118. case KNIFE_PUSH:
  119. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_push.mdl"));
  120. break;
  121. case KNIFE_BUTTERFLY:
  122. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_butterfly.mdl"));
  123. break;
  124. case KNIFE_FLIP:
  125. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_flip.mdl"));
  126. break;
  127. case KNIFE_BOWIE:
  128. ret = g_pModelInfo->GetModelIndex(XorStr("models/weapons/v_knife_survival_bowie.mdl"));
  129. break;
  130. default:
  131. break;
  132. }
  133. return ret;
  134. }
  135.  
  136. std::vector<const char*> vistasmoke_mats = {
  137. "particle/vistasmokev1/vistasmokev1_fire",
  138. "particle/vistasmokev1/vistasmokev1_smokegrenade",
  139. "particle/vistasmokev1/vistasmokev1_emods",
  140. "particle/vistasmokev1/vistasmokev1_emods_impactdust",
  141. };
  142.  
  143. std::vector<const char*> smoke_materials = {
  144. "particle/beam_smoke_01",
  145. "particle/particle_smokegrenade",
  146. "particle/particle_smokegrenade1",
  147. "particle/particle_smokegrenade2",
  148. "particle/particle_smokegrenade3",
  149. "particle/particle_smokegrenade_sc",
  150. "particle/smoke1/smoke1",
  151. "particle/smoke1/smoke1_ash",
  152. "particle/smoke1/smoke1_nearcull",
  153. "particle/smoke1/smoke1_nearcull2",
  154. "particle/smoke1/smoke1_snow",
  155. "particle/smokesprites_0001",
  156. "particle/smokestack",
  157. "particle/vistasmokev1/vistasmokev1",
  158. "particle/vistasmokev1/vistasmokev1_emods",
  159. "particle/vistasmokev1/vistasmokev1_emods_impactdust",
  160. "particle/vistasmokev1/vistasmokev1_fire",
  161. "particle/vistasmokev1/vistasmokev1_nearcull",
  162. "particle/vistasmokev1/vistasmokev1_nearcull_fog",
  163. "particle/vistasmokev1/vistasmokev1_nearcull_nodepth",
  164. "particle/vistasmokev1/vistasmokev1_smokegrenade",
  165. "particle/vistasmokev1/vistasmokev4_emods_nocull",
  166. "particle/vistasmokev1/vistasmokev4_nearcull",
  167. "particle/vistasmokev1/vistasmokev4_nocull"
  168. };
  169.  
  170.  
  171.  
  172. bool lowerBodyYawUpdated(CBaseEntity* pEntity)
  173. {
  174. for (int w = 0; w < 13; w++) {
  175. AnimationLayer currentLayer = pEntity->GetAnimOverlay(w);
  176. const int activity = pEntity->GetSequenceActivity(currentLayer.m_nSequence);
  177. float flcycle = currentLayer.m_flCycle, flprevcycle = currentLayer.m_flPrevCycle, flweight = currentLayer.m_flWeight, flweightdatarate = currentLayer.m_flWeightDeltaRate;
  178. uint32_t norder = currentLayer.m_nOrder;
  179. if (activity == 973 && flweight == 1.f || activity == 979 && flweight == 1.0f && currentLayer.m_flPrevCycle != currentLayer.m_flCycle)
  180.  
  181. return true;
  182. }
  183. return false;
  184. }
  185.  
  186. bool BreakingMoreThan120(CBaseEntity* pEntity)
  187. {
  188. for (int w = 0; w < 13; w++) {
  189. AnimationLayer prevlayer;
  190. AnimationLayer currentLayer = pEntity->GetAnimOverlay(w);
  191. const int activity = pEntity->GetSequenceActivity(currentLayer.m_nSequence);
  192. float flcycle = currentLayer.m_flCycle, flprevcycle = currentLayer.m_flPrevCycle, flweight = currentLayer.m_flWeight, flweightdatarate = currentLayer.m_flWeightDeltaRate;
  193. uint32_t norder = currentLayer.m_nOrder;
  194. if (activity == ACT_CSGO_IDLE_ADJUST_STOPPEDMOVING || activity == ACT_CSGO_IDLE_TURN_BALANCEADJUST && flweight >= .99 && currentLayer.m_flPrevCycle != currentLayer.m_flCycle) {
  195. float flanimTime = currentLayer.m_flCycle, flsimtime = pEntity->GetSimulationTime();
  196.  
  197. return true;
  198. }
  199. prevlayer = currentLayer;
  200. return false;
  201. }
  202. return false;
  203. }
  204.  
  205. bool Under120(CBaseEntity* pEntity)
  206. {
  207. for (int w = 0; w < 13; w++) {
  208. AnimationLayer prevlayer;
  209. AnimationLayer currentLayer = pEntity->GetAnimOverlay(w);
  210. const int activity = pEntity->GetSequenceActivity(currentLayer.m_nSequence);
  211. float flcycle = currentLayer.m_flCycle, flprevcycle = currentLayer.m_flPrevCycle, flweight = currentLayer.m_flWeight, flweightdatarate = currentLayer.m_flWeightDeltaRate;
  212. uint32_t norder = currentLayer.m_nOrder;
  213. if (activity == 979 && currentLayer.m_flWeight == 0.f && currentLayer.m_flPrevCycle != currentLayer.m_flCycle) {
  214. return true;
  215. }
  216. prevlayer = currentLayer;
  217. }
  218. return false;
  219. }
  220.  
  221. bool playerStoppedMoving(CBaseEntity* pEntity)
  222. {
  223. for (int w = 0; w < 13; w++) {
  224. AnimationLayer currentLayer = pEntity->GetAnimOverlay(w);
  225. const int activity = pEntity->GetSequenceActivity(currentLayer.m_nSequence);
  226. float flcycle = currentLayer.m_flCycle, flprevcycle = currentLayer.m_flPrevCycle, flweight = currentLayer.m_flWeight, flweightdatarate = currentLayer.m_flWeightDeltaRate;
  227. uint32_t norder = currentLayer.m_nOrder;
  228. if (activity == ACT_CSGO_IDLE_ADJUST_STOPPEDMOVING)
  229. return true;
  230. }
  231. return false;
  232. }
  233.  
  234. bool lastLbyupdate(CBaseEntity* pEntity)
  235. {
  236. static float prediction = 0.f;
  237. static bool secondrun = false;
  238. float flServerTime = (float)pEntity->GetTickBase() * g_pGlobals->interval_per_tick;
  239. if (playerStoppedMoving(pEntity) && !secondrun) {
  240. prediction = flServerTime + 0.22;
  241. secondrun = true;
  242. }
  243. else if (pEntity->GetVelocity().Length2D() < 0.1f && secondrun && prediction <= pEntity->GetSimulationTime()) {
  244. prediction = pEntity->GetTickBase() + 1.1f;
  245. }
  246. else {
  247. secondrun = false;
  248. return false;
  249. }
  250. if (prediction <= pEntity->GetSimulationTime()) {
  251. return true;
  252. }
  253. return false;
  254. }
  255.  
  256.  
  257. bool IsOnAir(CBaseEntity* pEntity)
  258. {
  259. if (!pEntity->GetFlags() & FL_ONGROUND) {
  260. return true;
  261. }
  262. return false;
  263. }
  264.  
  265. enum {
  266. TE_SPRITE = 0x01,
  267. TE_BEAMDISK = 0x02,
  268. TE_BEAMCYLINDER = 0x03,
  269. TE_BEAMFOLLOW = 0x04,
  270. TE_BEAMRING = 0x05,
  271. TE_BEAMSPLINE = 0x06,
  272. TE_BEAMRINGPOINT = 0x07,
  273. TE_BEAMLASER = 0x08,
  274. TE_BEAMTESLA = 0x09,
  275. };
  276.  
  277. enum {
  278. FBEAM_STARTENTITY = 0x00000001,
  279. FBEAM_ENDENTITY = 0x00000002,
  280. FBEAM_FADEIN = 0x00000004,
  281. FBEAM_FADEOUT = 0x00000008,
  282. FBEAM_SINENOISE = 0x00000010,
  283. FBEAM_SOLID = 0x00000020,
  284. FBEAM_SHADEIN = 0x00000040,
  285. FBEAM_SHADEOUT = 0x00000080,
  286. FBEAM_ONLYNOISEONCE = 0x00000100,
  287. FBEAM_NOTILE = 0x00000200,
  288. FBEAM_USE_HITBOXES = 0x00000400,
  289. FBEAM_STARTVISIBLE = 0x00000800,
  290. FBEAM_ENDVISIBLE = 0x00001000,
  291. FBEAM_ISACTIVE = 0x00002000,
  292. FBEAM_FOREVER = 0x00004000,
  293. FBEAM_HALOBEAM = 0x00008000,
  294. FBEAM_REVERSED = 0x00010000,
  295. NUM_BEAM_FLAGS = 17
  296. };
  297.  
  298. void DrawBeam(Vector src, Vector end, Color color)
  299. {
  300. BeamInfo_t beamInfo;
  301. beamInfo.m_nType = TE_BEAMPOINTS;
  302. beamInfo.m_pszModelName = "sprites/purplelaser1.vmt";
  303. beamInfo.m_nModelIndex = -1;
  304. beamInfo.m_flHaloScale = 2.0f;
  305. beamInfo.m_flLife = 1.0f;
  306. beamInfo.m_flWidth = 3.8f;
  307. beamInfo.m_flEndWidth = 3.8f;
  308. beamInfo.m_flFadeLength = 0.2f;
  309. beamInfo.m_flAmplitude = 2.0f;
  310. beamInfo.m_flBrightness = 255.f;
  311. beamInfo.m_flSpeed = 0.2f;
  312. beamInfo.m_nStartFrame = 0;
  313. beamInfo.m_flFrameRate = 0.f;
  314. beamInfo.m_flRed = color.r();
  315. beamInfo.m_flGreen = color.g();
  316. beamInfo.m_flBlue = color.b();
  317. beamInfo.m_nSegments = 2;
  318. beamInfo.m_bRenderable = true;
  319. beamInfo.m_nFlags = 0;
  320.  
  321. beamInfo.m_vecStart = src;
  322. beamInfo.m_vecEnd = end;
  323.  
  324. Beam_t* myBeam = g_pViewRenderBeams->CreateBeamPoints(beamInfo);
  325.  
  326. if (myBeam)
  327. g_pViewRenderBeams->DrawBeam(myBeam);
  328. }
  329.  
  330.  
  331. void __stdcall Hooks::FrameStageNotify(ClientFrameStage_t curStage)
  332. {
  333. if (g_pEngine->IsConnected() && g_pEngine->IsInGame())
  334. {
  335. static std::string old_Skyname = XorStr("");
  336. static bool OldNightmode;
  337. static int OldSky;
  338.  
  339. if (!G::LocalPlayer || !g_pEngine->IsConnected() || !g_pEngine->IsInGame()) {
  340. clientVMT->GetOriginalMethod<FrameStageNotifyFn>(36)(curStage);
  341. old_Skyname = XorStr("");
  342. OldNightmode = false;
  343. OldSky = 0;
  344. return;
  345. }
  346.  
  347. if (OldNightmode != Clientvariables->Visuals.nightmode) {
  348.  
  349. if (!r_DrawSpecificStaticProp)
  350. r_DrawSpecificStaticProp = g_pCvar->FindVar(XorStr("r_DrawSpecificStaticProp"));
  351.  
  352. r_DrawSpecificStaticProp->SetValue(0);
  353.  
  354. for (MaterialHandle_t i = g_pMaterialSystem->FirstMaterial(); i != g_pMaterialSystem->InvalidMaterial(); i = g_pMaterialSystem->NextMaterial(i)) {
  355. IMaterial* pMaterial = g_pMaterialSystem->GetMaterial(i);
  356.  
  357. if (!pMaterial)
  358. continue;
  359.  
  360. if (strstr(pMaterial->GetTextureGroupName(), XorStr("World")) || strstr(pMaterial->GetTextureGroupName(), XorStr("StaticProp"))) {
  361. if (Clientvariables->Visuals.nightmode)
  362. if (strstr(pMaterial->GetTextureGroupName(), XorStr("StaticProp")))
  363. pMaterial->ColorModulate(0.3f, 0.3f, 0.3f);
  364. else
  365. pMaterial->ColorModulate(0.05f, 0.05f, 0.05f);
  366. else
  367. pMaterial->ColorModulate(1.0f, 1.0f, 1.0f);
  368. }
  369. }
  370. OldNightmode = Clientvariables->Visuals.nightmode;
  371. }
  372.  
  373. if (OldSky != Clientvariables->Visuals.Skybox) {
  374. auto LoadNamedSky = reinterpret_cast<void(__fastcall*)(const char*)>(FindPatternIDA(XorStr("engine.dll"), XorStr("55 8B EC 81 EC ? ? ? ? 56 57 8B F9 C7 45")));
  375. if (old_Skyname == XorStr("")) {
  376.  
  377. }
  378.  
  379. int type = Clientvariables->Visuals.Skybox;
  380.  
  381. if (type == 1)
  382. LoadNamedSky(XorStr("cs_baggage_skybox_"));
  383. else if (type == 2)
  384. LoadNamedSky(XorStr("cs_tibet"));
  385. else if (type == 3)
  386. LoadNamedSky(XorStr("italy"));
  387. else if (type == 4)
  388. LoadNamedSky(XorStr("jungle"));
  389. else if (type == 5)
  390. LoadNamedSky(XorStr("office"));
  391. else if (type == 6)
  392. LoadNamedSky(XorStr("sky_cs15_daylight02_hdr"));
  393. else if (type == 7)
  394. LoadNamedSky(XorStr("sky_csgo_night02"));
  395. else if (type == 8)
  396. LoadNamedSky(XorStr("vertigo"));
  397.  
  398. OldSky = Clientvariables->Visuals.Skybox;
  399. }
  400.  
  401. static bool TransparensWalls = false;
  402. if (TransparensWalls != Clientvariables->Visuals.TransparensWallsEnable && g_pEngine->IsConnected() && g_pEngine->IsInGame()) {
  403.  
  404. if (!r_DrawSpecificStaticProp)
  405. r_DrawSpecificStaticProp = g_pCvar->FindVar(XorStr("r_DrawSpecificStaticProp"));
  406.  
  407. r_DrawSpecificStaticProp->SetValue(0);
  408.  
  409. for (MaterialHandle_t i = g_pMaterialSystem->FirstMaterial(); i != g_pMaterialSystem->InvalidMaterial(); i = g_pMaterialSystem->NextMaterial(i)) {
  410. IMaterial* pMaterial = g_pMaterialSystem->GetMaterial(i);
  411.  
  412. if (!pMaterial)
  413. continue;
  414.  
  415. if (strstr(pMaterial->GetTextureGroupName(), XorStr("StaticProp"))) {
  416. pMaterial->AlphaModulate(0.35f);
  417. }
  418. }
  419. TransparensWalls = Clientvariables->Visuals.TransparensWallsEnable;
  420. }
  421.  
  422. static Vector oldViewPunch;
  423. static Vector oldAimPunch;
  424.  
  425. Vector* view_punch = G::LocalPlayer->GetViewPunchPtr();
  426. Vector* aim_punch = G::LocalPlayer->GetPunchAnglePtr();
  427.  
  428. if (curStage == FRAME_RENDER_START && G::LocalPlayer->GetHealth() > 0) {
  429. static bool enabledtp = false, check = false;
  430.  
  431. if (GetAsyncKeyState(Clientvariables->Misc.TPKey)) {
  432. if (!check)
  433. enabledtp = !enabledtp;
  434. check = true;
  435. }
  436. else
  437. check = false;
  438.  
  439. if (enabledtp) {
  440. *reinterpret_cast<QAngle*>(reinterpret_cast<DWORD>(G::LocalPlayer + 0x31C0 + 0x8)) = G::AAAngle;
  441. }
  442.  
  443. if (view_punch && aim_punch && Clientvariables->Visuals.Novisrevoil) {
  444. oldViewPunch = *view_punch;
  445. oldAimPunch = *aim_punch;
  446.  
  447. view_punch->Init();
  448. aim_punch->Init();
  449. }
  450.  
  451. if (enabledtp && G::LocalPlayer->isAlive()) {
  452. *(bool*)((DWORD)g_pInput + 0xA5) = true;
  453. *(float*)((DWORD)g_pInput + 0xA8 + 0x8) = 150;
  454. }
  455. else {
  456. *(bool*)((DWORD)g_pInput + 0xA5) = false;
  457. *(float*)((DWORD)g_pInput + 0xA8 + 0x8);
  458. }
  459. }
  460.  
  461. if (curStage == FRAME_NET_UPDATE_START) {
  462. if (Clientvariables->Visuals.BulletTracers) {
  463. float Red, Green, Blue;
  464.  
  465. Red = Clientvariables->Colors.Bulletracer[0] * 255;
  466. Green = Clientvariables->Colors.Bulletracer[1] * 255;
  467. Blue = Clientvariables->Colors.Bulletracer[2] * 255;
  468.  
  469. for (unsigned int i = 0; i < trace_logs.size(); i++) {
  470.  
  471. auto* shooter = g_pEntitylist->GetClientEntity(g_pEngine->GetPlayerForUserID(trace_logs[i].userid));
  472.  
  473. if (!shooter)
  474. return;
  475.  
  476. Color color;
  477. if (shooter->GetTeamNum() == 3)
  478. color = Color(Red, Green, Blue, 255);
  479. else
  480. color = Color(Red, Green, Blue, 255);
  481.  
  482. DrawBeam(trace_logs[i].start, trace_logs[i].position, color);
  483.  
  484. trace_logs.erase(trace_logs.begin() + i);
  485. }
  486. }
  487.  
  488. for (auto mat_s : vistasmoke_mats) {
  489. IMaterial* mat = g_pMaterialSystem->FindMaterial(mat_s, TEXTURE_GROUP_OTHER);
  490. mat->SetMaterialVarFlag(MATERIAL_VAR_WIREFRAME, Clientvariables->Visuals.Nosmoke ? true : false);
  491. }
  492.  
  493. if (Clientvariables->Visuals.Nosmoke) {
  494. static int* smokecount = *(int**)(FindPatternIDA(XorStr("client.dll"), XorStr("A3 ? ? ? ? 57 8B CB")) + 0x1);
  495. *smokecount = 0;
  496. }
  497.  
  498. for (int i = 1; i < g_pGlobals->maxClients; i++) {
  499.  
  500. CBaseEntity* pEntity = g_pEntitylist->GetClientEntity(i);
  501. if (pEntity) {
  502. if (pEntity->GetHealth() > 0) {
  503. if (i != g_pEngine->GetLocalPlayer()) {
  504. VarMapping_t* map = pEntity->GetVarMap();
  505. if (map) {
  506. if (Clientvariables->Ragebot.PositionAdjustment) {
  507. map->m_nInterpolatedEntries = 0;
  508. }
  509. else {
  510. if (map->m_nInterpolatedEntries == 0)
  511. map->m_nInterpolatedEntries = 6;
  512. }
  513. }
  514. }
  515. }
  516. }
  517. }
  518. }
  519.  
  520. if (curStage == FRAME_RENDER_START) {
  521. for (int i = 1; i < g_pGlobals->maxClients; i++) {
  522. if (i == g_pEngine->GetLocalPlayer())
  523. continue;
  524. CBaseEntity* pEntity = g_pEntitylist->GetClientEntity(i);
  525. if (pEntity) {
  526. if (pEntity->GetHealth() > 0 && !pEntity->IsDormant()) {
  527. *(int*)((uintptr_t)pEntity + 0xA30) = g_pGlobals->framecount;
  528. *(int*)((uintptr_t)pEntity + 0xA28) = 0;
  529. }
  530. }
  531. }
  532. }
  533.  
  534. if (curStage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
  535. for (int i = 1; i < g_pGlobals->maxClients; i++) {
  536. if (i == g_pEngine->GetLocalPlayer())
  537. continue;
  538. CBaseEntity* pEntity = g_pEntitylist->GetClientEntity(i);
  539.  
  540. if (pEntity && pEntity->GetHealth() > 0) {
  541. if (pEntity->IsDormant())
  542. continue;
  543.  
  544. if (Clientvariables->Ragebot.AutomaticResolver) {
  545. {
  546. static int missedshots[65];
  547. static int lbyupdated[64];
  548. static float Yaw[64];
  549. static float lastLby[64];
  550. static float newYaw[64];
  551. auto lby = pEntity->LowerBodyYaw();
  552. auto idx = pEntity->GetIndex();
  553. auto velocity = pEntity->GetVelocity().Length();
  554. auto length2d = pEntity->GetVelocity().Length2D();
  555. auto target = G::TargetIDO;
  556. SResolveInfo arr_infos[64];
  557. AnimationLayer curBalanceLayer, prevBalanceLayer;
  558. SResolveInfo &player_recs = arr_infos[idx];
  559.  
  560. Yaw[idx] = pEntity->GetEyeAnglesPtr()->y;
  561. {
  562. if (velocity > 0.1 && !IsOnAir(pEntity)) {
  563.  
  564. Yaw[idx] = lby;
  565. lastLby[idx] = lby;
  566. }
  567. else if (velocity > 20 && velocity < 50 && !FL_DUCKING)(pEntity);
  568. {
  569. Yaw[idx] = lby + 180;
  570. newYaw[idx] = lby + 180;
  571. }
  572. if (IsAdjustingBalance(pEntity, player_recs.curTickRecord, &curBalanceLayer))
  573. {
  574. if (IsAdjustingBalance(pEntity, player_recs.prevTickRecord, &prevBalanceLayer))
  575. {
  576. if ((prevBalanceLayer.m_flCycle != curBalanceLayer.m_flCycle) || curBalanceLayer.m_flWeight == 1.f)
  577. {
  578. float
  579. flAnimTime = curBalanceLayer.m_flCycle,
  580. flSimTime = pEntity->GetSimulationTime();
  581. if (flAnimTime < 0.01f && prevBalanceLayer.m_flCycle > 0.01f && g_BacktrackHelper->IsTickValid(TIME_TO_TICKS(flSimTime - flAnimTime)))
  582. {
  583. lastLby[idx] = Yaw[idx] + lby;
  584. }
  585. lastLby[idx] = Yaw[idx] - 180.f;
  586. }
  587. else if (curBalanceLayer.m_flWeight == 0.f && (prevBalanceLayer.m_flCycle > 0.92f && curBalanceLayer.m_flCycle > 0.92f))
  588. {
  589. Yaw[idx] = lastLby[idx];
  590. }
  591. }
  592. }
  593. else if (Under120(pEntity) && missedshots[target] < 2 && !IsOnAir(pEntity) && !BreakingMoreThan120(pEntity) && !lastLbyupdate(pEntity)) {
  594. Yaw[idx] = lby;
  595. }
  596. else if (BreakingMoreThan120(pEntity) && missedshots[target] < 2 && !lastLbyupdate(pEntity) && !IsOnAir(pEntity)) {
  597. Yaw[idx] = newYaw[idx] - 160;
  598. }
  599. else if (lastLbyupdate(pEntity))
  600. {
  601. Yaw[idx] = lby;
  602. newYaw[idx] = lby;
  603.  
  604. lbyupdated[idx] = true;
  605. }
  606. if (missedshots[target] > 2 || IsOnAir(pEntity)) {
  607. Yaw[idx] = lby + 60 * missedshots[target];
  608. }
  609. else {
  610. Yaw[idx] = lastLby[idx];
  611. }
  612. pEntity->GetEyeAnglesPtr()->y = Yaw[idx];
  613.  
  614. }
  615. }
  616.  
  617. if (!Clientvariables->Misc.AntiUT) {
  618. std::string strPitch = std::to_string(pEntity->GetEyeAnglesPtr()->x);
  619.  
  620. if (pEntity->GetEyeAnglesPtr()->x < -179.f)
  621. pEntity->GetEyeAnglesPtr()->x += 360.f;
  622. else if (pEntity->GetEyeAnglesPtr()->x > 90.0 || pEntity->GetEyeAnglesPtr()->x < -90.0)
  623. pEntity->GetEyeAnglesPtr()->x = 89.f;
  624. else if (pEntity->GetEyeAnglesPtr()->x > 89.0 && pEntity->GetEyeAnglesPtr()->x < 91.0)
  625. pEntity->GetEyeAnglesPtr()->x -= 90.f;
  626. else if (pEntity->GetEyeAnglesPtr()->x > 179.0 && pEntity->GetEyeAnglesPtr()->x < 181.0)
  627. pEntity->GetEyeAnglesPtr()->x -= 180;
  628. else if (pEntity->GetEyeAnglesPtr()->x > -179.0 && pEntity->GetEyeAnglesPtr()->x < -181.0)
  629. pEntity->GetEyeAnglesPtr()->x += 180;
  630. else if (fabs(pEntity->GetEyeAnglesPtr()->x) == 0)
  631. pEntity->GetEyeAnglesPtr()->x = std::copysign(89.0f, pEntity->GetEyeAnglesPtr()->x);
  632. }
  633. }
  634. else {
  635. g_BacktrackHelper->PlayerRecord[i].records.clear();
  636. }
  637. }
  638. }
  639. }
  640.  
  641. g_BacktrackHelper->AnimationFix(curStage);
  642.  
  643. if (curStage == FRAME_RENDER_START) {
  644. for (int i = 1; i < g_pGlobals->maxClients; i++) {
  645. CBaseEntity* pEntity = g_pEntitylist->GetClientEntity(i);
  646. if (pEntity) {
  647. if (pEntity->GetHealth() > 0 && !pEntity->IsDormant()) {
  648.  
  649. g_BacktrackHelper->UpdateBacktrackRecords(pEntity);
  650. g_BacktrackHelper->UpdateExtrapolationRecords(pEntity);
  651. }
  652. }
  653. }
  654. }
  655.  
  656. clientVMT->GetOriginalMethod<FrameStageNotifyFn>(36)(curStage);
  657.  
  658. if (curStage == FRAME_RENDER_START && G::LocalPlayer && G::LocalPlayer->GetHealth() > 0) {
  659. if (Clientvariables->Visuals.Novisrevoil) {
  660. *aim_punch = oldAimPunch;
  661. *view_punch = oldViewPunch;
  662. }
  663. }
  664. }
  665. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement