Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.11 KB | None | 0 0
  1. /*
  2. Syn's AyyWare Framework 2015
  3. */
  4.  
  5. #include "Hooks.h"
  6. #include "Hacks.h"
  7. #include "Chams.h"
  8. #include "Menu.h"
  9.  
  10. #include "Interfaces.h"
  11. #include "RenderManager.h"
  12. #include "MiscHacks.h"
  13. #include "CRC32.h"
  14. #include "Resolver.h"
  15. #include <intrin.h>
  16. Vector LastAngleAA;
  17.  
  18. // Funtion Typedefs
  19. typedef void(__thiscall* DrawModelEx_)(void*, void*, void*, const ModelRenderInfo_t&, matrix3x4*);
  20. typedef void(__thiscall* PaintTraverse_)(PVOID, unsigned int, bool, bool);
  21. typedef bool(__thiscall* InPrediction_)(PVOID);
  22. typedef void(__stdcall *FrameStageNotifyFn)(ClientFrameStage_t);
  23. typedef void(__thiscall* RenderViewFn)(void*, CViewSetup&, CViewSetup&, int, int);
  24.  
  25. using OverrideViewFn = void(__fastcall*)(void*, void*, CViewSetup*);
  26. typedef float(__stdcall *oGetViewModelFOV)();
  27.  
  28.  
  29. // Function Pointers to the originals
  30. PaintTraverse_ oPaintTraverse;
  31. DrawModelEx_ oDrawModelExecute;
  32. FrameStageNotifyFn oFrameStageNotify;
  33. OverrideViewFn oOverrideView;
  34. RenderViewFn oRenderView;
  35.  
  36. // Hook function prototypes
  37. void __fastcall PaintTraverse_Hooked(PVOID pPanels, int edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce);
  38. bool __stdcall Hooked_InPrediction();
  39. void __fastcall Hooked_DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t &pInfo, matrix3x4 *pCustomBoneToWorld);
  40. bool __stdcall CreateMoveClient_Hooked(/*void* self, int edx,*/ float frametime, CUserCmd* pCmd);
  41. void __stdcall Hooked_FrameStageNotify(ClientFrameStage_t curStage);
  42. void __fastcall Hooked_OverrideView(void* ecx, void* edx, CViewSetup* pSetup);
  43. float __stdcall GGetViewModelFOV();
  44. void __fastcall Hooked_RenderView(void* ecx, void* edx, CViewSetup &setup, CViewSetup &hudViewSetup, int nClearFlags, int whatToDraw);
  45.  
  46. // VMT Managers
  47. namespace Hooks
  48. {
  49. // VMT Managers
  50. Utilities::Memory::VMTManager VMTPanel; // Hooking drawing functions
  51. Utilities::Memory::VMTManager VMTClient; // Maybe CreateMove
  52. Utilities::Memory::VMTManager VMTClientMode; // CreateMove for functionality
  53. Utilities::Memory::VMTManager VMTModelRender; // DrawModelEx for chams
  54. Utilities::Memory::VMTManager VMTPrediction; // InPrediction for no vis recoil
  55. Utilities::Memory::VMTManager VMTPlaySound; // Autoaccept
  56. Utilities::Memory::VMTManager VMTRenderView;
  57. };
  58.  
  59. /*// Initialise all our hooks
  60. void Hooks::Initialise()
  61. {
  62. // Panel hooks for drawing to the screen via surface functions
  63. VMTPanel.Initialise((DWORD*)Interfaces::Panels);
  64. oPaintTraverse = (PaintTraverse_)VMTPanel.HookMethod((DWORD)&PaintTraverse_Hooked, Offsets::VMT::Panel_PaintTraverse);
  65. //Utilities::Log("Paint Traverse Hooked");
  66.  
  67. // No Visual Recoil
  68. VMTPrediction.Initialise((DWORD*)Interfaces::Prediction);
  69. VMTPrediction.HookMethod((DWORD)&Hooked_InPrediction, 14);
  70. //Utilities::Log("InPrediction Hooked");
  71.  
  72. // Chams
  73. VMTModelRender.Initialise((DWORD*)Interfaces::ModelRender);
  74. oDrawModelExecute = (DrawModelEx_)VMTModelRender.HookMethod((DWORD)&Hooked_DrawModelExecute, Offsets::VMT::ModelRender_DrawModelExecute);
  75. //Utilities::Log("DrawModelExecute Hooked");
  76.  
  77. // Setup ClientMode Hooks
  78. //VMTClientMode.Initialise((DWORD*)Interfaces::ClientMode);
  79. //VMTClientMode.HookMethod((DWORD)&CreateMoveClient_Hooked, 24);
  80. //Utilities::Log("ClientMode CreateMove Hooked");
  81.  
  82. // Setup client hooks
  83. VMTClient.Initialise((DWORD*)Interfaces::Client);
  84. oCreateMove = (CreateMoveFn)VMTClient.HookMethod((DWORD)&hkCreateMove, 21);
  85. }*/
  86.  
  87. // Undo our hooks
  88. void Hooks::UndoHooks()
  89. {
  90. VMTPanel.RestoreOriginal();
  91. VMTPrediction.RestoreOriginal();
  92. VMTModelRender.RestoreOriginal();
  93. VMTClientMode.RestoreOriginal();
  94. }
  95.  
  96.  
  97. // Initialise all our hooks
  98. void Hooks::Initialise()
  99. {
  100. // Panel hooks for drawing to the screen via surface functions
  101. VMTPanel.Initialise((DWORD*)Interfaces::Panels);
  102. oPaintTraverse = (PaintTraverse_)VMTPanel.HookMethod((DWORD)&PaintTraverse_Hooked, Offsets::VMT::Panel_PaintTraverse);
  103. //Utilities::Log("Paint Traverse Hooked");
  104.  
  105. // No Visual Recoi l
  106. VMTPrediction.Initialise((DWORD*)Interfaces::Prediction);
  107. VMTPrediction.HookMethod((DWORD)&Hooked_InPrediction, 14);
  108. //Utilities::Log("InPrediction Hooked");
  109.  
  110. // Chams
  111. VMTModelRender.Initialise((DWORD*)Interfaces::ModelRender);
  112. oDrawModelExecute = (DrawModelEx_)VMTModelRender.HookMethod((DWORD)&Hooked_DrawModelExecute, Offsets::VMT::ModelRender_DrawModelExecute);
  113. //Utilities::Log("DrawModelExecute Hooked");
  114.  
  115. // Setup ClientMode Hooks
  116. VMTClientMode.Initialise((DWORD*)Interfaces::ClientMode);
  117. VMTClientMode.HookMethod((DWORD)CreateMoveClient_Hooked, 24);
  118.  
  119. oOverrideView = (OverrideViewFn)VMTClientMode.HookMethod((DWORD)&Hooked_OverrideView, 18);
  120. VMTClientMode.HookMethod((DWORD)&GGetViewModelFOV, 35);
  121.  
  122. // Setup client hooks
  123. VMTClient.Initialise((DWORD*)Interfaces::Client);
  124. oFrameStageNotify = (FrameStageNotifyFn)VMTClient.HookMethod((DWORD)&Hooked_FrameStageNotify, 36);
  125.  
  126. }
  127.  
  128. void MovementCorrection(CUserCmd* pCmd)
  129. {
  130.  
  131. }
  132.  
  133. //---------------------------------------------------------------------------------------------------------
  134. // Hooked Functions
  135. //---------------------------------------------------------------------------------------------------------
  136.  
  137. void SetClanTag(const char* tag, const char* name)//190% paste
  138. {
  139. static auto pSetClanTag = reinterpret_cast<void(__fastcall*)(const char*, const char*)>(((DWORD)Utilities::Memory::FindPattern("engine.dll", (PBYTE)"\x53\x56\x57\x8B\xDA\x8B\xF9\xFF\x15\x00\x00\x00\x00\x6A\x24\x8B\xC8\x8B\x30", "xxxxxxxxx????xxxxxx")));
  140. pSetClanTag(tag, name);
  141. }
  142. void NoClantag()
  143. {
  144. SetClanTag("", "");
  145. }
  146.  
  147. void ClanTag()
  148. {
  149. static int counter = 0;
  150. switch (Menu::Window.MiscTab.OtherClantag.GetIndex())
  151. {
  152. case 0:
  153. // No
  154. break;
  155. case 1:
  156. {
  157. static int motion = 0;
  158. int ServerTime = (float)Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase() * 2.5;
  159.  
  160. if (counter % 48 == 0)
  161. motion++;
  162. int value = ServerTime % 19;
  163. switch (value) {
  164. case 0:SetClanTag(" ", "pasteware"); break;
  165. case 1:SetClanTag(" p", "pasteware"); break;
  166. case 2:SetClanTag(" pa", "pasteware"); break;
  167. case 3:SetClanTag(" pas", "pasteware"); break;
  168. case 4:SetClanTag(" past", "pasteware"); break;
  169. case 5:SetClanTag(" paste", "pasteware"); break;
  170. case 6:SetClanTag(" pastew", "pasteware"); break;
  171. case 7:SetClanTag(" pastewa", "pasteware"); break;
  172. case 8:SetClanTag(" pastewar", "pasteware"); break;
  173. case 9:SetClanTag(" pasteware", "pasteware"); break;
  174. case 10:SetClanTag("pasteware ", "pasteware"); break;
  175. case 11:SetClanTag("asteware ", "pasteware"); break;
  176. case 12:SetClanTag("steware ", "pasteware"); break;
  177. case 13:SetClanTag("teware ", "pasteware"); break;
  178. case 14:SetClanTag("eware ", "pasteware"); break;
  179. case 15:SetClanTag("ware ", "pasteware"); break;
  180. case 16:SetClanTag("are ", "pasteware"); break;
  181. case 17:SetClanTag("re ", "pasteware"); break;
  182. case 18:SetClanTag("e ", "pasteware"); break;
  183. case 19:SetClanTag(" ", "pasteware"); break;
  184. }
  185. counter++;
  186. }
  187. break;
  188. case 2:
  189. {
  190. static int motion = 0;
  191. int ServerTime = (float)Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase() * 3;
  192.  
  193. if (counter % 48 == 0)
  194. motion++;
  195. int value = ServerTime % 17;
  196. switch (value) {
  197. case 0:SetClanTag(" ", "skeet.cc"); break;
  198. case 1:SetClanTag(" s", "skeet.cc"); break;
  199. case 2:SetClanTag(" sk", "skeet.cc"); break;
  200. case 3:SetClanTag(" ske", "skeet.cc"); break;
  201. case 4:SetClanTag(" skee", "skeet.cc"); break;
  202. case 5:SetClanTag(" skeet", "skeet.cc"); break;
  203. case 6:SetClanTag(" skeet.", "skeet.cc"); break;
  204. case 7:SetClanTag(" skeet.c", "skeet.cc"); break;
  205. case 8:SetClanTag(" skeet.cc", "skeet.cc"); break;
  206. case 9:SetClanTag("skeet.cc ", "skeet.cc"); break;
  207. case 10:SetClanTag("keet.cc ", "skeet.cc"); break;
  208. case 11:SetClanTag("eet.cc ", "skeet.cc"); break;
  209. case 12:SetClanTag("et.cc ", "skeet.cc"); break;
  210. case 13:SetClanTag("t.cc ", "skeet.cc"); break;
  211. case 14:SetClanTag(".cc ", "skeet.cc"); break;
  212. case 15:SetClanTag("cc ", "skeet.cc"); break;
  213. case 16:SetClanTag("c ", "skeet.cc"); break;
  214. case 17:SetClanTag(" ", "skeet.cc"); break;
  215. }
  216. counter++;
  217. }
  218. break;
  219. case 3:
  220. // stainless
  221. SetClanTag("\r", "\r");
  222. break;
  223. case 4:
  224. SetClanTag("[VALV\xE1\xB4\xB1]", "Valve");
  225. break;
  226. }
  227. }
  228.  
  229. bool __stdcall CreateMoveClient_Hooked(/*void* self, int edx,*/ float frametime, CUserCmd* pCmd)
  230. {
  231. if (!pCmd->command_number)
  232. return true;
  233.  
  234. if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame())
  235. {
  236.  
  237. PVOID pebp;
  238. __asm mov pebp, ebp;
  239. bool* pbSendPacket = (bool*)(*(DWORD*)pebp - 0x1C);
  240. bool& bSendPacket = *pbSendPacket;
  241.  
  242. if (Menu::Window.MiscTab.OtherClantag.GetIndex() > 0)
  243. ClanTag();
  244.  
  245. // CUserCmd* cmdlist = *(CUserCmd**)((DWORD)Interfaces::pInput + 0xEC);
  246. // CUserCmd* pCmd = &cmdlist[sequence_number % 150];
  247.  
  248.  
  249. // Backup for safety
  250. Vector origView = pCmd->viewangles;
  251. Vector viewforward, viewright, viewup, aimforward, aimright, aimup;
  252. Vector qAimAngles;
  253. qAimAngles.Init(0.0f, pCmd->viewangles.y, 0.0f);
  254. AngleVectors(qAimAngles, &viewforward, &viewright, &viewup);
  255.  
  256. // Do da hacks
  257. IClientEntity *pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  258. if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && pLocal && pLocal->IsAlive())
  259. Hacks::MoveHacks(pCmd, bSendPacket);
  260.  
  261. //Movement Fix
  262. //GameUtils::CL_FixMove(pCmd, origView);
  263. qAimAngles.Init(0.0f, GetAutostrafeView().y, 0.0f); // if pCmd->viewangles.x > 89, set pCmd->viewangles.x instead of 0.0f on first
  264. AngleVectors(qAimAngles, &viewforward, &viewright, &viewup);
  265. qAimAngles.Init(0.0f, pCmd->viewangles.y, 0.0f);
  266. AngleVectors(qAimAngles, &aimforward, &aimright, &aimup);
  267. Vector vForwardNorm; Normalize(viewforward, vForwardNorm);
  268. Vector vRightNorm; Normalize(viewright, vRightNorm);
  269. Vector vUpNorm; Normalize(viewup, vUpNorm);
  270.  
  271. // Original shit for movement correction
  272. float forward = pCmd->forwardmove;
  273. float right = pCmd->sidemove;
  274. float up = pCmd->upmove;
  275. if (forward > 450) forward = 450;
  276. if (right > 450) right = 450;
  277. if (up > 450) up = 450;
  278. if (forward < -450) forward = -450;
  279. if (right < -450) right = -450;
  280. if (up < -450) up = -450;
  281. pCmd->forwardmove = DotProduct(forward * vForwardNorm, aimforward) + DotProduct(right * vRightNorm, aimforward) + DotProduct(up * vUpNorm, aimforward);
  282. pCmd->sidemove = DotProduct(forward * vForwardNorm, aimright) + DotProduct(right * vRightNorm, aimright) + DotProduct(up * vUpNorm, aimright);
  283. pCmd->upmove = DotProduct(forward * vForwardNorm, aimup) + DotProduct(right * vRightNorm, aimup) + DotProduct(up * vUpNorm, aimup);
  284.  
  285. // Angle normalisation
  286. if (Menu::Window.MiscTab.OtherSafeMode.GetState())
  287. {
  288. GameUtils::NormaliseViewAngle(pCmd->viewangles);
  289.  
  290. if (pCmd->viewangles.z != 0.0f)
  291. {
  292. pCmd->viewangles.z = 0.00;
  293. }
  294.  
  295. if (pCmd->viewangles.x < -89 || pCmd->viewangles.x > 89 || pCmd->viewangles.y < -180 || pCmd->viewangles.y > 180)
  296. {
  297. Utilities::Log("Having to re-normalise!");
  298. GameUtils::NormaliseViewAngle(pCmd->viewangles);
  299. Beep(750, 800); // Why does it do this
  300. if (pCmd->viewangles.x < -89 || pCmd->viewangles.x > 89 || pCmd->viewangles.y < -180 || pCmd->viewangles.y > 180)
  301. {
  302. pCmd->viewangles = origView;
  303. pCmd->sidemove = right;
  304. pCmd->forwardmove = forward;
  305. }
  306. }
  307. }
  308.  
  309. if (pCmd->viewangles.x > 90)
  310. {
  311. pCmd->forwardmove = -pCmd->forwardmove;
  312. }
  313.  
  314. if (pCmd->viewangles.x < -90)
  315. {
  316. pCmd->forwardmove = -pCmd->forwardmove;
  317. }
  318.  
  319. if (bSendPacket)
  320. LastAngleAA = pCmd->viewangles;
  321. }
  322.  
  323. return false;
  324. }
  325.  
  326.  
  327. // Paint Traverse Hooked function
  328. void __fastcall PaintTraverse_Hooked(PVOID pPanels, int edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce)
  329. {
  330. oPaintTraverse(pPanels, vguiPanel, forceRepaint, allowForce);
  331.  
  332. static unsigned int FocusOverlayPanel = 0;
  333. static bool FoundPanel = false;
  334.  
  335. if (!FoundPanel)
  336. {
  337. PCHAR szPanelName = (PCHAR)Interfaces::Panels->GetName(vguiPanel);
  338. if (strstr(szPanelName, "MatSystemTopPanel"))
  339. {
  340. FocusOverlayPanel = vguiPanel;
  341. FoundPanel = true;
  342. }
  343. }
  344. else if (FocusOverlayPanel == vguiPanel)
  345. {
  346. //Render::GradientV(8, 8, 160, 18, Color(0, 0, 0, 0), Color(7, 39, 17, 255));
  347. if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame())
  348. Hacks::DrawHacks();
  349.  
  350. // Update and draw the menu
  351. Menu::DoUIFrame();
  352. }
  353. }
  354.  
  355. // InPrediction Hooked Function
  356. bool __stdcall Hooked_InPrediction()
  357. {
  358. bool result;
  359. static InPrediction_ origFunc = (InPrediction_)Hooks::VMTPrediction.GetOriginalFunction(14);
  360. static DWORD *ecxVal = Interfaces::Prediction;
  361. result = origFunc(ecxVal);
  362.  
  363. // If we are in the right place where the player view is calculated
  364. // Calculate the change in the view and get rid of it
  365. if (Menu::Window.VisualsTab.OtherNoVisualRecoil.GetState() && (DWORD)(_ReturnAddress()) == Offsets::Functions::dwCalcPlayerView)
  366. {
  367. IClientEntity* pLocalEntity = NULL;
  368.  
  369. float* m_LocalViewAngles = NULL;
  370.  
  371. __asm
  372. {
  373. MOV pLocalEntity, ESI
  374. MOV m_LocalViewAngles, EBX
  375. }
  376.  
  377. Vector viewPunch = pLocalEntity->localPlayerExclusive()->GetViewPunchAngle();
  378. Vector aimPunch = pLocalEntity->localPlayerExclusive()->GetAimPunchAngle();
  379.  
  380. m_LocalViewAngles[0] -= (viewPunch[0] + (aimPunch[0] * 2 * 0.4499999f));
  381. m_LocalViewAngles[1] -= (viewPunch[1] + (aimPunch[1] * 2 * 0.4499999f));
  382. m_LocalViewAngles[2] -= (viewPunch[2] + (aimPunch[2] * 2 * 0.4499999f));
  383. return true;
  384. }
  385.  
  386. return result;
  387. }
  388.  
  389. // DrawModelExec for chams and shit
  390. void __fastcall Hooked_DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t &pInfo, matrix3x4 *pCustomBoneToWorld)
  391. {
  392. Color color;
  393. float flColor[3] = { 0.f };
  394. static IMaterial* CoveredLit = CreateMaterial(true);
  395. static IMaterial* OpenLit = CreateMaterial(false);
  396. static IMaterial* CoveredFlat = CreateMaterial(true, false);
  397. static IMaterial* OpenFlat = CreateMaterial(false, false);
  398. bool DontDraw = false;
  399.  
  400. const char* ModelName = Interfaces::ModelInfo->GetModelName((model_t*)pInfo.pModel);
  401. IClientEntity* pModelEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(pInfo.entity_index);
  402. IClientEntity* pLocal = (IClientEntity*)Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  403.  
  404. if (Menu::Window.VisualsTab.Active.GetState())
  405. {
  406. // Player Chams
  407. int ChamsStyle = Menu::Window.VisualsTab.OptionsChams.GetIndex();
  408. int HandsStyle = Menu::Window.VisualsTab.OtherNoHands.GetIndex();
  409. if (ChamsStyle != 0 && Menu::Window.VisualsTab.FiltersPlayers.GetState() && strstr(ModelName, "models/player"))
  410. {
  411. if (pLocal/* && (!Menu::Window.VisualsTab.FiltersEnemiesOnly.GetState() || pModelEntity->GetTeamNum() != pLocal->GetTeamNum())*/)
  412. {
  413. IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
  414. IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
  415.  
  416. IClientEntity* pModelEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(pInfo.entity_index);
  417. if (pModelEntity)
  418. {
  419. IClientEntity *local = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  420. if (local)
  421. {
  422. if (pModelEntity->IsAlive() && pModelEntity->GetHealth() > 0)
  423. {
  424. float alpha = 1.f;
  425.  
  426. if (pModelEntity->HasGunGameImmunity())
  427. alpha = 0.5f;
  428.  
  429. if (pModelEntity->GetTeamNum() == 2)
  430. {
  431. flColor[0] = 0.f;
  432. flColor[1] = 0.f;
  433. flColor[2] = 0.f;
  434. }
  435. else
  436. {
  437. flColor[0] = 0.f;
  438. flColor[1] = 0.f;
  439. flColor[2] = 0.f;
  440. }
  441.  
  442. Interfaces::RenderView->SetColorModulation(flColor);
  443. Interfaces::RenderView->SetBlend(alpha);
  444. Interfaces::ModelRender->ForcedMaterialOverride(covered);
  445. oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
  446.  
  447. if (pModelEntity->GetTeamNum() == 2)
  448. {
  449. // T COLOR
  450. switch (Menu::Window.VisualsTab.OptionsChamsColorT.GetIndex()) {
  451. case 0: // 255,107,100
  452. flColor[0] = 255.f;
  453. flColor[1] = 107.f;
  454. flColor[2] = 100.f;
  455. break;
  456. case 1:
  457. flColor[0] = 8.f;
  458. flColor[1] = 171.f;
  459. flColor[2] = 96.f;
  460. break;
  461. case 1:
  462. flColor[0] = 8.f;
  463. flColor[1] = 171.f;
  464. flColor[2] = 96.f;
  465. break;
  466. }
  467. }
  468. else
  469. {
  470. // CT COLOR
  471. flColor[0] = 0.f;
  472. flColor[1] = 96.f;
  473. flColor[2] = 214.f;
  474. }
  475.  
  476. Interfaces::RenderView->SetColorModulation(flColor);
  477. Interfaces::RenderView->SetBlend(alpha);
  478. Interfaces::ModelRender->ForcedMaterialOverride(open);
  479. }
  480. else
  481. {
  482. color.SetColor(0, 50, 45, 1);
  483. ForceMaterial(color, open);
  484. }
  485. }
  486. }
  487. }
  488. }
  489. else if (HandsStyle != 0 && strstr(ModelName, "arms"))
  490. {
  491. if (HandsStyle == 1)
  492. {
  493. DontDraw = true;
  494. }
  495. else if (HandsStyle == 2)
  496. {
  497. Interfaces::RenderView->SetBlend(0.3);
  498. }
  499. else if (HandsStyle == 3)
  500. {
  501. IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
  502. IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
  503. if (pLocal)
  504. {
  505. if (pLocal->IsAlive())
  506. {
  507. int alpha = pLocal->HasGunGameImmunity() ? 150 : 255;
  508.  
  509. if (pLocal->GetTeamNum() == 2)
  510. color.SetColor(240, 30, 35, alpha);
  511. else
  512. color.SetColor(63, 72, 205, alpha);
  513.  
  514. ForceMaterial(color, covered);
  515. oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
  516.  
  517. if (pLocal->GetTeamNum() == 2)
  518. color.SetColor(247, 180, 20, alpha);
  519. else
  520. color.SetColor(32, 180, 57, alpha);
  521. }
  522. else
  523. {
  524. color.SetColor(255, 255, 255, 255);
  525. }
  526.  
  527. ForceMaterial(color, open);
  528. }
  529. }
  530. else
  531. {
  532. static int counter = 0;
  533. static float colors[3] = { 1.f, 0.f, 0.f };
  534.  
  535. if (colors[counter] >= 1.0f)
  536. {
  537. colors[counter] = 1.0f;
  538. counter += 1;
  539. if (counter > 2)
  540. counter = 0;
  541. }
  542. else
  543. {
  544. int prev = counter - 1;
  545. if (prev < 0) prev = 2;
  546. colors[prev] -= 0.05f;
  547. colors[counter] += 0.05f;
  548. }
  549.  
  550. Interfaces::RenderView->SetColorModulation(colors);
  551. Interfaces::RenderView->SetBlend(0.3);
  552. Interfaces::ModelRender->ForcedMaterialOverride(OpenLit);
  553. }
  554. }
  555. else if (ChamsStyle != 0 && Menu::Window.VisualsTab.FiltersWeapons.GetState() && strstr(ModelName, "_dropped.mdl"))
  556. {
  557. IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
  558. color.SetColor(255, 255, 255, 255);
  559. ForceMaterial(color, covered);
  560. }
  561. }
  562.  
  563. if (!DontDraw)
  564. oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
  565. Interfaces::ModelRender->ForcedMaterialOverride(NULL);
  566. }
  567.  
  568.  
  569. // Hooked FrameStageNotify for removing visual recoil
  570. void __stdcall Hooked_FrameStageNotify(ClientFrameStage_t curStage)
  571. {
  572. DWORD eyeangles = NetVar.GetNetVar(0xBFEA4E7B);
  573. IClientEntity *pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  574.  
  575. if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && curStage == FRAME_RENDER_START)
  576. {
  577.  
  578. if (pLocal->IsAlive())
  579. {
  580. if (*(bool*)((DWORD)Interfaces::pInput + 0xA5))
  581. *(Vector*)((DWORD)pLocal + 0x31C8) = LastAngleAA;
  582. }
  583.  
  584. if ((Menu::Window.MiscTab.OtherThirdperson.GetState()) || Menu::Window.RageBotTab.AccuracyPositionAdjustment.GetState())
  585. {
  586. static bool rekt = false;
  587. if (!rekt)
  588. {
  589. ConVar* sv_cheats = Interfaces::CVar->FindVar("sv_cheats");
  590. SpoofedConvar* sv_cheats_spoofed = new SpoofedConvar(sv_cheats);
  591. sv_cheats_spoofed->SetInt(1);
  592. rekt = true;
  593. }
  594. }
  595.  
  596. static bool rekt1 = false;
  597. if (Menu::Window.MiscTab.OtherThirdperson.GetState() && pLocal->IsAlive() && pLocal->IsScoped() == 0)
  598. {
  599. if (!rekt1)
  600. {
  601. Interfaces::Engine->ClientCmd_Unrestricted("thirdperson");
  602. rekt1 = true;
  603. }
  604. }
  605. else if (!Menu::Window.MiscTab.OtherThirdperson.GetState())
  606. {
  607. rekt1 = false;
  608. }
  609.  
  610. static bool rekt = false;
  611. if (!Menu::Window.MiscTab.OtherThirdperson.GetState() || pLocal->IsAlive() == 0 || pLocal->IsScoped())
  612. {
  613. if (!rekt)
  614. {
  615. Interfaces::Engine->ClientCmd_Unrestricted("firstperson");
  616. rekt = true;
  617. }
  618. }
  619. else if (Menu::Window.MiscTab.OtherThirdperson.GetState() || pLocal->IsAlive() || pLocal->IsScoped() == 0)
  620. {
  621. rekt = false;
  622. }
  623.  
  624. static bool meme = false;
  625. if (Menu::Window.MiscTab.OtherThirdperson.GetState() && pLocal->IsScoped() == 0)
  626. {
  627. if (!meme)
  628. {
  629. Interfaces::Engine->ClientCmd_Unrestricted("thirdperson");
  630. meme = true;
  631. }
  632. }
  633. else if (pLocal->IsScoped())
  634. {
  635. meme = false;
  636. }
  637.  
  638. static bool kek = false;
  639. if (Menu::Window.MiscTab.OtherThirdperson.GetState() && pLocal->IsAlive())
  640. {
  641. if (!kek)
  642. {
  643. Interfaces::Engine->ClientCmd_Unrestricted("thirdperson");
  644. kek = true;
  645. }
  646. }
  647. else if (pLocal->IsAlive() == 0)
  648. {
  649. kek = false;
  650. }
  651. }
  652.  
  653. if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && curStage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
  654. {
  655. IClientEntity *pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  656.  
  657. /* for (int i = 1; i < 65; i++)
  658. {
  659. IClientEntity* pEnt = Interfaces::EntList->GetClientEntity(i);
  660. if (!pEnt) continue;
  661. if (pEnt->IsDormant()) continue;
  662. if (pEnt->GetHealth() < 1) continue;
  663. if (pEnt->GetLifeState() != 0) continue;
  664.  
  665. *(float*)((DWORD)pEnt + eyeangles) = pEnt->GetTargetYaw();
  666. //Msg("%f\n", *(float*)((DWORD)pEnt + m_angEyeAnglesYaw));
  667. } */
  668.  
  669. if (Menu::Window.MiscTab.KnifeEnable.GetState() && pLocal)
  670. {
  671. IClientEntity* WeaponEnt = Interfaces::EntList->GetClientEntityFromHandle(pLocal->GetActiveWeaponHandle());
  672. CBaseCombatWeapon* Weapon = (CBaseCombatWeapon*)WeaponEnt;
  673.  
  674. int iBayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_bayonet.mdl");
  675. int iButterfly = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_butterfly.mdl");
  676. int iFlip = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_flip.mdl");
  677. int iGut = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_gut.mdl");
  678. int iKarambit = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_karam.mdl");
  679. int iM9Bayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
  680. int iHuntsman = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_tactical.mdl");
  681. int iFalchion = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_falchion_advanced.mdl");
  682. int iDagger = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_push.mdl");
  683. int iBowie = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_survival_bowie.mdl");
  684.  
  685. int Model = Menu::Window.MiscTab.KnifeModel.GetIndex();
  686. int Skin = Menu::Window.MiscTab.KnifeSkin.GetIndex();
  687.  
  688. if (Weapon)
  689. {
  690. if (WeaponEnt->GetClientClass()->m_ClassID == (int)CSGOClassID::CKnife)
  691. {
  692. if (Model == 0) // Karambit
  693. {
  694. *Weapon->ModelIndex() = iKarambit; // m_nModelIndex
  695. *Weapon->ViewModelIndex() = iKarambit;
  696. *Weapon->WorldModelIndex() = iKarambit + 1;
  697. *Weapon->m_AttributeManager()->m_Item()->ItemDefinitionIndex() = 507;
  698.  
  699. if (Skin == 0)
  700. *Weapon->FallbackPaintKit() = 416; // Doppler Sapphire
  701. else if (Skin == 1)
  702. *Weapon->FallbackPaintKit() = 415; // Doppler Ruby
  703. else if (Skin == 2)
  704. *Weapon->FallbackPaintKit() = 409; // Tiger Tooth
  705. else if (Skin == 3)
  706. *Weapon->FallbackPaintKit() = 558; // Lore
  707. }
  708. else if (Model == 1) // Karambit
  709. {
  710. *Weapon->ModelIndex() = iBayonet; // m_nModelIndex
  711. *Weapon->ViewModelIndex() = iBayonet;
  712. *Weapon->WorldModelIndex() = iBayonet + 1;
  713. *Weapon->m_AttributeManager()->m_Item()->ItemDefinitionIndex() = 500;
  714.  
  715. if (Skin == 0)
  716. *Weapon->FallbackPaintKit() = 416; // Doppler Sapphire
  717. else if (Skin == 1)
  718. *Weapon->FallbackPaintKit() = 415; // Doppler Ruby
  719. else if (Skin == 2)
  720. *Weapon->FallbackPaintKit() = 409; // Tiger Tooth
  721. else if (Skin == 3)
  722. *Weapon->FallbackPaintKit() = 558; // Lore
  723. }
  724.  
  725. *Weapon->OwnerXuidLow() = 0;
  726. *Weapon->OwnerXuidHigh() = 0;
  727. *Weapon->FallbackWear() = 0.001f;
  728. *Weapon->m_AttributeManager()->m_Item()->ItemIDHigh() = 1;
  729. }
  730. }
  731. }
  732. if (pLocal->IsAlive())
  733. R::Resolve();
  734. }
  735.  
  736. oFrameStageNotify(curStage);
  737. }
  738.  
  739. void __fastcall Hooked_OverrideView(void* ecx, void* edx, CViewSetup* pSetup)
  740. {
  741. IClientEntity* pLocal = (IClientEntity*)Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  742.  
  743. if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame())
  744. {
  745. if (Menu::Window.VisualsTab.Active.GetState() && pLocal->IsAlive() && !pLocal->IsScoped())
  746. {
  747. if (pSetup->fov = 90)
  748. pSetup->fov = Menu::Window.VisualsTab.OtherFOV.GetValue();
  749. }
  750.  
  751. oOverrideView(ecx, edx, pSetup);
  752. }
  753.  
  754. }
  755.  
  756. void GetViewModelFOV(float& fov)
  757. {
  758. IClientEntity* localplayer = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  759.  
  760. if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame())
  761. {
  762.  
  763. if (!localplayer)
  764. return;
  765.  
  766.  
  767. if (Menu::Window.VisualsTab.Active.GetState())
  768. fov += Menu::Window.VisualsTab.OtherViewmodelFOV.GetValue();
  769. }
  770. }
  771.  
  772. float __stdcall GGetViewModelFOV()
  773. {
  774. float fov = Hooks::VMTClientMode.GetMethod<oGetViewModelFOV>(35)();
  775.  
  776. GetViewModelFOV(fov);
  777.  
  778. return fov;
  779. }
  780.  
  781. void __fastcall Hooked_RenderView(void* ecx, void* edx, CViewSetup &setup, CViewSetup &hudViewSetup, int nClearFlags, int whatToDraw)
  782. {
  783. static DWORD oRenderView = Hooks::VMTRenderView.GetOriginalFunction(6);
  784.  
  785. IClientEntity* pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
  786.  
  787. __asm
  788. {
  789. PUSH whatToDraw
  790. PUSH nClearFlags
  791. PUSH hudViewSetup
  792. PUSH setup
  793. MOV ECX, ecx
  794. CALL oRenderView
  795. }
  796. } //hooked for no reason yay
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement