Advertisement
slownessCollapse

Untitled

Jul 29th, 2019
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 100.18 KB | None | 0 0
  1. #include <thread>
  2. #include "Hooks.h"
  3. #include "Utils\Utils.h"
  4. #include "Features\Features.h"
  5. #include "Menu\Menu.h"
  6. #include "Features/Visuals/EventLogging.h"
  7. #include "../std2017.h"
  8. Misc g_Misc;
  9. Hooks g_Hooks;
  10. Event g_Event;
  11. c_nade_prediction g_nadepred;
  12. void SinCos(float radian, float* sin, float* cos)
  13. {
  14. *sin = std::sin(radian);
  15. *cos = std::cos(radian);
  16. }
  17. void angle_to_vector(const Vector &angles, Vector &forward) {
  18. float sp, sy, cp, cy;
  19.  
  20. SinCos(DEG2RAD(angles.y), &sy, &cy);
  21. SinCos(DEG2RAD(angles.x), &sp, &cp);
  22.  
  23. forward.x = cp * cy;
  24. forward.y = cp * sy;
  25. forward.z = -sp;
  26. }
  27. void c_nade_prediction::predict(CUserCmd *ucmd) {
  28. // readability
  29. constexpr float restitution = 0.45f;
  30. constexpr float power[] = { 1.0f, 1.0f, 0.5f, 0.0f };
  31. constexpr float velocity = 403.0f * 0.9f;
  32.  
  33. float step, gravity, new_velocity, unk01;
  34. int index{}, grenade_act{ 1 };
  35. Vector pos, thrown_direction, start, eye_origin;
  36. Vector angles, thrown;
  37.  
  38. // first time setup
  39. static auto sv_gravity = g_pCvar->FindVar("sv_gravity");
  40.  
  41. // calculate step and actual gravity value
  42. gravity = sv_gravity->GetFloat() / 8.0f;
  43. step = g_pGlobalVars->intervalPerTick;
  44.  
  45. // get local view and eye origin
  46. eye_origin = Globals::LocalPlayer->GetEyePosition();
  47. angles = ucmd->viewangles;
  48.  
  49. // copy current angles and normalise pitch
  50. thrown = angles;
  51.  
  52. if (thrown.x < 0) {
  53. thrown.x = -10 + thrown.x * ((90 - 10) / 90.0f);
  54. }
  55. else {
  56. thrown.x = -10 + thrown.x * ((90 + 10) / 90.0f);
  57. }
  58.  
  59. // find out how we're throwing the grenade
  60. auto primary_attack = ucmd->buttons & IN_ATTACK;
  61. auto secondary_attack = ucmd->buttons & IN_ATTACK2;
  62.  
  63.  
  64. // apply 'magic' and modulate by velocity
  65. unk01 = power[grenade_act];
  66.  
  67. unk01 = unk01 * 0.7f;
  68. unk01 = unk01 + 0.3f;
  69.  
  70. new_velocity = velocity * unk01;
  71.  
  72. // here's where the fun begins
  73. angle_to_vector(thrown, thrown_direction);
  74.  
  75. start = eye_origin + thrown_direction * 16.0f;
  76. thrown_direction = (thrown_direction * new_velocity) + Globals::LocalPlayer->GetVelocity();
  77.  
  78. // let's go ahead and predict
  79. for (auto time = 0.0f; index < 500; time += step) {
  80. pos = start + thrown_direction * step;
  81.  
  82. // setup trace
  83. C_Trace trace;
  84. CTraceFilterSkipEntity filter(Globals::LocalPlayer);
  85.  
  86. g_pTrace->TraceRay(C_Ray{ start, pos }, mask_solid, &filter, &trace);
  87.  
  88. // modify path if we have hit something
  89. if (trace.flFraction != 1.0f) {
  90. thrown_direction = trace.plane.normal * -2.0f * thrown_direction.Dot(trace.plane.normal) + thrown_direction;
  91.  
  92. thrown_direction *= restitution;
  93.  
  94. pos = start + thrown_direction * trace.flFraction * step;
  95.  
  96. time += (step * (1.0f - trace.flFraction));
  97. }
  98.  
  99. // check for detonation
  100. auto detonate = true;
  101.  
  102. // emplace nade point
  103. _points.at(index++) = c_nadepoint(start, pos, trace.flFraction != 1.0f, true, trace.plane.normal, detonate);
  104. start = pos;
  105.  
  106. // apply gravity modifier
  107. thrown_direction.z -= gravity * trace.flFraction * step;
  108.  
  109. if (detonate) {
  110. break;
  111. }
  112. }
  113.  
  114. // invalidate all empty points and finish prediction
  115. for (auto n = index; n < 500; ++n) {
  116. _points.at(n).m_valid = false;
  117. }
  118.  
  119. _predicted = true;
  120. }
  121.  
  122. bool c_nade_prediction::detonated() {
  123. return true;
  124. }
  125. bool PredictGrenade = true;
  126. void c_nade_prediction::trace(CUserCmd *ucmd) {
  127. if (!PredictGrenade)
  128. return;
  129.  
  130. if (!(ucmd->buttons & IN_ATTACK) && !(ucmd->buttons & IN_ATTACK2)) {
  131. _predicted = false;
  132. return;
  133. }
  134.  
  135. const static std::vector< ItemDefinitionIndex > nades{
  136. ItemDefinitionIndex::WEAPON_FLASHBANG,
  137. ItemDefinitionIndex::WEAPON_SMOKEGRENADE,
  138. ItemDefinitionIndex::WEAPON_HEGRENADE,
  139. ItemDefinitionIndex::WEAPON_MOLOTOV,
  140. ItemDefinitionIndex::WEAPON_DECOY,
  141. ItemDefinitionIndex::WEAPON_INCGRENADE
  142. };
  143.  
  144. // grab local weapon
  145. auto weapon = Globals::LocalPlayer->GetActiveWeapon();
  146.  
  147. if (!weapon) {
  148. return;
  149. }
  150.  
  151. if (std::find(nades.begin(), nades.end(), weapon->GetItemDefinitionIndex()) != nades.end()) {
  152. return predict(ucmd);
  153. }
  154.  
  155. _predicted = false;
  156. }
  157.  
  158. void c_nade_prediction::draw() {
  159. if (!PredictGrenade)
  160. return;
  161.  
  162. if (!g_pEngine->IsInGame() || !Globals::LocalPlayer || !Globals::LocalPlayer->IsAlive())
  163. return;
  164.  
  165. Vector start, end;
  166.  
  167. // draw nade path
  168. if (_predicted) {
  169. for (auto &p : _points) {
  170. if (!p.m_valid) {
  171. break;
  172. }
  173.  
  174. if (Utils::WorldToScreen2(p.m_start, start) && Utils::WorldToScreen2(p.m_end, end)) {
  175. // draw line
  176. g_pSurface->Line(start.x, start.y, end.x, end.y, Color(255, 255, 255, 255));
  177.  
  178. // draw small box if detonated or hit a wall
  179. if (p.m_detonate || p.m_plane) {
  180. g_pSurface->FilledRect(start.x - 2, start.y - 2, 5, 5, Color(255, 255, 255, 255));
  181. }
  182. }
  183. }
  184. }
  185. }
  186.  
  187.  
  188. #define SEQUENCE_DEFAULT_DRAW 0
  189. #define SEQUENCE_DEFAULT_IDLE1 1
  190. #define SEQUENCE_DEFAULT_IDLE2 2
  191. #define SEQUENCE_DEFAULT_LIGHT_MISS1 3
  192. #define SEQUENCE_DEFAULT_LIGHT_MISS2 4
  193. #define SEQUENCE_DEFAULT_HEAVY_MISS1 9
  194. #define SEQUENCE_DEFAULT_HEAVY_HIT1 10
  195. #define SEQUENCE_DEFAULT_HEAVY_BACKSTAB 11
  196. #define SEQUENCE_DEFAULT_LOOKAT01 12
  197.  
  198. #define SEQUENCE_BUTTERFLY_DRAW 0
  199. #define SEQUENCE_BUTTERFLY_DRAW2 1
  200. #define SEQUENCE_BUTTERFLY_LOOKAT01 13
  201. #define SEQUENCE_BUTTERFLY_LOOKAT03 15
  202.  
  203. #define SEQUENCE_FALCHION_IDLE1 1
  204. #define SEQUENCE_FALCHION_HEAVY_MISS1 8
  205. #define SEQUENCE_FALCHION_HEAVY_MISS1_NOFLIP 9
  206. #define SEQUENCE_FALCHION_LOOKAT01 12
  207. #define SEQUENCE_FALCHION_LOOKAT02 13
  208.  
  209. #define SEQUENCE_DAGGERS_IDLE1 1
  210. #define SEQUENCE_DAGGERS_LIGHT_MISS1 2
  211. #define SEQUENCE_DAGGERS_LIGHT_MISS5 6
  212. #define SEQUENCE_DAGGERS_HEAVY_MISS2 11
  213. #define SEQUENCE_DAGGERS_HEAVY_MISS1 12
  214.  
  215. #define SEQUENCE_BOWIE_IDLE1 1
  216.  
  217.  
  218. int Hitmarkertime;
  219. int HitmarkerExpansion;
  220.  
  221. std::vector<std::pair<std::string, Color>> event_logs;
  222.  
  223. struct BulletImpact_t
  224. {
  225. float flImpactTime;
  226. Vector vecImpactPos;
  227. Color color;
  228. C_BaseEntity* pPlayer;
  229.  
  230. __forceinline BulletImpact_t()
  231. {
  232. vecImpactPos = { 0.0f, 0.0f, 0.0f };
  233. flImpactTime = 0.0f;
  234. color = Color(255, 255, 255, 255);
  235. pPlayer = nullptr;
  236. }
  237.  
  238. __forceinline BulletImpact_t(C_BaseEntity* player, Vector pos, float time, Color col = Color(255, 255, 255, 255))
  239. {
  240. pPlayer = player;
  241. flImpactTime = time;
  242. vecImpactPos = pos;
  243. color = col;
  244. }
  245. };
  246. std::deque<BulletImpact_t> Impacts;
  247. RecvVarProxyFn oRecvnModelIndex;
  248. RecvVarProxyFn fnSequenceProxyFn = NULL;
  249. #define RandomInt(nMin, nMax) (rand() % (nMax - nMin + 1) + nMin);
  250. void SetViewModelSequence(const CRecvProxyData *pDataConst, void *pStruct, void *pOut) {
  251. // Make the incoming data editable.
  252. CRecvProxyData* pData = const_cast<CRecvProxyData*>(pDataConst);
  253.  
  254. // Confirm that we are replacing our view model and not someone elses.
  255. C_BaseViewModel* pViewModel = (C_BaseViewModel*)pStruct;
  256.  
  257. if (pViewModel) {
  258. IClientEntity* pOwner = g_pEntityList->GetClientEntityFromHandle(CBaseHandle(pViewModel->GetOwner()));
  259.  
  260. // Compare the owner entity of this view model to the local player entity.
  261. if (pOwner && pOwner->EntIndex() == g_pEngine->GetLocalPlayer()) {
  262. // Get the filename of the current view model.
  263. void* pModel = g_pModelInfo->GetModel(pViewModel->GetModelIndex());
  264.  
  265. const char* szModel = g_pModelInfo->GetModelName((model_t*)pModel);
  266.  
  267. // Store the current sequence.
  268. int m_nSequence = pData->m_Value.m_Int;
  269.  
  270. if (!strcmp(szModel, "models/weapons/v_knife_butterfly.mdl")) {
  271. // Fix animations for the Butterfly Knife.
  272. switch (m_nSequence) {
  273. case SEQUENCE_DEFAULT_DRAW:
  274. m_nSequence = RandomInt(SEQUENCE_BUTTERFLY_DRAW, SEQUENCE_BUTTERFLY_DRAW2); break;
  275. case SEQUENCE_DEFAULT_LOOKAT01:
  276. m_nSequence = RandomInt(SEQUENCE_BUTTERFLY_LOOKAT01, SEQUENCE_BUTTERFLY_LOOKAT03); break;
  277. default:
  278. m_nSequence++;
  279. }
  280. }
  281. else if (!strcmp(szModel, "models/weapons/v_knife_falchion_advanced.mdl")) {
  282. // Fix animations for the Falchion Knife.
  283. switch (m_nSequence) {
  284. case SEQUENCE_DEFAULT_IDLE2:
  285. m_nSequence = SEQUENCE_FALCHION_IDLE1; break;
  286. case SEQUENCE_DEFAULT_HEAVY_MISS1:
  287. m_nSequence = RandomInt(SEQUENCE_FALCHION_HEAVY_MISS1, SEQUENCE_FALCHION_HEAVY_MISS1_NOFLIP); break;
  288. case SEQUENCE_DEFAULT_LOOKAT01:
  289. m_nSequence = RandomInt(SEQUENCE_FALCHION_LOOKAT01, SEQUENCE_FALCHION_LOOKAT02); break;
  290. case SEQUENCE_DEFAULT_DRAW:
  291. case SEQUENCE_DEFAULT_IDLE1:
  292. break;
  293. default:
  294. m_nSequence--;
  295. }
  296. }
  297. else if (!strcmp(szModel, "models/weapons/v_knife_push.mdl")) {
  298. // Fix animations for the Shadow Daggers.
  299. switch (m_nSequence) {
  300. case SEQUENCE_DEFAULT_IDLE2:
  301. m_nSequence = SEQUENCE_DAGGERS_IDLE1; break;
  302. case SEQUENCE_DEFAULT_LIGHT_MISS1:
  303. case SEQUENCE_DEFAULT_LIGHT_MISS2:
  304. m_nSequence = RandomInt(SEQUENCE_DAGGERS_LIGHT_MISS1, SEQUENCE_DAGGERS_LIGHT_MISS5); break;
  305. case SEQUENCE_DEFAULT_HEAVY_MISS1:
  306. m_nSequence = RandomInt(SEQUENCE_DAGGERS_HEAVY_MISS2, SEQUENCE_DAGGERS_HEAVY_MISS1); break;
  307. case SEQUENCE_DEFAULT_HEAVY_HIT1:
  308. case SEQUENCE_DEFAULT_HEAVY_BACKSTAB:
  309. case SEQUENCE_DEFAULT_LOOKAT01:
  310. m_nSequence += 3; break;
  311. case SEQUENCE_DEFAULT_DRAW:
  312. case SEQUENCE_DEFAULT_IDLE1:
  313. break;
  314. default:
  315. m_nSequence += 2;
  316. }
  317. }
  318. else if (!strcmp(szModel, "models/weapons/v_knife_survival_bowie.mdl")) {
  319. // Fix animations for the Bowie Knife.
  320. switch (m_nSequence) {
  321. case SEQUENCE_DEFAULT_DRAW:
  322. case SEQUENCE_DEFAULT_IDLE1:
  323. break;
  324. case SEQUENCE_DEFAULT_IDLE2:
  325. m_nSequence = SEQUENCE_BOWIE_IDLE1; break;
  326. default:
  327. m_nSequence--;
  328. }
  329. }
  330. else if (!strcmp(szModel, "models/weapons/v_knife_ursus.mdl")) {
  331. switch (m_nSequence)
  332. {
  333. case SEQUENCE_DEFAULT_DRAW:
  334. m_nSequence = RandomInt(SEQUENCE_BUTTERFLY_DRAW, SEQUENCE_BUTTERFLY_DRAW2);
  335. break;
  336. case SEQUENCE_DEFAULT_LOOKAT01:
  337. m_nSequence = RandomInt(SEQUENCE_BUTTERFLY_LOOKAT01, SEQUENCE_BUTTERFLY_LOOKAT03);
  338. break;
  339. default:
  340. m_nSequence++;
  341. break;
  342. }
  343. }
  344. else if (!strcmp(szModel, "models/weapons/v_knife_stiletto.mdl")) {
  345. switch (m_nSequence)
  346. {
  347. case SEQUENCE_DEFAULT_LOOKAT01:
  348. m_nSequence = RandomInt(12, 13);
  349. break;
  350. }
  351. }
  352. else if (!strcmp(szModel, "models/weapons/v_knife_widowmaker.mdl")) {
  353. switch (m_nSequence)
  354. {
  355. case SEQUENCE_DEFAULT_LOOKAT01:
  356. m_nSequence = RandomInt(14, 15);
  357. break;
  358. }
  359. }
  360. // Set the fixed sequence.
  361. pData->m_Value.m_Int = m_nSequence;
  362. }
  363. }
  364.  
  365. // Call original function with the modified data.
  366. fnSequenceProxyFn(pData, pStruct, pOut);
  367. }
  368.  
  369. const char* getKnifeModel(bool viewmodel = true)
  370. {
  371. int gay = 9;
  372. //
  373.  
  374. if (!Globals::LocalPlayer)
  375. return "models/weapons/v_knife_default_t.mdl";
  376.  
  377.  
  378. switch (c_config::get().knife_model)
  379. {
  380. case 0:
  381. return viewmodel ? Globals::LocalPlayer->GetTeam() == 2 ? "models/weapons/v_knife_default_t.mdl" : "models/weapons/v_knife_default_ct.mdl" : Globals::LocalPlayer->GetTeam() == 2 ? "models/weapons/w_knife_default_t.mdl" : "models/weapons/w_knife_default_ct.mdl";
  382. break;
  383.  
  384. case 1:
  385. return viewmodel ? "models/weapons/v_knife_m9_bay.mdl" : "models/weapons/w_knife_m9_bay.mdl";
  386. break;
  387.  
  388. case 2:
  389. return viewmodel ? "models/weapons/v_knife_bayonet.mdl" : "models/weapons/w_knife_bayonet.mdl";
  390. break;
  391.  
  392. case 3:
  393. return viewmodel ? "models/weapons/v_knife_flip.mdl" : "models/weapons/w_knife_flip.mdl";
  394. break;
  395.  
  396. case 4:
  397. return viewmodel ? "models/weapons/v_knife_gut.mdl" : "models/weapons/w_knife_gut.mdl";
  398. break;
  399.  
  400. case 5:
  401. return viewmodel ? "models/weapons/v_knife_karam.mdl" : "models/weapons/w_knife_karam.mdl";
  402. break;
  403.  
  404. case 6:
  405. return viewmodel ? "models/weapons/v_knife_tactical.mdl" : "models/weapons/w_knife_tactical.mdl";
  406. break;
  407.  
  408. case 7:
  409. return viewmodel ? "models/weapons/v_knife_falchion_advanced.mdl" : "models/weapons/w_knife_falchion_advanced.mdl";
  410. break;
  411.  
  412. case 8:
  413. return viewmodel ? "models/weapons/v_knife_survival_bowie.mdl" : "models/weapons/w_knife_survival_bowie.mdl";
  414. break;
  415. case 9:
  416. return viewmodel ? "models/weapons/v_knife_butterfly.mdl" : "models/weapons/w_knife_butterfly.mdl";
  417. break;
  418. case 10:
  419. return viewmodel ? "models/weapons/v_knife_push.mdl" : "models/weapons/w_knife_push.mdl";
  420. break;
  421. case 11:
  422. return viewmodel ? "models/weapons/v_knife_gypsy_jackknife.mdl" : "models/weapons/w_knife_gypsy_jackknife.mdl";
  423. break;
  424. case 12:
  425. return viewmodel ? "models/weapons/v_knife_stiletto.mdl" : "models/weapons/w_knife_stiletto.mdl";
  426. break;
  427. case 13:
  428. return viewmodel ? "models/weapons/v_knife_ursus.mdl" : "models/weapons/w_knife_ursus.mdl";
  429. break;
  430. case 14:
  431. return viewmodel ? "models/weapons/v_knife_widowmaker.mdl" : "models/weapons/2_knife_widowmaker.mdl";
  432. break;
  433. default:
  434. return "";
  435. break;
  436. }
  437. }
  438.  
  439. int getSkin(int shit_to_switch)
  440. {
  441. switch (shit_to_switch)
  442. {
  443. case 0:
  444. return 0;
  445. break;
  446. case 1:
  447. return 3;
  448. break;
  449. case 2:
  450. return 11;
  451. break;
  452. case 3:
  453. return 15;
  454. break;
  455. case 4:
  456. return 39;
  457. break;
  458. case 5:
  459. return 70;
  460. break;
  461. case 6:
  462. return 98;
  463. break;
  464. case 7:
  465. return 156;
  466. break;
  467. case 8:
  468. return 196;
  469. break;
  470. case 9:
  471. return 400;
  472. break;
  473. case 10:
  474. return 419;
  475. break;
  476. case 11:
  477. return 427;
  478. break;
  479. case 12:
  480. return 451;
  481. break;
  482. case 13:
  483. return 572;
  484. break;
  485. case 14:
  486. return 702;
  487. break;
  488. case 15:
  489. return 102;
  490. break;
  491. case 16:
  492. return 312;
  493. break;
  494. default:
  495. return 0;
  496. break;
  497. }
  498. }
  499.  
  500. int getKnifeItemDefinitionIndex()
  501. {
  502. int gay = 9;
  503. //
  504.  
  505. if (!Globals::LocalPlayer)
  506. return 59;
  507.  
  508.  
  509. switch (c_config::get().knife_model)
  510. {
  511. case 0:
  512. return Globals::LocalPlayer->GetTeam() == 1 ? 42 : 26;
  513. break;
  514.  
  515. case 1:
  516. return 508;
  517. break;
  518.  
  519. case 2:
  520. return 500;
  521. break;
  522.  
  523. case 3:
  524. return 505;
  525. break;
  526.  
  527. case 4:
  528. return 506;
  529. break;
  530.  
  531. case 5:
  532. return 507;
  533. break;
  534.  
  535. case 6:
  536. return 509; // Huntsman
  537. break;
  538.  
  539. case 7:
  540. return 512;
  541. break;
  542.  
  543. case 8:
  544. return 514;
  545. break;
  546.  
  547. case 9:
  548. return 515;
  549. break;
  550. case 10:
  551. return 516;
  552. break;
  553. case 11:
  554. return 520;
  555. break;
  556. case 12:
  557. return 522;
  558. break;
  559. case 13:
  560. return 519;
  561. break;
  562. default:
  563. return 523;
  564. break;
  565. }
  566. }
  567.  
  568. void Hooked_RecvProxy_Viewmodel(CRecvProxyData *pData, void *pStruct, void *pOut)
  569. {
  570. // Get the knife view model id's
  571. int default_t = g_pModelInfo->GetModelIndex("models/weapons/v_knife_default_t.mdl");
  572. int default_ct = g_pModelInfo->GetModelIndex("models/weapons/v_knife_default_ct.mdl");
  573. int iBayonet = g_pModelInfo->GetModelIndex("models/weapons/v_knife_bayonet.mdl");
  574. int iButterfly = g_pModelInfo->GetModelIndex("models/weapons/v_knife_butterfly.mdl");
  575. int iFlip = g_pModelInfo->GetModelIndex("models/weapons/v_knife_flip.mdl");
  576. int iGut = g_pModelInfo->GetModelIndex("models/weapons/v_knife_gut.mdl");
  577. int iKarambit = g_pModelInfo->GetModelIndex("models/weapons/v_knife_karam.mdl");
  578. int iM9Bayonet = g_pModelInfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
  579. int iHuntsman = g_pModelInfo->GetModelIndex("models/weapons/v_knife_tactical.mdl");
  580. int iFalchion = g_pModelInfo->GetModelIndex("models/weapons/v_knife_falchion_advanced.mdl");
  581. int iDagger = g_pModelInfo->GetModelIndex("models/weapons/v_knife_push.mdl");
  582. int iBowie = g_pModelInfo->GetModelIndex("models/weapons/v_knife_survival_bowie.mdl");
  583. int iGunGame = g_pModelInfo->GetModelIndex("models/weapons/v_knife_gg.mdl");
  584.  
  585. // Get local player (just to stop replacing spectators knifes)
  586. auto pLocal = Globals::LocalPlayer;
  587. if (pLocal && c_config::get().knife_model > 0)
  588. {
  589. // If we are alive and holding a default knife(if we already have a knife don't worry about changing)
  590. if (pLocal->IsAlive() && (
  591. pData->m_Value.m_Int == default_t ||
  592. pData->m_Value.m_Int == default_ct ||
  593. pData->m_Value.m_Int == iBayonet ||
  594. pData->m_Value.m_Int == iButterfly ||
  595. pData->m_Value.m_Int == iFlip ||
  596. pData->m_Value.m_Int == iGunGame ||
  597. pData->m_Value.m_Int == iGut ||
  598. pData->m_Value.m_Int == iKarambit ||
  599. pData->m_Value.m_Int == iM9Bayonet ||
  600. pData->m_Value.m_Int == iHuntsman ||
  601. pData->m_Value.m_Int == iFalchion ||
  602. pData->m_Value.m_Int == iDagger ||
  603. pData->m_Value.m_Int == iBowie))
  604. {
  605. pData->m_Value.m_Int = g_pModelInfo->GetModelIndex(getKnifeModel());
  606. }
  607. }
  608.  
  609. // Carry on the to original proxy
  610. oRecvnModelIndex(pData, pStruct, pOut);
  611. }
  612.  
  613.  
  614. void ApplyAAAHooks()
  615. {
  616. ClientClass *pClass = g_pClientDll->GetAllClasses();
  617. while (pClass)
  618. {
  619. const char *pszName = pClass->pRecvTable->pNetTableName;
  620.  
  621. if (!strcmp(pszName, "DT_BaseViewModel")) {
  622. // Search for the 'm_nModelIndex' property.
  623. RecvTable* pClassTable = pClass->pRecvTable;
  624.  
  625. for (int nIndex = 0; nIndex < pClass->pRecvTable->nProps; nIndex++) {
  626. RecvProp *pProp = &(pClass->pRecvTable->pProps[nIndex]);
  627.  
  628. if (!pProp || strcmp(pProp->pVarName, "m_nSequence"))
  629. continue;
  630.  
  631. // Store the original proxy function.
  632. fnSequenceProxyFn = (RecvVarProxyFn)pProp->ProxyFn;
  633.  
  634. // Replace the proxy function with our sequence changer.
  635. pProp->ProxyFn = SetViewModelSequence;
  636. }
  637. }
  638.  
  639. if (!strcmp(pszName, "DT_BaseViewModel"))
  640. {
  641. for (int i = 0; i < pClass->pRecvTable->nProps; i++)
  642. {
  643. RecvProp *pProp = &(pClass->pRecvTable->pProps[i]);
  644. const char *name = pProp->pVarName;
  645.  
  646. // Knives
  647. if (!strcmp(name, "m_nModelIndex"))
  648. {
  649. oRecvnModelIndex = (RecvVarProxyFn)pProp->ProxyFn;
  650. pProp->ProxyFn = (RecvVarProxyFn)Hooked_RecvProxy_Viewmodel;
  651. }
  652. }
  653. }
  654. pClass = pClass->pNext;
  655. }
  656. }
  657.  
  658. namespace StoredLocalPlayer {
  659. Vector StoredOrigin;
  660. }
  661. void Hooks::Init()
  662. {
  663. // Get window handle
  664. while (!(g_Hooks.hCSGOWindow = FindWindowA("Valve001", nullptr)))
  665. {
  666. using namespace std::literals::chrono_literals;
  667. std::this_thread::sleep_for(50ms);
  668. }
  669.  
  670. interfaces::Init(); // Get interfaces
  671. g_pNetvars = std::make_unique<NetvarTree>();// Get netvars after getting interfaces as we use them
  672.  
  673. Utils::Log("Hooking in progress...");
  674.  
  675. // VMTHooks
  676. g_Hooks.pClientHook = std::make_unique<VMTHook>(g_pClientDll);
  677. g_Hooks.pClientModeHook = std::make_unique<VMTHook>(g_pClientMode);
  678. g_Hooks.pSurfaceHook = std::make_unique<VMTHook>(g_pSurface);
  679. g_Hooks.pPanelHook = std::make_unique<VMTHook>(g_pPanel);
  680. g_Hooks.pRenderViewHook = std::make_unique<VMTHook>(g_pRenderView);
  681. g_Hooks.pModelHook = std::make_unique<VMTHook>(g_pModelRender);
  682.  
  683. // Hook the table functions
  684. g_Hooks.pClientHook->Hook(vtable_indexes::frameStage, Hooks::FrameStageNotify);
  685. g_Hooks.pClientModeHook->Hook(vtable_indexes::createMove, Hooks::CreateMove);
  686. g_Hooks.pClientModeHook->Hook(vtable_indexes::view, Hooks::OverrideView);
  687. g_Hooks.pClientModeHook->Hook(vtable_indexes::getviewmodelfov, Hooks::GetViewmodelFOV);
  688. g_Hooks.pSurfaceHook->Hook(vtable_indexes::lockCursor, Hooks::LockCursor);
  689. g_Hooks.pPanelHook->Hook(vtable_indexes::paint, Hooks::PaintTraverse);
  690.  
  691. g_Hooks.pRenderViewHook->Hook(vtable_indexes::sceneEnd, Hooks::SceneEnd);
  692.  
  693. g_Event.Init();
  694.  
  695. Globals::CourierNew = g_pSurface->FontCreate();
  696. Globals::WeaponESP = g_pSurface->FontCreate();
  697. Globals::SmallText = g_pSurface->FontCreate();
  698. Globals::WeaponIcon = g_pSurface->FontCreate();
  699. Globals::TabFont = g_pSurface->FontCreate();
  700. Globals::IndicatorFont = g_pSurface->FontCreate();
  701.  
  702. g_pSurface->SetFontGlyphSet(Globals::CourierNew, "Terminal Regular", 13, 800, 0, 0, FONTFLAG_DROPSHADOW);
  703. g_pSurface->SetFontGlyphSet(Globals::SmallText, "Terminal Regular", 14, 400, 0, 0, FONTFLAG_DROPSHADOW);
  704. g_pSurface->SetFontGlyphSet(Globals::WeaponESP, "Terminal Regular", 8, 400, 0, 0, FONTFLAG_OUTLINE);
  705. g_pSurface->SetFontGlyphSet(Globals::WeaponIcon, "Counter-Strike", 24, 400, 0, 0, FONTFLAG_ANTIALIAS);
  706. g_pSurface->SetFontGlyphSet(Globals::TabFont, "Terminal Regular", 18, 200, 0, 0, FONTFLAG_DROPSHADOW);
  707. g_pSurface->SetFontGlyphSet(Globals::IndicatorFont, "Terminal Regular", 24, 900, 0, 0, FONTFLAG_ANTIALIAS | FONTFLAG_DROPSHADOW);
  708.  
  709. ApplyAAAHooks();
  710. // g_pEngine->ExecuteClientCmd("play ambient\\playonce\\weather\\thunder4.wav");
  711. Utils::Log("Hooking completed!");
  712. }
  713. #include "SDK/Hitboxes.h"
  714. void RenderSkeleton(C_BaseEntity* pEnt, matrix3x4_t *matrix, Color skelecolor) // the best
  715. {
  716. Vector Hitbox[19];
  717. Vector2D Hitboxw2s[19];
  718.  
  719. for (int hitbox = 0; hitbox < 19; hitbox++)
  720. {
  721. Hitbox[hitbox] = pEnt->GetHitboxPosition(hitbox, matrix);
  722. Utils::WorldToScreen(Hitbox[hitbox], Hitboxw2s[hitbox]);
  723. }
  724.  
  725. //spine
  726. g_pSurface->Line(Hitboxw2s[HITBOX_HEAD].x, Hitboxw2s[HITBOX_HEAD].y, Hitboxw2s[HITBOX_NECK].x, Hitboxw2s[HITBOX_NECK].y, skelecolor);
  727. g_pSurface->Line(Hitboxw2s[HITBOX_NECK].x, Hitboxw2s[HITBOX_NECK].y, Hitboxw2s[HITBOX_UPPER_CHEST].x, Hitboxw2s[HITBOX_UPPER_CHEST].y, skelecolor);
  728. g_pSurface->Line(Hitboxw2s[HITBOX_UPPER_CHEST].x, Hitboxw2s[HITBOX_UPPER_CHEST].y, Hitboxw2s[HITBOX_LOWER_CHEST].x, Hitboxw2s[HITBOX_LOWER_CHEST].y, skelecolor);
  729. g_pSurface->Line(Hitboxw2s[HITBOX_LOWER_CHEST].x, Hitboxw2s[HITBOX_LOWER_CHEST].y, Hitboxw2s[HITBOX_THORAX].x, Hitboxw2s[HITBOX_THORAX].y, skelecolor);
  730. g_pSurface->Line(Hitboxw2s[HITBOX_THORAX].x, Hitboxw2s[HITBOX_THORAX].y, Hitboxw2s[HITBOX_BELLY].x, Hitboxw2s[HITBOX_BELLY].y, skelecolor);
  731. g_pSurface->Line(Hitboxw2s[HITBOX_BELLY].x, Hitboxw2s[HITBOX_BELLY].y, Hitboxw2s[HITBOX_PELVIS].x, Hitboxw2s[HITBOX_PELVIS].y, skelecolor);
  732.  
  733. //right leg
  734. g_pSurface->Line(Hitboxw2s[HITBOX_PELVIS].x, Hitboxw2s[HITBOX_PELVIS].y, Hitboxw2s[HITBOX_RIGHT_THIGH].x, Hitboxw2s[HITBOX_RIGHT_THIGH].y, skelecolor);
  735. g_pSurface->Line(Hitboxw2s[HITBOX_RIGHT_THIGH].x, Hitboxw2s[HITBOX_RIGHT_THIGH].y, Hitboxw2s[HITBOX_RIGHT_CALF].x, Hitboxw2s[HITBOX_RIGHT_CALF].y, skelecolor);
  736. g_pSurface->Line(Hitboxw2s[HITBOX_RIGHT_CALF].x, Hitboxw2s[HITBOX_RIGHT_CALF].y, Hitboxw2s[HITBOX_RIGHT_FOOT].x, Hitboxw2s[HITBOX_RIGHT_FOOT].y, skelecolor);
  737.  
  738. //right arm
  739. g_pSurface->Line(Hitboxw2s[HITBOX_NECK].x, Hitboxw2s[HITBOX_NECK].y, Hitboxw2s[HITBOX_RIGHT_UPPER_ARM].x, Hitboxw2s[HITBOX_RIGHT_UPPER_ARM].y, skelecolor);
  740. g_pSurface->Line(Hitboxw2s[HITBOX_RIGHT_UPPER_ARM].x, Hitboxw2s[HITBOX_RIGHT_UPPER_ARM].y, Hitboxw2s[HITBOX_RIGHT_FOREARM].x, Hitboxw2s[HITBOX_RIGHT_FOREARM].y, skelecolor);
  741. g_pSurface->Line(Hitboxw2s[HITBOX_RIGHT_FOREARM].x, Hitboxw2s[HITBOX_RIGHT_FOREARM].y, Hitboxw2s[HITBOX_RIGHT_HAND].x, Hitboxw2s[HITBOX_RIGHT_HAND].y, skelecolor);
  742.  
  743. //left leg
  744. g_pSurface->Line(Hitboxw2s[HITBOX_PELVIS].x, Hitboxw2s[HITBOX_PELVIS].y, Hitboxw2s[HITBOX_LEFT_THIGH].x, Hitboxw2s[HITBOX_LEFT_THIGH].y, skelecolor);
  745. g_pSurface->Line(Hitboxw2s[HITBOX_LEFT_THIGH].x, Hitboxw2s[HITBOX_LEFT_THIGH].y, Hitboxw2s[HITBOX_LEFT_CALF].x, Hitboxw2s[HITBOX_LEFT_CALF].y, skelecolor);
  746. g_pSurface->Line(Hitboxw2s[HITBOX_LEFT_CALF].x, Hitboxw2s[HITBOX_LEFT_CALF].y, Hitboxw2s[HITBOX_LEFT_FOOT].x, Hitboxw2s[HITBOX_LEFT_FOOT].y, skelecolor);
  747.  
  748. //left arm
  749. g_pSurface->Line(Hitboxw2s[HITBOX_NECK].x, Hitboxw2s[HITBOX_NECK].y, Hitboxw2s[HITBOX_LEFT_UPPER_ARM].x, Hitboxw2s[HITBOX_LEFT_UPPER_ARM].y, skelecolor);
  750. g_pSurface->Line(Hitboxw2s[HITBOX_LEFT_UPPER_ARM].x, Hitboxw2s[HITBOX_LEFT_UPPER_ARM].y, Hitboxw2s[HITBOX_LEFT_FOREARM].x, Hitboxw2s[HITBOX_LEFT_FOREARM].y, skelecolor);
  751. g_pSurface->Line(Hitboxw2s[HITBOX_LEFT_FOREARM].x, Hitboxw2s[HITBOX_LEFT_FOREARM].y, Hitboxw2s[HITBOX_LEFT_HAND].x, Hitboxw2s[HITBOX_LEFT_HAND].y, skelecolor);
  752.  
  753. }
  754. void Hooks::Restore()
  755. {
  756. Utils::Log("Unhooking in progress...");
  757. { // Unhook every function we hooked and restore original one
  758. g_Hooks.pClientModeHook->Unhook(vtable_indexes::createMove);
  759. g_Hooks.pSurfaceHook->Unhook(vtable_indexes::lockCursor);
  760. SetWindowLongPtr(g_Hooks.hCSGOWindow, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(g_Hooks.pOriginalWNDProc));
  761.  
  762. g_pNetvars.reset(); /* Need to reset by-hand, global pointer so doesnt go out-of-scope */
  763. }
  764. Utils::Log("Unhooking succeded!");
  765. }
  766.  
  767. bool __fastcall Hooks::SendNetMsg(NetChannel* pNetChan, void* edx, INetMessage& msg, bool bForceReliable, bool bVoice)
  768. {
  769. static auto oCreateMove = g_Hooks.pClientModeHook->GetOriginal<CreateMove_t>(vtable_indexes::createMove);
  770.  
  771. /* if (msg.GetType() == 14) // Return and don't send messsage if its FileCRCCheck
  772. return false;
  773.  
  774. if (msg.GetGroup() == 9) // Fix lag when transmitting voice and fakelagging
  775. bVoice = true;*/
  776.  
  777. //return g_Hooks.oSendNetMsg(pNetChan, msg, bForceReliable, bVoice);
  778. return false;
  779. }
  780.  
  781.  
  782. void KeyPressIndicator()
  783. {
  784. C_BaseCombatWeapon* local_weapon = Globals::LocalPlayer->GetActiveWeapon();
  785. if (!local_weapon || local_weapon->GetItemDefinitionIndex() != ItemDefinitionIndex::WEAPON_TASER)
  786. return;
  787. float step = M_PI * 2.0 / 2047; //adjust if you need 1-5 extra fps lol
  788. float rotation = 0; rotation < (M_PI * 2.0); rotation += step;
  789. float rad = local_weapon->GetCSWpnData()->range;
  790. Vector origin = Globals::LocalPlayer->GetEyePosition();
  791. static float hue_offset = 0;
  792. Vector pos(rad * cos(rotation) + origin.x, rad * sin(rotation) + origin.y, origin.z);
  793. if (c_config::get().vis_indiactors[0]) return;
  794. if (!g_pEngine->IsInGame() || !g_pEngine->IsConnected()) return;
  795. if (!Globals::LocalPlayer) return;
  796. if (Globals::LocalPlayer->GetHealth() <= 0) return;
  797.  
  798. int screen_hight, screen_width;
  799. g_pEngine->GetScreenSize(screen_width, screen_hight);
  800.  
  801.  
  802. static bool Dragging = false;
  803. bool click = false;
  804.  
  805. if (GetAsyncKeyState(VK_LBUTTON))
  806. click = true;
  807.  
  808.  
  809. //keypress indicator works but i broke the placement and couldnt be bothered to fix it
  810.  
  811.  
  812. static Vector2D oldPos;
  813. static Vector2D mousePos;
  814.  
  815. static int dragX = 0;
  816. static int dragY = 0;
  817. static int Width = 200;
  818. static int Height = 200;
  819.  
  820. static int iScreenWidth, iScreenHeight;
  821.  
  822. g_pEngine->GetScreenSize(iScreenWidth, iScreenHeight);
  823. Vector2D MousePos = g_pSurface->GetMousePosition();
  824.  
  825. if (Dragging && !click)
  826. {
  827. Dragging = false;
  828. }
  829.  
  830. if (Dragging && click)
  831. {
  832. pos.x = MousePos.x - dragX;
  833. pos.y = MousePos.y - dragY;
  834. }
  835.  
  836. if (g_pSurface->MouseInRegion(pos.x, pos.y, Width, 20))
  837. {
  838. Dragging = true;
  839. dragX = MousePos.x - pos.x;
  840. dragY = MousePos.y - pos.y;
  841. }
  842.  
  843. if (pos.x < 0)
  844. pos.x = 0;
  845. if (pos.y < 0)
  846. pos.y = 0;
  847. if ((pos.x + Width) > iScreenWidth)
  848. pos.x = iScreenWidth - Width;
  849. if ((pos.y + Height) > iScreenHeight)
  850. pos.y = iScreenHeight - Height;
  851.  
  852. g_pSurface->RoundedFilledRect(pos.x, pos.y, Width, Height, 2, Color(25, 25, 25, 225));
  853. g_pSurface->RoundedFilledRect(pos.x, pos.y + 20, Width, Height - 40, 2, Color(33, 33, 33, 255));
  854. /// im gonna do this by rendering a few rectangles each with keyboard key on it (w, a, s, d and space) and when a key is pressed
  855. /// i make the corresponding rectangle darker ( and make the alpha higher )
  856.  
  857. /*
  858. spacebar: 0x20 (VK_SPACE)
  859. a: 0x41
  860. d: 0x44
  861. s: 0x53
  862. w: 0x57
  863. */
  864.  
  865. int a1, a2, a3, a4, a5;
  866. Color c1, c2, c3, c4, c5; // its not possible with one variable
  867. Color w, a, s, d, space;
  868.  
  869. // this is so fucking bad
  870.  
  871. if (GetAsyncKeyState(0x57)) // w
  872. {
  873. a1 = 220;
  874. c1 = Color(45, 45, 45, a1);
  875. w = Color(0, 255, 0, 250);
  876. }
  877. else
  878. {
  879. a1 = 120;
  880. c1 = Color(35, 35, 35, a1);
  881. w = Color(255, 255, 255, 250);
  882. }
  883.  
  884. if (GetAsyncKeyState(0x53)) // s
  885. {
  886. a2 = 220;
  887. c2 = Color(45, 45, 40, a2);
  888. s = Color(0, 255, 0, 250);
  889. }
  890. else
  891. {
  892. a2 = 120;
  893. c2 = Color(35, 35, 35, a2);
  894. s = Color(255, 255, 255, 250);
  895.  
  896. }
  897.  
  898. if (GetAsyncKeyState(0x41)) //a
  899. {
  900. a3 = 220;
  901. c3 = Color(45, 45, 45, a3);
  902. a = Color(0, 255, 0, 250);
  903.  
  904. }
  905. else
  906. {
  907. a3 = 120;
  908. c3 = Color(35, 35, 35, a3);
  909. a = Color(255, 255, 255, 250);
  910.  
  911. }
  912.  
  913. if (GetAsyncKeyState(0x44))// d
  914. {
  915. a4 = 220;
  916. c4 = Color(45, 45, 45, a4);
  917. d = Color(0, 255, 0, 250);
  918.  
  919. }
  920. else
  921. {
  922. a4 = 120;
  923. c4 = Color(35, 35, 35, a4);
  924. d = Color(255, 255, 255, 250);
  925.  
  926. }
  927.  
  928. if (GetAsyncKeyState(VK_SPACE))
  929. {
  930. a5 = 220;
  931. c5 = Color(45, 45, 45, a5);
  932. space = Color(0, 255, 0, 250);
  933. }
  934. else
  935. {
  936. a5 = 120;
  937. c5 = Color(35, 35, 35, a5);
  938. space = Color(255, 255, 255, 250);
  939. }
  940.  
  941.  
  942.  
  943. g_pSurface->FilledRect(pos.x - 100, pos.y + 20, 30, 30, c1);
  944. g_pSurface->DrawT(pos.x, 605, w, Globals::IndicatorFont, true, "W");
  945.  
  946. g_pSurface->FilledRect(pos.x - 100, pos.y + 40, 30, 30, c2);
  947. g_pSurface->DrawT(pos.x, 645, s, Globals::IndicatorFont, true, "S");
  948.  
  949. g_pSurface->FilledRect(pos.x - 60, pos.y + 40, 30, 30, c3);
  950. g_pSurface->DrawT(50, 645, a, Globals::IndicatorFont, true, "A");
  951.  
  952. g_pSurface->FilledRect(pos.x - 120, pos.y + 40, 30, 30, c4);
  953. g_pSurface->DrawT(130, 645, d, Globals::IndicatorFont, true, "D");
  954.  
  955. g_pSurface->FilledRect(pos.x - 60, pos.y + 60, 110, 30, c5);
  956. g_pSurface->DrawT(70, 685, space, Globals::IndicatorFont, true, "SPACE"); // furthest left is 40, farthest right is like 110
  957.  
  958. }
  959.  
  960.  
  961. #include "Features/GrenadePrediction/GrenadePrediction.h"
  962. #include "Features/Legit Aimbot/Legit Aimbot.h"
  963. bool __fastcall Hooks::CreateMove(IClientMode* thisptr, void* edx, float sample_frametime, CUserCmd* pCmd)
  964. {
  965. // Call original createmove before we start screwing with it
  966. static auto oCreateMove = g_Hooks.pClientModeHook->GetOriginal<CreateMove_t>(vtable_indexes::createMove);
  967. oCreateMove(thisptr, edx, sample_frametime, pCmd);
  968.  
  969. if (!pCmd || !pCmd->command_number)
  970. return false;
  971.  
  972. // Get globals
  973. Globals::pCmd = pCmd;
  974. Globals::LocalPlayer = g_pEntityList->GetClientEntity(g_pEngine->GetLocalPlayer());
  975. Globals::bSendPacket = true;
  976. if (!Globals::LocalPlayer)
  977. return false;
  978.  
  979. uintptr_t *framePtr;
  980. __asm mov framePtr, ebp;
  981.  
  982. Globals::OriginalView = Globals::pCmd->viewangles;
  983.  
  984. if (Globals::LocalPlayer && Globals::LocalPlayer->IsAlive()) {
  985. backtracking->legitBackTrack(pCmd, Globals::LocalPlayer);
  986. }
  987.  
  988. g_Misc.OnCreateMove();
  989. g_Resolver.OnCreateMove();
  990.  
  991. if (c_config::get().misc_fastcrouch)
  992. pCmd->buttons |= IN_BULLRUSH;
  993.  
  994. engine_prediction::RunEnginePred();
  995. g_AntiAim.OnCreateMove();
  996. g_Aimbot.OnCreateMove();
  997. Vector OrigAng = Globals::pCmd->viewangles;
  998.  
  999. //circleStrafer(OrigAng.y);
  1000.  
  1001. if (Globals::LocalPlayer && Globals::LocalPlayer->IsAlive())
  1002. {
  1003. if (c_config::get().grenade_prediction) {
  1004. GrenadePrediction::get().Tick(pCmd->buttons);
  1005. }
  1006.  
  1007.  
  1008.  
  1009. g_LegitAimbot.Aim_CreateMove(pCmd);
  1010. }
  1011.  
  1012. engine_prediction::EndEnginePred();
  1013. g_Misc.NoRecoil(pCmd);
  1014. //g_nadepred.trace(pCmd);
  1015. //g_Misc.slow_walk(pCmd);
  1016. //g_Misc.LinearExtrapolations();
  1017. //FakeCrouch(pCmd, Globals::bSendPacket);
  1018. g_Misc.MovementFix(Globals::OriginalView);
  1019. g_Math.Clamp(Globals::pCmd->viewangles);
  1020.  
  1021.  
  1022. if (Globals::bSendPacket && Globals::LocalPlayer) {
  1023. if (Globals::LocalPlayer->IsAlive()) {
  1024. StoredLocalPlayer::StoredOrigin = Globals::LocalPlayer->GetOrigin();
  1025. }
  1026. }
  1027.  
  1028. if (Globals::bSendPacket)
  1029. Globals::RealAngle = Globals::pCmd->viewangles;
  1030. else
  1031. Globals::FakeAngle = Globals::pCmd->viewangles;
  1032.  
  1033. *(bool*)(*framePtr - 0x1C) = Globals::bSendPacket;
  1034.  
  1035. return false;
  1036. }
  1037. #include <functional>
  1038. #include <utility>
  1039.  
  1040. enum ItemDefinitionIndexv2 : int
  1041. {
  1042. WEAPON_NONE = 0,
  1043.  
  1044. WEAPON_DEAGLE,
  1045. WEAPON_ELITE,
  1046. WEAPON_FIVESEVEN,
  1047. WEAPON_GLOCK,
  1048. WEAPON_AK47 = 7,
  1049. WEAPON_AUG,
  1050. WEAPON_AWP,
  1051. WEAPON_FAMAS,
  1052. WEAPON_G3SG1,
  1053. WEAPON_GALILAR = 13,
  1054. WEAPON_M249,
  1055. WEAPON_M4A1 = 16,
  1056. WEAPON_MAC10,
  1057. WEAPON_P90 = 19,
  1058. WEAPON_MP5SD = 23,
  1059. WEAPON_UMP45,
  1060. WEAPON_XM1014,
  1061. WEAPON_BIZON,
  1062. WEAPON_MAG7,
  1063. WEAPON_NEGEV,
  1064. WEAPON_SAWEDOFF,
  1065. WEAPON_TEC9,
  1066. WEAPON_TASER,
  1067. WEAPON_HKP2000,
  1068. WEAPON_MP7,
  1069. WEAPON_MP9,
  1070. WEAPON_NOVA,
  1071. WEAPON_P250,
  1072. WEAPON_SHIELD,
  1073. WEAPON_SCAR20,
  1074. WEAPON_SG556,
  1075. WEAPON_SSG08,
  1076. WEAPON_KNIFEGG,
  1077. WEAPON_KNIFE,
  1078. WEAPON_FLASHBANG,
  1079. WEAPON_HEGRENADE,
  1080. WEAPON_SMOKEGRENADE,
  1081. WEAPON_MOLOTOV,
  1082. WEAPON_DECOY,
  1083. WEAPON_INCGRENADE,
  1084. WEAPON_C4,
  1085. WEAPON_HEALTHSHOT = 57,
  1086. WEAPON_KNIFE_T = 59,
  1087. WEAPON_M4A1_SILENCER,
  1088. WEAPON_USP_SILENCER,
  1089. WEAPON_CZ75A = 63,
  1090. WEAPON_REVOLVER,
  1091. WEAPON_TAGRENADE = 68,
  1092. WEAPON_FISTS,
  1093. WEAPON_BREACHCHARGE,
  1094. WEAPON_TABLET = 72,
  1095. WEAPON_MELEE = 74,
  1096. WEAPON_AXE,
  1097. WEAPON_HAMMER,
  1098. WEAPON_SPANNER = 78,
  1099. WEAPON_KNIFE_GHOST = 80,
  1100. WEAPON_FIREBOMB,
  1101. WEAPON_DIVERSION,
  1102. WEAPON_FRAG_GRENADE,
  1103. WEAPON_SNOWBALL,
  1104. WEAPON_BUMPMINE,
  1105. WEAPON_BAYONET = 500,
  1106. WEAPON_KNIFE_FLIP = 505,
  1107. WEAPON_KNIFE_GUT,
  1108. WEAPON_KNIFE_KARAMBIT,
  1109. WEAPON_KNIFE_M9_BAYONET,
  1110. WEAPON_KNIFE_TACTICAL,
  1111. WEAPON_KNIFE_FALCHION = 512,
  1112. WEAPON_KNIFE_SURVIVAL_BOWIE = 514,
  1113. WEAPON_KNIFE_BUTTERFLY,
  1114. WEAPON_KNIFE_PUSH,
  1115. WEAPON_KNIFE_URSUS = 519,
  1116. WEAPON_KNIFE_GYPSY_JACKKNIFE,
  1117. WEAPON_KNIFE_STILETTO = 522,
  1118. WEAPON_KNIFE_WIDOWMAKER
  1119. };
  1120.  
  1121. void GloveChanger()
  1122. {
  1123.  
  1124. if (c_config::get().glove_model > 0)
  1125. {
  1126. PlayerInfo_t localPlayerInfo;
  1127.  
  1128. C_BaseEntity* pLocal = g_pEntityList->GetClientEntity(g_pEngine->GetLocalPlayer());
  1129. if (pLocal)
  1130. {
  1131. if (g_pEngine->GetPlayerInfo(g_pEngine->GetLocalPlayer(), &localPlayerInfo))
  1132. {
  1133. DWORD* hMyWearables = (DWORD*)((size_t)pLocal->get_my_wearables());
  1134.  
  1135. if (hMyWearables)
  1136. {
  1137. if (!g_pEntityList->GetClientEntityFromHandle((DWORD)hMyWearables[0]))
  1138. {
  1139. static ClientClass* pClass;
  1140.  
  1141. if (!pClass)
  1142. pClass = g_pClientDll->GetAllClasses();
  1143. while (pClass)
  1144. {
  1145. if (pClass->ClassID == 52)
  1146. break;
  1147. pClass = pClass->pNext;
  1148. }
  1149.  
  1150. int iEntry = g_pEntityList->GetHighestEntityIndex() + 1;
  1151. int iSerial = RandomInt(0x0, 0xFFF);
  1152.  
  1153. pClass->pCreateFn(iEntry, iSerial);
  1154. hMyWearables[0] = iEntry | (iSerial << 16);
  1155.  
  1156. C_BaseEntity* pEnt = g_pEntityList->GetClientEntityFromHandleEntity((DWORD)hMyWearables[0]);
  1157.  
  1158. if (pEnt)
  1159. {
  1160. int modelindex = 0;
  1161.  
  1162. if (c_config::get().glove_model == 1)
  1163. modelindex = g_pModelInfo->GetModelIndex(("models/weapons/v_models/arms/glove_bloodhound/v_glove_bloodhound.mdl"));
  1164. else if (c_config::get().glove_model == 2)
  1165. modelindex = g_pModelInfo->GetModelIndex(("models/weapons/v_models/arms/glove_sporty/v_glove_sporty.mdl"));
  1166. else if (c_config::get().glove_model == 3)
  1167. modelindex = g_pModelInfo->GetModelIndex(("models/weapons/v_models/arms/glove_slick/v_glove_slick.mdl"));
  1168. else if (c_config::get().glove_model == 4)
  1169. modelindex = g_pModelInfo->GetModelIndex(("models/weapons/v_models/arms/glove_handwrap_leathery/v_glove_handwrap_leathery.mdl"));
  1170. else if (c_config::get().glove_model == 5)
  1171. modelindex = g_pModelInfo->GetModelIndex(("models/weapons/v_models/arms/glove_motorcycle/v_glove_motorcycle.mdl"));
  1172. else if (c_config::get().glove_model == 6)
  1173. modelindex = g_pModelInfo->GetModelIndex(("models/weapons/v_models/arms/glove_specialist/v_glove_specialist.mdl"));
  1174. else if (c_config::get().glove_model == 7)
  1175. modelindex = g_pModelInfo->GetModelIndex(("models/weapons/v_models/arms/glove_bloodhound/v_glove_bloodhound_hydra.mdl"));
  1176.  
  1177. int ItemDefinitionIndex;
  1178. if (c_config::get().glove_model == 1)
  1179. {
  1180. ItemDefinitionIndex = 5027;
  1181. }
  1182. else if (c_config::get().glove_model == 2)
  1183. {
  1184. ItemDefinitionIndex = 5030;
  1185. }
  1186. else if (c_config::get().glove_model == 3)
  1187. {
  1188. ItemDefinitionIndex = 5031;
  1189. }
  1190. else if (c_config::get().glove_model == 4)
  1191. {
  1192. ItemDefinitionIndex = 5032;
  1193. }
  1194. else if (c_config::get().glove_model == 5)
  1195. {
  1196. ItemDefinitionIndex = 5033;
  1197. }
  1198. else if (c_config::get().glove_model == 6)
  1199. {
  1200. ItemDefinitionIndex = 5034;
  1201. }
  1202. else if (c_config::get().glove_model == 7)
  1203. {
  1204. ItemDefinitionIndex = 5035;
  1205. }
  1206. else
  1207. ItemDefinitionIndex = 0;
  1208.  
  1209. int paintkit;
  1210. if (c_config::get().glove_model == 1)
  1211. {
  1212. switch (c_config::get().glove_skin)
  1213. {
  1214. case 0:
  1215. paintkit = 10006;
  1216. break;
  1217. case 1:
  1218. paintkit = 10007;
  1219. break;
  1220. case 2:
  1221. paintkit = 10008;
  1222. break;
  1223. case 3:
  1224. paintkit = 10039;
  1225. break;
  1226. default:
  1227. paintkit = 0; break;
  1228. }
  1229. }
  1230. else if (c_config::get().glove_model == 2)
  1231. {
  1232. switch (c_config::get().glove_skin)
  1233. {
  1234. case 0:
  1235. paintkit = 10038; break;
  1236. case 1:
  1237. paintkit = 10037; break;
  1238. case 2:
  1239. paintkit = 10018; break;
  1240. case 3:
  1241. paintkit = 10019; break;
  1242. case 4:
  1243. paintkit = 10048; break;
  1244. case 5:
  1245. paintkit = 10047; break;
  1246. case 6:
  1247. paintkit = 10045; break;
  1248. case 7:
  1249. paintkit = 10046; break;
  1250. default:
  1251. paintkit = 0; break;
  1252. }
  1253. }
  1254. else if (c_config::get().glove_model == 3)
  1255. {
  1256. switch (c_config::get().glove_skin)
  1257. {
  1258. case 0:
  1259. paintkit = 10013; break;
  1260. case 1:
  1261. paintkit = 10015; break;
  1262. case 2:
  1263. paintkit = 10016; break;
  1264. case 3:
  1265. paintkit = 10040; break;
  1266. case 4:
  1267. paintkit = 10043; break;
  1268. case 5:
  1269. paintkit = 10044; break;
  1270. case 6:
  1271. paintkit = 10041; break;
  1272. case 7:
  1273. paintkit = 10042; break;
  1274. default:
  1275. paintkit = 0; break;
  1276. }
  1277. }
  1278. else if (c_config::get().glove_model == 4)
  1279. {
  1280. switch (c_config::get().glove_skin)
  1281. {
  1282. case 0:
  1283. paintkit = 10009; break;
  1284. case 1:
  1285. paintkit = 10010; break;
  1286. case 2:
  1287. paintkit = 10021; break;
  1288. case 3:
  1289. paintkit = 10036; break;
  1290. case 4:
  1291. paintkit = 10053; break;
  1292. case 5:
  1293. paintkit = 10054; break;
  1294. case 6:
  1295. paintkit = 10055; break;
  1296. case 7:
  1297. paintkit = 10056; break;
  1298. default:
  1299. paintkit = 0; break;
  1300. }
  1301. }
  1302. else if (c_config::get().glove_model == 5)
  1303. {
  1304. switch (c_config::get().glove_skin)
  1305. {
  1306. case 0:
  1307. paintkit = 10024; break;
  1308. case 1:
  1309. paintkit = 10026; break;
  1310. case 2:
  1311. paintkit = 10027; break;
  1312. case 3:
  1313. paintkit = 10028; break;
  1314. case 4:
  1315. paintkit = 10050; break;
  1316. case 5:
  1317. paintkit = 10051; break;
  1318. case 6:
  1319. paintkit = 10052; break;
  1320. case 7:
  1321. paintkit = 10049; break;
  1322. default:
  1323. paintkit = 0; break;
  1324. }
  1325. }
  1326. else if (c_config::get().glove_model == 6)
  1327. {
  1328. switch (c_config::get().glove_skin)
  1329. {
  1330. case 0:
  1331. paintkit = 10030; break;
  1332. case 1:
  1333. paintkit = 10033; break;
  1334. case 2:
  1335. paintkit = 10034; break;
  1336. case 3:
  1337. paintkit = 10035; break;
  1338. case 4:
  1339. paintkit = 10061; break;
  1340. case 5:
  1341. paintkit = 10062; break;
  1342. case 6:
  1343. paintkit = 10063; break;
  1344. case 7:
  1345. paintkit = 10064; break;
  1346. default:
  1347. paintkit = 0; break;
  1348. }
  1349. }
  1350. else if (c_config::get().glove_model == 7)
  1351. {
  1352. switch (c_config::get().glove_skin)
  1353. {
  1354. case 0:
  1355. paintkit = 10057; break;
  1356. case 1:
  1357. paintkit = 10058; break;
  1358. case 2:
  1359. paintkit = 10059; break;
  1360. case 3:
  1361. paintkit = 10060; break;
  1362. default:
  1363. paintkit = 0; break;
  1364. }
  1365. }
  1366. //*(int*)((DWORD)pEnt + OFFSETS::m_iItemDefinitionIndex) = ItemDefinitionIndex;
  1367. //*(int*)((DWORD)pEnt + OFFSETS::m_iItemIDHigh) = -1; //0x2FB0
  1368. //*(int*)((DWORD)pEnt + OFFSETS::m_iEntityQuality) = 4;
  1369. //*(int*)((DWORD)pEnt->GetAccountID()) = localPlayerInfo.xuidLow;
  1370. //*(float*)((DWORD)pEnt + OFFSETS::m_flFallbackWear) = SETTINGS::settings.glovewear;
  1371. //*(int*)((DWORD)pEnt + OFFSETS::m_nFallbackSeed) = 0;
  1372. //*(int*)((DWORD)pEnt + OFFSETS::m_nFallbackStatTrak) = -1;
  1373. //*(int*)((DWORD)pEnt + OFFSETS::m_nFallbackPaintKit) = paintkit;
  1374.  
  1375. *pEnt->ItemDefinitionIndex2() = ItemDefinitionIndex;
  1376.  
  1377. pEnt->GetItemIDHigh() = -1;
  1378. pEnt->GetAccountID() = localPlayerInfo.xuidLow;
  1379.  
  1380. *pEnt->FallbackWear() = 0.00000000001;
  1381. *pEnt->FallbackPaintKit() = paintkit;
  1382. *pEnt->FallbackSeed() = 0;
  1383.  
  1384. pEnt->SetModelIndex(modelindex);
  1385. pEnt->PreDataUpdate(DATA_UPDATE_CREATEDxd);
  1386. }
  1387. }
  1388. }
  1389.  
  1390. }
  1391. }
  1392. }
  1393. }
  1394.  
  1395. bool SetShit = false;
  1396. void NewSkinChanger()
  1397. {
  1398. if (!Globals::LocalPlayer)
  1399. return;
  1400.  
  1401. if (Globals::LocalPlayer->IsAlive())
  1402. {
  1403. int nLocalPlayerID = g_pEngine->GetLocalPlayer();
  1404. C_BaseEntity* pLocal = (C_BaseEntity*)g_pEntityList->GetClientEntity(nLocalPlayerID);
  1405.  
  1406.  
  1407. auto Weapons = Globals::LocalPlayer->GetWeapons();
  1408.  
  1409. for (int i = 0; i < 64; i++) {
  1410. if (Weapons[i] == -1)
  1411. continue;
  1412.  
  1413. C_BaseCombatWeapon* Weap = (C_BaseCombatWeapon*)g_pEntityList->GetClientEntityFromHandle(Weapons[i]);
  1414.  
  1415. if (!Weap || Weap == nullptr)
  1416. continue;
  1417.  
  1418.  
  1419. ClientClass* pClass = g_pClientDll->GetAllClasses();
  1420.  
  1421. auto world_model_handle = Weap->m_hWeaponWorldModel_h();
  1422.  
  1423. const auto world_model = (CBaseWeaponWorldModel*)(g_pEntityList->GetClientEntityFromHandle(world_model_handle));
  1424.  
  1425.  
  1426. if (Weap->GetClientClass()->ClassID == (int)EClassIds::CKnife && c_config::get().knife_model > 0)
  1427. {
  1428. *Weap->ItemDefinitionIndex2() = getKnifeItemDefinitionIndex();
  1429. Weap->SetModelIndex(g_pModelInfo->GetModelIndex(getKnifeModel()));
  1430.  
  1431. if (world_model) {
  1432. *world_model->GetModelIndex() = g_pModelInfo->GetModelIndex(getKnifeModel(false));
  1433. }
  1434.  
  1435. Weap->GetItemIDLow() = -1;
  1436. Weap->GetItemIDHigh() = -1;
  1437. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().knife_skin);
  1438. *Weap->FallbackWear() = 0.00000000001;
  1439. }
  1440.  
  1441. switch (Weap->GetItemDefinitionIndex())
  1442. {
  1443. case ItemDefinitionIndex::WEAPON_SSG08:
  1444. {
  1445. Weap->GetItemIDHigh() = -1;
  1446. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().ssg08_skin);
  1447. *Weap->FallbackSeed() = 0;
  1448. *Weap->OwnerXuidLow() = 0;
  1449. *Weap->OwnerXuidHigh() = 0;
  1450. *Weap->FallbackWear() = 0.00000000001;
  1451. }
  1452. break;
  1453. case ItemDefinitionIndex::WEAPON_M4A1:
  1454. {
  1455. Weap->GetItemIDHigh() = -1;
  1456. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().m4a4_skin);
  1457. *Weap->FallbackSeed() = 0;
  1458. *Weap->OwnerXuidLow() = 0;
  1459. *Weap->OwnerXuidHigh() = 0;
  1460. *Weap->FallbackWear() = 0.00000000001;
  1461. }
  1462. break;
  1463. case ItemDefinitionIndex::WEAPON_M4A1_SILENCER:
  1464. {
  1465. Weap->GetItemIDHigh() = -1;
  1466. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().m4a1_s_skin);
  1467. *Weap->FallbackSeed() = 0;
  1468. *Weap->OwnerXuidLow() = 0;
  1469. *Weap->OwnerXuidHigh() = 0;
  1470. *Weap->FallbackWear() = 0.00000000001;
  1471. }
  1472. break;
  1473. case ItemDefinitionIndex::WEAPON_AK47:
  1474. {
  1475. Weap->GetItemIDHigh() = -1;
  1476. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().ak47_skin);
  1477. *Weap->FallbackSeed() = 0;
  1478. *Weap->OwnerXuidLow() = 0;
  1479. *Weap->OwnerXuidHigh() = 0;
  1480. *Weap->FallbackWear() = 0.00000000001;
  1481. }
  1482. break;
  1483. case ItemDefinitionIndex::WEAPON_AUG:
  1484. {
  1485. Weap->GetItemIDHigh() = -1;
  1486. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().aug_skin);
  1487. *Weap->FallbackSeed() = 0;
  1488. *Weap->OwnerXuidLow() = 0;
  1489. *Weap->OwnerXuidHigh() = 0;
  1490. *Weap->FallbackWear() = 0.00000000001;
  1491. }
  1492. break;
  1493. case ItemDefinitionIndex::WEAPON_FAMAS:
  1494. {
  1495. Weap->GetItemIDHigh() = -1;
  1496. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().famas_skin);
  1497. *Weap->FallbackSeed() = 0;
  1498. *Weap->OwnerXuidLow() = 0;
  1499. *Weap->OwnerXuidHigh() = 0;
  1500. *Weap->FallbackWear() = 0.00000000001;
  1501. }
  1502. break;
  1503. case ItemDefinitionIndex::WEAPON_G3SG1:
  1504. {
  1505. Weap->GetItemIDHigh() = -1;
  1506. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().g3sg1_skin);
  1507. *Weap->FallbackSeed() = 0;
  1508. *Weap->OwnerXuidLow() = 0;
  1509. *Weap->OwnerXuidHigh() = 0;
  1510. *Weap->FallbackWear() = 0.00000000001;
  1511. }
  1512. break;
  1513. case ItemDefinitionIndex::WEAPON_GALILAR:
  1514. {
  1515. Weap->GetItemIDHigh() = -1;
  1516. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().galilar_skin);
  1517. *Weap->FallbackSeed() = 0;
  1518. *Weap->OwnerXuidLow() = 0;
  1519. *Weap->OwnerXuidHigh() = 0;
  1520. *Weap->FallbackWear() = 0.00000000001;
  1521. }
  1522. break;
  1523. case ItemDefinitionIndex::WEAPON_SCAR20:
  1524. {
  1525. Weap->GetItemIDHigh() = -1;
  1526. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().scar20_skin);
  1527. *Weap->FallbackSeed() = 0;
  1528. *Weap->OwnerXuidLow() = 0;
  1529. *Weap->OwnerXuidHigh() = 0;
  1530. *Weap->FallbackWear() = 0.00000000001;
  1531. }
  1532. break;
  1533. case ItemDefinitionIndex::WEAPON_SG556:
  1534. {
  1535. Weap->GetItemIDHigh() = -1;
  1536. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().sg556_skin);
  1537. *Weap->FallbackSeed() = 0;
  1538. *Weap->OwnerXuidLow() = 0;
  1539. *Weap->OwnerXuidHigh() = 0;
  1540. *Weap->FallbackWear() = 0.00000000001;
  1541. }
  1542. break;
  1543. case ItemDefinitionIndex::WEAPON_BIZON:
  1544. {
  1545. Weap->GetItemIDHigh() = -1;
  1546. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().bizon_skin);
  1547. *Weap->FallbackSeed() = 0;
  1548. *Weap->OwnerXuidLow() = 0;
  1549. *Weap->OwnerXuidHigh() = 0;
  1550. *Weap->FallbackWear() = 0.00000000001;
  1551. }
  1552. break;
  1553. case ItemDefinitionIndex::WEAPON_REVOLVER:
  1554. {
  1555. Weap->GetItemIDHigh() = -1;
  1556. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().r8_skin);
  1557. *Weap->FallbackSeed() = 0;
  1558. *Weap->OwnerXuidLow() = 0;
  1559. *Weap->OwnerXuidHigh() = 0;
  1560. *Weap->FallbackWear() = 0.00000000001;
  1561. }
  1562. break;
  1563. case ItemDefinitionIndex::WEAPON_TEC9:
  1564. {
  1565. Weap->GetItemIDHigh() = -1;
  1566. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().tec9_skin);
  1567. *Weap->FallbackSeed() = 0;
  1568. *Weap->OwnerXuidLow() = 0;
  1569. *Weap->OwnerXuidHigh() = 0;
  1570. *Weap->FallbackWear() = 0.00000000001;
  1571. }
  1572. break;
  1573. case ItemDefinitionIndex::WEAPON_DEAGLE:
  1574. {
  1575. Weap->GetItemIDHigh() = -1;
  1576. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().deagle_skin);
  1577. *Weap->FallbackSeed() = 0;
  1578. *Weap->OwnerXuidLow() = 0;
  1579. *Weap->OwnerXuidHigh() = 0;
  1580. *Weap->FallbackWear() = 0.00000000001;
  1581. }
  1582. break;
  1583. case ItemDefinitionIndex::WEAPON_ELITE:
  1584. {
  1585. Weap->GetItemIDHigh() = -1;
  1586. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().dualelites_skin);
  1587. *Weap->FallbackSeed() = 0;
  1588. *Weap->OwnerXuidLow() = 0;
  1589. *Weap->OwnerXuidHigh() = 0;
  1590. *Weap->FallbackWear() = 0.00000000001;
  1591. }
  1592. break;
  1593. case ItemDefinitionIndex::WEAPON_USP_SILENCER:
  1594. {
  1595. Weap->GetItemIDHigh() = -1;
  1596. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().usps_skin);
  1597. *Weap->FallbackSeed() = 0;
  1598. *Weap->OwnerXuidLow() = 0;
  1599. *Weap->OwnerXuidHigh() = 0;
  1600. *Weap->FallbackWear() = 0.00000000001;
  1601. }
  1602. break;
  1603. case ItemDefinitionIndex::WEAPON_MP5SD:
  1604. {
  1605. Weap->GetItemIDHigh() = -1;
  1606. *Weap->GetFallbackPaintKit() = getSkin(c_config::get().mp5sd_skin);
  1607. *Weap->FallbackSeed() = 0;
  1608. *Weap->OwnerXuidLow() = 0;
  1609. *Weap->OwnerXuidHigh() = 0;
  1610. *Weap->FallbackWear() = 0.00000000001;
  1611. }
  1612. break;
  1613. }
  1614.  
  1615. }
  1616. }
  1617. }
  1618. struct hud_weapons_t {
  1619. std::int32_t* get_weapon_count() {
  1620. return reinterpret_cast<std::int32_t*>(std::uintptr_t(this) + 0x80);
  1621. }
  1622. };
  1623. template<class T>
  1624. static T* FindHudElement(const char* name)
  1625. {
  1626. static auto pThis = *reinterpret_cast<DWORD**>(Utils::FindSignature("client_panorama.dll", "B9 ? ? ? ? E8 ? ? ? ? 8B 5D 08") + 1);
  1627.  
  1628. static auto find_hud_element = reinterpret_cast<DWORD(__thiscall*)(void*, const char*)>(Utils::FindSignature("client_panorama.dll", "55 8B EC 53 8B 5D 08 56 57 8B F9 33 F6 39"));
  1629. return (T*)find_hud_element(pThis, name);
  1630. }
  1631. void clearRefCountedVector(CUtlVector<IRefCounted*>& vec)
  1632. {
  1633. for (auto &elem : vec)
  1634. {
  1635. if (elem)
  1636. {
  1637. elem->unreference();
  1638. elem = nullptr;
  1639. }
  1640. }
  1641. vec.RemoveAll();
  1642. }
  1643.  
  1644.  
  1645. void ForceItemUpdate(C_WeaponCSBase *item)
  1646. {
  1647. if (!item)
  1648. return;
  1649.  
  1650. C_EconItemView &view = item->m_AttributeManager.m_Item;
  1651.  
  1652. item->m_bCustomMaterialInitialized = (reinterpret_cast<C_BaseCombatWeapon*>(item)->FallbackPaintKit() <= 0);
  1653.  
  1654. item->m_CustomMaterials.RemoveAll(); // clear vector, but don't unreference items
  1655. view.m_CustomMaterials.RemoveAll();
  1656. clearRefCountedVector(view.m_VisualsDataProcessors); // prevent memory leak
  1657.  
  1658. item->PostDataUpdate(0);
  1659. item->OnDataChanged(0);
  1660. }
  1661.  
  1662.  
  1663. void ForceItemUpdates()
  1664. {
  1665. auto local = Globals::LocalPlayer;
  1666. if (local)
  1667. {
  1668. auto weapons = local->m_hMyWeapons();
  1669.  
  1670. for (size_t i = 0; weapons[i].IsValid(); i++)
  1671. {
  1672. //auto weapon = weapons[i].Get();
  1673.  
  1674. //ForceItemUpdate(reinterpret_cast<C_WeaponCSBase*>(weapon));
  1675. }
  1676. }
  1677. }
  1678. typedef void(*CL_FullUpdate_t) (void);
  1679. CL_FullUpdate_t CL_FullUpdate = nullptr;
  1680.  
  1681. std::uint8_t* pattern_scan(void* module, const char* signature) {
  1682. static auto pattern_to_byte = [](const char* pattern) {
  1683. auto bytes = std::vector<int>{};
  1684. auto start = const_cast<char*>(pattern);
  1685. auto end = const_cast<char*>(pattern) + strlen(pattern);
  1686.  
  1687. for (auto current = start; current < end; ++current) {
  1688. if (*current == '?') {
  1689. ++current;
  1690. if (*current == '?')
  1691. ++current;
  1692. bytes.push_back(-1);
  1693. }
  1694. else {
  1695. bytes.push_back(strtoul(current, &current, 16));
  1696. }
  1697. }
  1698. return bytes;
  1699. };
  1700.  
  1701. auto dos_headers = (PIMAGE_DOS_HEADER)module;
  1702. auto nt_headers = (PIMAGE_NT_HEADERS)((std::uint8_t*)module + dos_headers->e_lfanew);
  1703.  
  1704. auto size_of_image = nt_headers->OptionalHeader.SizeOfImage;
  1705. auto pattern_bytes = pattern_to_byte(signature);
  1706. auto scan_bytes = reinterpret_cast<std::uint8_t*>(module);
  1707.  
  1708. auto s = pattern_bytes.size();
  1709. auto d = pattern_bytes.data();
  1710.  
  1711. for (auto i = 0ul; i < size_of_image - s; ++i) {
  1712. bool found = true;
  1713. for (auto j = 0ul; j < s; ++j) {
  1714. if (scan_bytes[i + j] != d[j] && d[j] != -1) {
  1715. found = false;
  1716. break;
  1717. }
  1718. }
  1719. if (found) {
  1720. return &scan_bytes[i];
  1721. }
  1722. }
  1723. return nullptr;
  1724. }
  1725.  
  1726. template<class T>
  1727. static T* find_hud_element(const char* name) {
  1728. static auto fn = *reinterpret_cast<DWORD**>(pattern_scan(GetModuleHandleA("client_panorama.dll"), ("B9 ? ? ? ? E8 ? ? ? ? 8B 5D 08")) + 1);
  1729.  
  1730. static auto find_hud_element = reinterpret_cast<DWORD(__thiscall*)(void*, const char*)>(pattern_scan(GetModuleHandleA("client_panorama.dll"), ("55 8B EC 53 8B 5D 08 56 57 8B F9 33 F6 39 77 28")));
  1731. return (T*)find_hud_element(fn, name);
  1732. }
  1733.  
  1734. void KnifeApplyCallbk()
  1735. {
  1736. static auto fn = reinterpret_cast<std::int32_t(__thiscall*)(void*, std::int32_t)>(pattern_scan(GetModuleHandleA("client_panorama.dll"), ("55 8B EC 51 53 56 8B 75 08 8B D9 57 6B FE 2C")));
  1737.  
  1738. auto element = find_hud_element<std::uintptr_t*>(("CCSGO_HudWeaponSelection"));
  1739.  
  1740. auto hud_weapons = reinterpret_cast<hud_weapons_t*>(std::uintptr_t(element) - 0xA0);
  1741. if (hud_weapons == nullptr)
  1742. return;
  1743.  
  1744. if (!*hud_weapons->get_weapon_count())
  1745. return;
  1746.  
  1747. for (std::int32_t i = 0; i < *hud_weapons->get_weapon_count(); i++)
  1748. i = fn(hud_weapons, i);
  1749.  
  1750. static auto CL_FullUpdate = reinterpret_cast<CL_FullUpdate_t>(Utils::FindPattern("engine.dll", reinterpret_cast<PBYTE>("\xA1\x00\x00\x00\x00\xB9\x00\x00\x00\x00\x56\xFF\x50\x14\x8B\x34\x85"), "x????x????xxxxxxx"));
  1751. CL_FullUpdate();
  1752. }
  1753.  
  1754. void __stdcall Hooks::FrameStageNotify(ClientFrameStage_t curStage)
  1755. {
  1756. static auto oFrameStage = g_Hooks.pClientHook->GetOriginal<FrameStageNotify_t>(vtable_indexes::frameStage);
  1757.  
  1758. g_Misc.Thirdperson_FSN(curStage);
  1759.  
  1760. g_Resolver.FrameStage(curStage);
  1761.  
  1762. g_Misc.NightMode();
  1763.  
  1764. g_Misc.AsusProps();
  1765.  
  1766.  
  1767. static int stored_shit = 0;
  1768. static int stored_skin_knife_shot = 0;
  1769. static int stored_ssg_shit = 0;
  1770. static int stored_scar20_shit = 0;
  1771. static int stored_g3sg1_shit = 0;
  1772. static int stored_ak47_shit = 0;
  1773. static int stored_cz75_shit = 0;
  1774. static int stored_m4a1_shit = 0;
  1775. static int stored_m4a1s_shit = 0;
  1776. static int stored_deagle_shit = 0;
  1777. static int stored_revolver_shit = 0;
  1778. if (stored_shit != c_config::get().knife_model || stored_skin_knife_shot != c_config::get().knife_skin || stored_ssg_shit != c_config::get().ssg08_skin || stored_scar20_shit != c_config::get().scar20_skin || stored_g3sg1_shit != c_config::get().g3sg1_skin || stored_ak47_shit != c_config::get().ak47_skin || stored_cz75_shit != c_config::get().cz75_skin || stored_deagle_shit != c_config::get().deagle_skin || stored_revolver_shit != c_config::get().r8_skin | stored_m4a1_shit != c_config::get().m4a4_skin | stored_m4a1s_shit != c_config::get().m4a1_s_skin) {
  1779. if (g_pEngine->IsInGame() && g_pEngine->IsConnected() && Globals::LocalPlayer && Globals::LocalPlayer->IsAlive() && Globals::LocalPlayer->GetActiveWeapon())
  1780. {
  1781. KnifeApplyCallbk();
  1782. SetShit = true;
  1783. }
  1784. stored_shit = c_config::get().knife_model;
  1785. stored_skin_knife_shot = c_config::get().knife_skin;
  1786. stored_ssg_shit = c_config::get().ssg08_skin;
  1787. stored_scar20_shit = c_config::get().scar20_skin;
  1788. stored_g3sg1_shit = c_config::get().g3sg1_skin;
  1789. stored_ak47_shit = c_config::get().ak47_skin;
  1790. stored_deagle_shit = c_config::get().deagle_skin;
  1791. stored_revolver_shit = c_config::get().r8_skin;
  1792. stored_m4a1_shit = c_config::get().m4a4_skin;
  1793. stored_m4a1s_shit = c_config::get().m4a1_s_skin;
  1794. stored_cz75_shit = c_config::get().cz75_skin;
  1795. }
  1796. if (curStage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
  1797. {
  1798. NewSkinChanger();
  1799.  
  1800. if (Globals::LocalPlayer && Globals::LocalPlayer->IsAlive()) {
  1801. backtracking->Update(g_pGlobalVars->tickcount);
  1802. }
  1803. }
  1804.  
  1805. oFrameStage(curStage);
  1806.  
  1807. }
  1808. #define LOAD_FROM_BUFFER "test"
  1809.  
  1810. void DesyncPercentageColor(float Percentage, Color& Color)
  1811. {
  1812. Percentage = max(0, min(Percentage, 58));
  1813.  
  1814. Color.red = min((510 * (58 - Percentage)) / 58, 255);
  1815. Color.green = min((510 * Percentage) / 58, 255);
  1816. Color.blue = 0;
  1817. Color.alpha = 255;
  1818. }
  1819.  
  1820. #include <Windows.h>
  1821. #include <Psapi.h>
  1822. #include <lmcons.h>
  1823. #include <iostream>
  1824. #include <algorithm>
  1825. #include <string>
  1826. #include <vector>
  1827. #include <shlobj.h>
  1828. #include <time.h>
  1829. #include <random>
  1830. #include <sstream>
  1831. #include <fstream>
  1832. #include <shlwapi.h>
  1833. #include <iomanip>
  1834. #include <ctime>
  1835. #include <cstdint>
  1836.  
  1837. bool WorldToScreen223(const Vector& world, Vector& screen) {
  1838. auto screen_transform = [&world, &screen]() -> bool {
  1839. static auto &matrix = g_pEngine->WorldToScreenMatrix();
  1840.  
  1841. screen.x = matrix[0][0] * world.x + matrix[0][1] * world.y + matrix[0][2] * world.z + matrix[0][3];
  1842. screen.y = matrix[1][0] * world.x + matrix[1][1] * world.y + matrix[1][2] * world.z + matrix[1][3];
  1843. screen.z = 0.0f;
  1844.  
  1845. float w = matrix[3][0] * world.x + matrix[3][1] * world.y + matrix[3][2] * world.z + matrix[3][3];
  1846.  
  1847. if (w < 0.001f) {
  1848. screen.x *= 100000;
  1849. screen.y *= 100000;
  1850. return false;
  1851. }
  1852.  
  1853. screen.x /= w;
  1854. screen.y /= w;
  1855.  
  1856. return true;
  1857. };
  1858.  
  1859. if (screen_transform()) {
  1860. int w, h;
  1861. g_pEngine->GetScreenSize(w, h);
  1862.  
  1863. screen.x = (w / 2.0f) + (screen.x * w) / 2.0f;
  1864. screen.y = (h / 2.0f) - (screen.y * h) / 2.0f;
  1865.  
  1866. return true;
  1867. }
  1868.  
  1869. return false;
  1870. }
  1871.  
  1872. void C_BaseEntity::OriginAbs(Vector origin)
  1873. {
  1874. using Fn = void(__thiscall*)(void*, const Vector & origin);
  1875. static Fn AbsOrigin = (Fn)Utils::FindSignature("client_panorama.dll", "55 8B EC 83 E4 F8 51 53 56 57 8B F1 E8");
  1876.  
  1877. AbsOrigin(this, origin);
  1878. }
  1879. void C_BaseEntity::SetAngles2(Vector angles)
  1880. {
  1881. using Fn = void(__thiscall*)(C_BaseEntity*, const Vector & angles);
  1882. static Fn AbsAngles = (Fn)(Utils::FindPattern("client_panorama.dll", (BYTE*)"\x55\x8B\xEC\x83\xE4\xF8\x83\xEC\x64\x53\x56\x57\x8B\xF1\xE8", "xxxxxxxxxxxxxxx"));
  1883.  
  1884. AbsAngles(this, angles);
  1885. }
  1886.  
  1887. void DrawTaserRange()
  1888. {
  1889. Vector prev_scr_pos;
  1890. Vector scr_pos;
  1891. C_BaseCombatWeapon *local_weapon = Globals::LocalPlayer->GetActiveWeapon();
  1892. if (!local_weapon || local_weapon->GetItemDefinitionIndex() != ItemDefinitionIndex::WEAPON_TASER)
  1893. return;
  1894.  
  1895. float step = M_PI * 2.0 / 2047; //adjust if you need 1-5 extra fps lol
  1896. float rad = local_weapon->GetCSWpnData()->range;
  1897. Vector origin = Globals::LocalPlayer->GetEyePosition();
  1898. static float hue_offset = 0;
  1899. for (float rotation = 0; rotation < (M_PI * 2.0); rotation += step)
  1900. {
  1901. Vector pos(rad * cos(rotation) + origin.x, rad * sin(rotation) + origin.y, origin.z);
  1902.  
  1903. ray_t ray;
  1904. trace_t trace;
  1905. trace_filter filter;
  1906.  
  1907. filter.skip = Globals::LocalPlayer;
  1908. ray.initialize(origin, pos);
  1909.  
  1910. g_pTraceV2->trace_ray(ray, mask_shot_brushonly, &filter, &trace);
  1911.  
  1912. if (Utils::WorldToScreen2(trace.end, scr_pos))
  1913. {
  1914. if (prev_scr_pos.IsValidV2())
  1915. {
  1916. int hue = RAD2DEG(rotation) + hue_offset;
  1917. Color color = Color(255, 255, 255, 255);
  1918.  
  1919. g_pSurface->Line(prev_scr_pos.x, prev_scr_pos.y, scr_pos.x, scr_pos.y, Color(255, 0, 0, 255));
  1920. }
  1921. prev_scr_pos = scr_pos;
  1922. }
  1923. }
  1924. hue_offset += 0.25;
  1925. }
  1926. bool ExplectedWorldToScreanv2(Vector vOrigin, Vector &vScreen)
  1927. {
  1928. float w = Globals::w2s_matrix[3][0] * vOrigin.x + Globals::w2s_matrix[3][1] * vOrigin.y + Globals::w2s_matrix[3][2] * vOrigin.z + Globals::w2s_matrix[3][3];
  1929. int x, y;
  1930. g_pEngine->GetScreenSize(x, y);
  1931. float ScreenWidth = (float)x;
  1932. float ScreenHeight = (float)y;
  1933.  
  1934. if (w > 0.01f)
  1935. {
  1936. float inverseWidth = 1.f / w;
  1937. vScreen.x = (float)((ScreenWidth / 2) + (0.5 * ((Globals::w2s_matrix[0][0] * vOrigin.x + Globals::w2s_matrix[0][1] * vOrigin.y + Globals::w2s_matrix[0][2] * vOrigin.z + Globals::w2s_matrix[0][3]) * inverseWidth) * ScreenWidth + 0.5));
  1938. vScreen.y = (float)((ScreenHeight / 2) - (0.5 * ((Globals::w2s_matrix[1][0] * vOrigin.x + Globals::w2s_matrix[1][1] * vOrigin.y + Globals::w2s_matrix[1][2] * vOrigin.z + Globals::w2s_matrix[1][3]) * inverseWidth) * ScreenHeight + 0.5));
  1939. return true;
  1940. }
  1941.  
  1942. return false;
  1943. }
  1944. void DrawLinev2(int x1, int y1, int x2, int y2, Color color)
  1945. {
  1946. g_pSurface->DrawSetColor(color);
  1947. g_pSurface->Line(x1, y1, x2, y2, color);
  1948. }
  1949. void DrawFilled3DBox(Vector origin, int width, int height, Color col)
  1950. {
  1951. float difw = float(width / 2);
  1952. float difh = float(height / 2);
  1953. Vector boxVectors[8] =
  1954. {
  1955. Vector(origin.x - difw, origin.y - difh, origin.z - difw),
  1956. Vector(origin.x - difw, origin.y - difh, origin.z + difw),
  1957. Vector(origin.x + difw, origin.y - difh, origin.z + difw),
  1958. Vector(origin.x + difw, origin.y - difh, origin.z - difw),
  1959. Vector(origin.x - difw, origin.y + difh, origin.z - difw),
  1960. Vector(origin.x - difw, origin.y + difh, origin.z + difw),
  1961. Vector(origin.x + difw, origin.y + difh, origin.z + difw),
  1962. Vector(origin.x + difw, origin.y + difh, origin.z - difw),
  1963. };
  1964.  
  1965. static Vector vec0, vec1, vec2, vec3,
  1966. vec4, vec5, vec6, vec7;
  1967.  
  1968. if (ExplectedWorldToScreanv2(boxVectors[0], vec0) &&
  1969. ExplectedWorldToScreanv2(boxVectors[1], vec1) &&
  1970. ExplectedWorldToScreanv2(boxVectors[2], vec2) &&
  1971. ExplectedWorldToScreanv2(boxVectors[3], vec3) &&
  1972. ExplectedWorldToScreanv2(boxVectors[4], vec4) &&
  1973. ExplectedWorldToScreanv2(boxVectors[5], vec5) &&
  1974. ExplectedWorldToScreanv2(boxVectors[6], vec6) &&
  1975. ExplectedWorldToScreanv2(boxVectors[7], vec7))
  1976. {
  1977. Vector lines[12][2];
  1978. lines[0][0] = vec0;
  1979. lines[0][1] = vec1;
  1980. lines[1][0] = vec1;
  1981. lines[1][1] = vec2;
  1982. lines[2][0] = vec2;
  1983. lines[2][1] = vec3;
  1984. lines[3][0] = vec3;
  1985. lines[3][1] = vec0;
  1986.  
  1987. // top of box
  1988. lines[4][0] = vec4;
  1989. lines[4][1] = vec5;
  1990. lines[5][0] = vec5;
  1991. lines[5][1] = vec6;
  1992. lines[6][0] = vec6;
  1993. lines[6][1] = vec7;
  1994. lines[7][0] = vec7;
  1995. lines[7][1] = vec4;
  1996.  
  1997. lines[8][0] = vec0;
  1998. lines[8][1] = vec4;
  1999.  
  2000. lines[9][0] = vec1;
  2001. lines[9][1] = vec5;
  2002.  
  2003. lines[10][0] = vec2;
  2004. lines[10][1] = vec6;
  2005.  
  2006. lines[11][0] = vec3;
  2007. lines[11][1] = vec7;
  2008.  
  2009. for (int i = 0; i < 12; i++)
  2010. DrawLinev2(lines[i][0].x, lines[i][0].y, lines[i][1].x, lines[i][1].y, col);
  2011. }
  2012. }
  2013. void draw_gay_circle(Color* p, size_t resolution, float alpha_power = 1.f)
  2014. {
  2015. const auto max_radius = resolution / 2;
  2016. const auto max_relative_alpha = pow(max_radius, alpha_power);
  2017. for (auto i = 0; i < resolution; ++i)
  2018. for (auto j = 0; j < resolution; ++j)
  2019. {
  2020. const auto cy = i - max_radius;
  2021. const auto cx = j - max_radius;
  2022. const auto radius = std::sqrt(cx * cx + cy * cy);
  2023. p[i * resolution + j] = {
  2024. 0x00u,
  2025. 0x00u,
  2026. 0x00u,
  2027. radius > max_radius
  2028. ? 0x00u
  2029. : uint8_t(pow(radius, alpha_power) / max_relative_alpha * 0xFF)
  2030. };
  2031. }
  2032. }
  2033.  
  2034. void __fastcall Hooks::PaintTraverse(PVOID pPanels, int edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce)
  2035. {
  2036. static auto oPaintTraverse = g_Hooks.pPanelHook->GetOriginal<PaintTraverse_t>(vtable_indexes::paint);
  2037. static unsigned int panelID = 0;
  2038. if (c_config::get().remove_scope && c_config::get().visuals_enabled && !strcmp("HudZoom", g_pPanel->GetName(vguiPanel)))
  2039. return;
  2040. oPaintTraverse(pPanels, vguiPanel, forceRepaint, allowForce);
  2041.  
  2042. if (!panelID)
  2043. {
  2044. const auto panelName = g_pPanel->GetName(vguiPanel);
  2045. if (strstr(panelName, "MatSystemTopPanel"))
  2046. panelID = vguiPanel;
  2047. g_Hooks.bInitializedDrawManager = true;
  2048. }
  2049.  
  2050.  
  2051. if (panelID == vguiPanel)
  2052. {
  2053. if (c_config::get().visuals_enabled) {
  2054. c_visuals::get().draw_scope();
  2055. c_visuals::get().DrawPlayers();
  2056. c_event_logs::get().run();
  2057. //LogEvents::Draw();
  2058. }
  2059.  
  2060. g_Misc.SwapManual();
  2061.  
  2062. for (int i = 0; i < 4; i++) {
  2063. for (int j = 0; j < 4; j++)
  2064. {
  2065. Globals::w2s_matrix[i][j] = g_pEngine->WorldToScreenMatrix()[i][j];
  2066. }
  2067. }
  2068.  
  2069. if (c_config::get().grenade_prediction) {
  2070. GrenadePrediction::get().Paint();
  2071. }
  2072.  
  2073.  
  2074. int screenSizeX, screenCenterX;
  2075. int screenSizeY, screenCenterY;
  2076. auto lineSize = 8;
  2077. g_pEngine->GetScreenSize(screenSizeX, screenSizeY);
  2078.  
  2079. //std::array< vec2_t, 3 >points{ vec2_t(screenSizeX / 2 - 16, screenSizeY / 2 - 16),
  2080. //vec2_t(screenSizeX / 2 + 16, screenSizeY / 2),
  2081. //vec2_t(screenSizeX / 2 - 16, screenSizeY / 2 + 16) };
  2082.  
  2083.  
  2084. screenCenterX = screenSizeX / 2;
  2085. screenCenterY = screenSizeY / 2;
  2086.  
  2087.  
  2088. if (Hitmarkertime > 0) {
  2089.  
  2090.  
  2091.  
  2092.  
  2093. Hitmarkertime = max(Hitmarkertime - 2, 0);
  2094.  
  2095. g_pSurface->Line(screenCenterX + 6, screenCenterY + 6, screenCenterX + 3, screenCenterY + 3, Color::White(Hitmarkertime));// Bottom right to center
  2096. g_pSurface->Line(screenCenterX - 6, screenCenterY + 6, screenCenterX - 3, screenCenterY + 3, Color::White(Hitmarkertime));//Bottom left to center
  2097. g_pSurface->Line(screenCenterX + 6, screenCenterY - 6, screenCenterX + 3, screenCenterY - 3, Color::White(Hitmarkertime));//Top right to center
  2098. g_pSurface->Line(screenCenterX - 6, screenCenterY - 6, screenCenterX - 3, screenCenterY - 3, Color::White(Hitmarkertime));//Top left to center
  2099. }
  2100. Vector ViewAngs;
  2101.  
  2102. //g_nadepred.draw();
  2103. if (g_pEngine->IsConnected() && g_pEngine->IsInGame()) {
  2104.  
  2105. if (Globals::LocalPlayer && Globals::LocalPlayer->IsAlive()) {
  2106. ///DrawTaserRange();
  2107. float Damage;
  2108.  
  2109. if (!Globals::LocalPlayer->GetActiveWeapon())
  2110. return;
  2111.  
  2112. Vector angles; g_pEngine->WorldToViewMatrix();
  2113.  
  2114. int mode = 0;
  2115. if (c_config::get().penetration_crosshair && !Globals::LocalPlayer->IsKnifeorNade()) {
  2116. if (g_Autowall.CanWallbang(Damage)) {
  2117. if (mode == 2) {
  2118.  
  2119. //DrawFilled3DBox(angles, 5, 5, Color(0, 255, 0, 255));
  2120. }
  2121. else {
  2122. g_pSurface->DrawOctagonCoalBox(screenCenterX - 2, screenCenterY - 2, 5, 5, Color::Green());//Circle
  2123. }
  2124. }
  2125. else {
  2126. if (mode == 2) {
  2127. DrawFilled3DBox(angles, 10, 10, Color(255, 0, 0, 255));
  2128. }
  2129. else {
  2130. g_pSurface->DrawOctagonCoalBox(screenCenterX - 2, screenCenterY - 2, 5, 5, Color::Red());
  2131. }
  2132. }
  2133. }
  2134. if (c_config::get().penetration_crosshair3d && !Globals::LocalPlayer->IsKnifeorNade()) {
  2135. if (g_Autowall.CanWallbang(Damage)) {
  2136. if (mode == 2) {
  2137. DrawFilled3DBox(angles, 10, 10, Color(0, 255, 0, 255));
  2138. //DrawFilled3DBox(angles, 5, 5, Color(0, 255, 0, 255));
  2139. }
  2140. else {
  2141. DrawFilled3DBox(angles, 10, 10, Color(0, 255, 0, 255));
  2142. }
  2143. }
  2144. else {
  2145. if (mode == 2) {
  2146. DrawFilled3DBox(angles, 10, 10, Color(255, 0, 0, 255));
  2147. }
  2148. else {
  2149. DrawFilled3DBox(angles, 10, 10, Color(255, 0, 0, 255));
  2150. }
  2151. }
  2152. }
  2153. }
  2154. }
  2155.  
  2156.  
  2157.  
  2158.  
  2159. //g_pSurface->FilledRect(screenCenterX - 1, screenCenterY - 1, 4, 4, Color(0, 0, 0, 185));
  2160. //g_pSurface->DrawT(30, 30, Color(255, 255, 255), 5, false, std::to_string(Globals::Manual_Side).c_str());
  2161. //g_pSurface->Line(screenCenterX, screenCenterY, screenCenterX + 4, screenCenterY, Color(255, 0, 0, 255));
  2162. //g_pSurface->Line(screenCenterX + 2, screenCenterY - 1, screenCenterX + 2, screenCenterY + 3, Color(255, 0, 0, 255));
  2163. //g_pSurface->Line(screenCenterX - 1 + 2, screenCenterY - 1 - 1, screenCenterX - 1 + 2, screenCenterY - 1 + 2, Color(255, 0, 0, 255));
  2164. if (Globals::LocalPlayer) {
  2165. if (Globals::LocalPlayer->IsAlive()) {
  2166.  
  2167. if (!Globals::LocalPlayer->AnimState())
  2168. return;
  2169.  
  2170. if (c_config::get().remove_flash)
  2171. * Globals::LocalPlayer->m_flFlashMaxAlpha() = 0;
  2172. }
  2173. }
  2174.  
  2175. g_Menu.Render();
  2176. }
  2177.  
  2178. }
  2179. template<class T2>
  2180. static T2* FindHudElement2(const char* name)
  2181. {
  2182. static auto pThis = *reinterpret_cast<DWORD**>(Utils::FindSignature("client_panorama.dll", "B9 ? ? ? ? E8 ? ? ? ? 8B 5D 08") + 1);
  2183.  
  2184. static auto find_hud_element = reinterpret_cast<DWORD(__thiscall*)(void*, const char*)>(Utils::FindSignature("client_panorama.dll", "55 8B EC 53 8B 5D 08 56 57 8B F9 33 F6 39 77 28"));
  2185. return (T2*)find_hud_element(pThis, name);
  2186. }
  2187.  
  2188. void doTracers(Vector start, Vector end, Color color) {
  2189. switch (c_config::get().bullet_tracer_style)
  2190. {
  2191. case 0:
  2192. {
  2193. BeamInfo_t beamInfo;
  2194. beamInfo.m_nType = TE_BEAMPOINTS;
  2195. beamInfo.m_pszModelName = "sprites/physbeam.vmt";
  2196. beamInfo.m_nModelIndex = -1; // will be set by CreateBeamPoints if its -1
  2197. beamInfo.m_flHaloScale = 0.0f;
  2198. beamInfo.m_flLife = c_config::get().bullet_tracer_life;
  2199. beamInfo.m_flWidth = 2.0f;
  2200. beamInfo.m_flEndWidth = 2.0f;
  2201. beamInfo.m_flFadeLength = 0.0f;
  2202. beamInfo.m_flAmplitude = 0.0f;
  2203. beamInfo.m_flBrightness = color.alpha;
  2204. beamInfo.m_flSpeed = 1.0f;
  2205. beamInfo.m_nStartFrame = 0;
  2206. beamInfo.m_flFrameRate = 0.f;
  2207. beamInfo.m_flRed = color.red;
  2208. beamInfo.m_flGreen = color.green;
  2209. beamInfo.m_flBlue = color.blue;
  2210. beamInfo.m_nSegments = 15;
  2211. beamInfo.m_bRenderable = true;
  2212. beamInfo.m_nFlags = 0;
  2213.  
  2214. beamInfo.m_vecStart = end;
  2215.  
  2216. beamInfo.m_vecEnd = start;
  2217.  
  2218. Beam_t* myBeam = g_pRenderBeams->CreateBeamPoints(beamInfo);
  2219.  
  2220. if (myBeam)
  2221. g_pRenderBeams->DrawBeam(myBeam); //renderBeam func
  2222. }
  2223. case 1:
  2224. {
  2225. BeamInfo_t beamInfo;
  2226. beamInfo.m_nType = TE_BEAMPOINTS;
  2227. beamInfo.m_pszModelName = "sprites/purplelaser1.vmt";
  2228. beamInfo.m_nModelIndex = -1;
  2229. beamInfo.m_flHaloScale = 0.0f;
  2230. beamInfo.m_flLife = c_config::get().bullet_tracer_life;
  2231. beamInfo.m_flWidth = 2.0f;
  2232. beamInfo.m_flEndWidth = 2.0f;
  2233. beamInfo.m_flFadeLength = 0.0f;
  2234. beamInfo.m_flAmplitude = 0.0f;
  2235. beamInfo.m_flBrightness = color.alpha;
  2236. beamInfo.m_flSpeed = 1.0f;
  2237. beamInfo.m_nStartFrame = 0;
  2238. beamInfo.m_flFrameRate = 0.f;
  2239. beamInfo.m_flRed = color.red;
  2240. beamInfo.m_flGreen = color.green;
  2241. beamInfo.m_flBlue = color.blue;
  2242. beamInfo.m_nSegments = 15;
  2243. beamInfo.m_bRenderable = true;
  2244. beamInfo.m_nFlags = 0;
  2245.  
  2246. beamInfo.m_vecStart = end;
  2247.  
  2248. beamInfo.m_vecEnd = start;
  2249.  
  2250. Beam_t* myBeam = g_pRenderBeams->CreateBeamPoints(beamInfo);
  2251.  
  2252. if (myBeam)
  2253. g_pRenderBeams->DrawBeam(myBeam); //renderBeam func
  2254. }
  2255. }
  2256. };
  2257. void Event::FireGameEvent(IGameEvent* event)
  2258. {
  2259. if (!event)
  2260. return;
  2261.  
  2262. if (!Globals::LocalPlayer)
  2263. return;
  2264.  
  2265. //LogEvents::FireGameEvent(event);
  2266. auto name = event->GetName();
  2267. if (!strcmp(name, "player_hurt")) {
  2268. c_event_logs::get().event_player_hurt(event);
  2269. auto attacker = g_pEntityList->GetClientEntity(g_pEngine->GetPlayerForUserID(event->GetInt("attacker")));
  2270. if (!attacker)
  2271. return;
  2272.  
  2273. if (attacker != Globals::LocalPlayer)
  2274. return;
  2275.  
  2276. int index = g_pEngine->GetPlayerForUserID(event->GetInt("userid"));
  2277. int hitgroup = event->GetInt("hitgroup");
  2278.  
  2279. PlayerInfo_t pInfo;
  2280. g_pEngine->GetPlayerInfo(index, &pInfo);
  2281.  
  2282. Globals::Hit[index] = true;
  2283.  
  2284. if (c_config::get().hitmarker) {
  2285.  
  2286. //if (hitgroup == 1) {
  2287. // g_pEngine->ExecuteClientCmd("play commander\\train_bodydamageheadshot_01b");
  2288. //}
  2289. //else {
  2290. switch (c_config::get().hitmarker_sound) {
  2291. case 1: g_pSurface->PlaySoundA("buttons\\arena_switch_press_02.wav"); break;
  2292. case 2: g_pSurface->PlaySoundA("hitmarker.wav"); break;
  2293. }
  2294.  
  2295. //}
  2296.  
  2297.  
  2298. Hitmarkertime = 255;
  2299. HitmarkerExpansion = 30 * 3;
  2300. }
  2301. }
  2302. else if (!strcmp(name, "player_death")) {
  2303. c_event_logs::get().event_player_death(event);
  2304. if (!g_pEngine->IsConnected() || !g_pEngine->IsConnected())
  2305. return;
  2306.  
  2307. if (!Globals::LocalPlayer)
  2308. return;
  2309.  
  2310. auto attacker = g_pEntityList->GetClientEntity(g_pEngine->GetPlayerForUserID(event->GetInt("attacker")));
  2311. if (!attacker)
  2312. return;
  2313.  
  2314. if (attacker != Globals::LocalPlayer)
  2315. return;
  2316.  
  2317. int index = g_pEngine->GetPlayerForUserID(event->GetInt("userid"));
  2318.  
  2319. if (!index)
  2320. return;
  2321.  
  2322. static DWORD* deathNotice = FindHudElement2<DWORD>("CCSGO_HudDeathNotice");
  2323.  
  2324. static DWORD* _death_notice = FindHudElement2<DWORD>("CCSGO_HudDeathNotice");
  2325. static void(__thiscall *_clear_notices)(DWORD) = (void(__thiscall*)(DWORD))Utils::FindSignature("client_panorama.dll", "55 8B EC 83 EC 0C 53 56 8B 71 58");
  2326.  
  2327.  
  2328. if (_death_notice)
  2329. *(float*)((DWORD)_death_notice + 0x50) = c_config::get().visual_preserve_killfeed ? 500 : 1.5;
  2330.  
  2331. g_pEngine->ClientCmd("REVENENCE.PUB");
  2332. }
  2333. else if (strstr(event->GetName(), "round_start"))
  2334. {
  2335. if (!g_pEngine->IsConnected() || !g_pEngine->IsConnected())
  2336. return;
  2337.  
  2338. if (!Globals::LocalPlayer)
  2339. return;
  2340.  
  2341. static DWORD* deathNotice = FindHudElement2<DWORD>("CCSGO_HudDeathNotice");
  2342.  
  2343. static DWORD* _death_notice = FindHudElement2<DWORD>("CCSGO_HudDeathNotice");
  2344. static void(__thiscall *_clear_notices)(DWORD) = (void(__thiscall*)(DWORD))Utils::FindSignature("client_panorama.dll", "55 8B EC 83 EC 0C 53 56 8B 71 58");
  2345.  
  2346. _death_notice = FindHudElement2<DWORD>("CCSGO_HudDeathNotice");
  2347. _clear_notices(((DWORD)_death_notice - 20));
  2348. }
  2349. else if (strstr(event->GetName(), "item_purchase")) {
  2350. c_event_logs::get().event_item_purchase(event);
  2351. }
  2352. if (strstr(event->GetName(), "bullet_impact"))
  2353. {
  2354. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(g_pEngine->GetPlayerForUserID(event->GetInt("userid")));
  2355.  
  2356. if (c_config::get().visuals_bullet_tracers) {
  2357. if (g_pEngine->GetPlayerForUserID(event->GetInt("userid")) == g_pEngine->GetLocalPlayer())
  2358. {
  2359. Vector start(Globals::LocalPlayer->GetEyePosition() + Globals::LocalPlayer->GetViewOffset());
  2360. Vector end(event->GetInt("x"), event->GetInt("y"), event->GetInt("z"));
  2361. Color color;
  2362. color.alpha = c_config::get().bullet_tracers_color_a;
  2363. color.red = c_config::get().bullet_tracers_color_r;
  2364. color.blue = c_config::get().bullet_tracers_color_b;
  2365. color.green = c_config::get().bullet_tracers_color_g;
  2366. doTracers(start, end, color);
  2367. }
  2368. }
  2369. if (c_config::get().visuals_bullet_tracers && c_config::get().visuals_enemy_bullet_tracers)
  2370. {
  2371. if (pPlayerEntity->GetTeam() != Globals::LocalPlayer->GetTeam())
  2372. {
  2373. auto index = g_pEngine->GetPlayerForUserID(event->GetInt("userid"));
  2374. auto player = g_pEntityList->GetClientEntity(index);
  2375. Vector start(player->GetEyePosition() + player->GetViewOffset());
  2376. Vector end(event->GetInt("x"), event->GetInt("y"), event->GetInt("z"));
  2377. Color color;
  2378. color.alpha = c_config::get().bullet_enemy_tracers_color_a;
  2379. color.red = c_config::get().bullet_enemy_tracers_color_r;
  2380. color.blue = c_config::get().bullet_enemy_tracers_color_b;
  2381. color.green = c_config::get().bullet_enemy_tracers_color_g;
  2382. doTracers(start, end, color);
  2383. }
  2384. }
  2385. if (c_config::get().visuals_bullet_tracers && c_config::get().visuals_team_bullet_tracers)
  2386. {
  2387. if (pPlayerEntity->GetTeam() == Globals::LocalPlayer->GetTeam())
  2388. {
  2389. auto index = g_pEngine->GetPlayerForUserID(event->GetInt("userid"));
  2390. auto player = g_pEntityList->GetClientEntity(index);
  2391. Vector start(player->GetEyePosition() + player->GetViewOffset());
  2392. Vector end(event->GetInt("x"), event->GetInt("y"), event->GetInt("z"));
  2393. Color color;
  2394. color.alpha = c_config::get().bullet_team_tracers_color_a;
  2395. color.red = c_config::get().bullet_team_tracers_color_r;
  2396. color.blue = c_config::get().bullet_team_tracers_color_b;
  2397. color.green = c_config::get().bullet_team_tracers_color_g;
  2398. doTracers(start, end, color);
  2399. }
  2400. }
  2401. }
  2402. };
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410. void GetViewModelFOV2(float& fov)
  2411. {
  2412.  
  2413. if (g_pEngine->IsConnected() && g_pEngine->IsInGame())
  2414. {
  2415.  
  2416. if (!Globals::LocalPlayer)
  2417. return;
  2418.  
  2419. if (c_config::get().viewmodel_fov != 0) {
  2420. fov = c_config::get().viewmodel_fov;
  2421. }
  2422. else {
  2423. fov = 68;
  2424. }
  2425.  
  2426. }
  2427. }
  2428.  
  2429. float __stdcall Hooks::GetViewmodelFOV()
  2430. {
  2431. float fov = g_Hooks.pClientModeHook->GetOriginal<oGetViewModelFOV>(35)();
  2432.  
  2433. GetViewModelFOV2(fov);
  2434.  
  2435. return fov;
  2436. }
  2437.  
  2438. void __fastcall Hooks::OverrideView(void* ecx, void* edx, CViewSetup* pSetup)
  2439. {
  2440. static auto oOverrideView = g_Hooks.pClientModeHook->GetOriginal<OverrideView_t>(vtable_indexes::view);
  2441.  
  2442. if (g_pEngine->IsConnected() && g_pEngine->IsInGame())
  2443. {
  2444. if (!Globals::LocalPlayer)
  2445. return;
  2446.  
  2447. if (!Globals::LocalPlayer->IsAlive())
  2448. return;
  2449.  
  2450. if (c_config::get().grenade_prediction) {
  2451. GrenadePrediction::get().View(pSetup);
  2452. }
  2453.  
  2454. g_Misc.ThirdPerson();
  2455.  
  2456. if (c_config::get().fov != 0 && !Globals::LocalPlayer->IsScoped())
  2457. pSetup->fov = c_config::get().fov;
  2458.  
  2459. if (Globals::LocalPlayer->IsScoped() && c_config::get().fov_while_zoomed) {
  2460. pSetup->fov = c_config::get().fov;
  2461. }
  2462. else if (Globals::LocalPlayer->IsScoped() && !c_config::get().fov_while_zoomed) {
  2463.  
  2464. int fov_to_subtract = 40;
  2465.  
  2466. if (c_config::get().fov < 40) {
  2467. fov_to_subtract = c_config::get().fov / 2;
  2468. }
  2469. pSetup->fov = c_config::get().fov - fov_to_subtract;
  2470. }
  2471.  
  2472.  
  2473. if (c_config::get().remove_visual_recoil)
  2474. {
  2475. Vector viewPunch = Globals::LocalPlayer->GetViewPunchAngle();
  2476. Vector aimPunch = Globals::LocalPlayer->GetAimPunchAngle();
  2477.  
  2478. pSetup->angles[0] -= (viewPunch[0] + (aimPunch[0] * 2 * 0.4499999f));
  2479. pSetup->angles[1] -= (viewPunch[1] + (aimPunch[1] * 2 * 0.4499999f));
  2480. pSetup->angles[2] -= (viewPunch[2] + (aimPunch[2] * 2 * 0.4499999f));
  2481. }
  2482.  
  2483. }
  2484.  
  2485. oOverrideView(ecx, edx, pSetup);
  2486. }
  2487.  
  2488. void __fastcall Hooks::LockCursor(ISurface* thisptr, void* edx)
  2489. {
  2490. static auto oLockCursor = g_Hooks.pSurfaceHook->GetOriginal<LockCursor_t>(vtable_indexes::lockCursor);
  2491.  
  2492. if (!g_Menu.menuOpened)
  2493. return oLockCursor(thisptr, edx);
  2494.  
  2495. g_pSurface->UnLockCursor();
  2496. }
  2497.  
  2498. LRESULT Hooks::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  2499. {
  2500. // for now as a lambda, to be transfered somewhere
  2501. // Thanks uc/WasserEsser for pointing out my mistake!
  2502. // Working when you HOLD th button, not when you press it.
  2503. const auto getButtonHeld = [uMsg, wParam](bool& bButton, int vKey)
  2504. {
  2505. if (wParam != vKey) return;
  2506.  
  2507. if (uMsg == WM_KEYDOWN)
  2508. bButton = true;
  2509. else if (uMsg == WM_KEYUP)
  2510. bButton = false;
  2511. };
  2512.  
  2513. const auto getButtonToggle = [uMsg, wParam](bool& bButton, int vKey)
  2514. {
  2515. if (wParam != vKey) return;
  2516.  
  2517. if (uMsg == WM_KEYUP)
  2518. bButton = !bButton;
  2519. };
  2520.  
  2521. if (g_Hooks.bInitializedDrawManager)
  2522. {
  2523. // our wndproc capture fn
  2524. if (g_Menu.menuOpened)
  2525. {
  2526. return true;
  2527. }
  2528. }
  2529.  
  2530. // Call original wndproc to make game use input again
  2531. return CallWindowProcA(g_Hooks.pOriginalWNDProc, hWnd, uMsg, wParam, lParam);
  2532. }
  2533. #include "Features/Aimbot/LagComp.h"
  2534. static auto linegoesthrusmoke = Utils::FindPattern("client_panorama.dll", (PBYTE)"\x55\x8B\xEC\x83\xEC\x08\x8B\x15\x00\x00\x00\x00\x0F\x57\xC0", "xxxxxxxx????xxx");
  2535.  
  2536. IMaterial *create_material(bool shade, bool wireframe, bool ignorez, int rimlight_boost = 0) {
  2537. static const std::string material_name = "game_material.vmt";
  2538. const std::string material_type = shade ? "VertexLitGeneric" : "UnlitGeneric";
  2539.  
  2540. std::string material_data;
  2541.  
  2542. material_data += "\"" + material_type + "\"\n{\n";
  2543. material_data += "\t\"$basetexture\" \"vgui/white_additive\"\n";
  2544. material_data += "\t\"$envmap\" \"\"\n";
  2545. material_data += "\t\"$model\" \"1\"\n";
  2546. material_data += "\t\"$flat\" \"1\"\n";
  2547. material_data += "\t\"$nocull\" \"0\"\n";
  2548. material_data += "\t\"$selfillum\" \"1\"\n";
  2549. material_data += "\t\"$halflambert\" \"1\"\n";
  2550. material_data += "\t\"$znearer\" \"0\"\n";
  2551. material_data += "\t\"$rimlightboost\" \"" + std::to_string(rimlight_boost) + "\"\n";
  2552. material_data += "\t\"$rimlightexponent\" \"" + std::to_string(4) + "\"\n";
  2553. material_data += "\t\"$ambientreflectionboost\" \"0.2\"\n";
  2554. material_data += "\t\"$envmaplightscale\" \"" + std::to_string(0.1) + "\"\n";
  2555. material_data += "\t\"$wireframe\" \"" + std::to_string(wireframe) + "\"\n";
  2556. material_data += "\t\"$ignorez\" \"" + std::to_string(ignorez) + "\"\n";
  2557. material_data += "}\n";
  2558.  
  2559. auto init_key_values = [](KeyValuesv2 *keyvalues, const char *key_name) -> void {
  2560. using InitKeyValues_t = void(__thiscall *)(void *, const char *);
  2561. static InitKeyValues_t InitKeyValuesEx = nullptr;
  2562. static auto pThis = *reinterpret_cast<DWORD**>(Utils::FindSignature("client_panorama.dll", "B9 ? ? ? ? E8 ? ? ? ? 8B 5D 08") + 1);
  2563. if (!InitKeyValuesEx)
  2564. InitKeyValuesEx = *reinterpret_cast<InitKeyValues_t>(Utils::FindSignature("client_panorama.dll", "55 8B EC 51 33 C0 C7 45"));
  2565.  
  2566. InitKeyValuesEx(keyvalues, key_name);
  2567. };
  2568. auto load_from_buffer = [](KeyValuesv2 *key_values, const char *resource_name, const char *buf, void *file_sys = nullptr, const char *path_id = nullptr, void *eval_sym_proc = nullptr, void *unk = nullptr) -> void {
  2569. using LoadFromBuffer_t = void(__thiscall *)(void *, const char *, const char *, void *, const char *, void *, void *);
  2570. static LoadFromBuffer_t LoadFromBufferEx = nullptr;
  2571.  
  2572. if (!LoadFromBufferEx)
  2573. LoadFromBufferEx = *reinterpret_cast<LoadFromBuffer_t>(Utils::FindSignature("client_panorama.dll", "55 8B EC 83 E4 F8 83 EC 34 53 8B 5D 0C 89"));
  2574.  
  2575. LoadFromBufferEx(key_values, resource_name, buf, file_sys, path_id, eval_sym_proc, unk);
  2576. };
  2577.  
  2578. auto *key_values = new KeyValuesv2();
  2579. init_key_values(key_values, material_type.c_str());
  2580. load_from_buffer(key_values, material_name.c_str(), material_data.c_str());
  2581.  
  2582. return g_pMaterialSys->CreateMaterial(material_name.c_str(), key_values);
  2583. }
  2584. void __fastcall Hooks::SceneEnd(void* ecx, void* edx)
  2585. {
  2586. static auto oSceneEnd = g_Hooks.pRenderViewHook->GetOriginal<SceneEnd_t>(vtable_indexes::sceneEnd);
  2587. oSceneEnd(ecx, edx);
  2588.  
  2589.  
  2590.  
  2591. for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  2592. {
  2593. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  2594.  
  2595. if (!pPlayerEntity
  2596. || !pPlayerEntity->IsAlive()
  2597. || pPlayerEntity->IsDormant()
  2598. || !Globals::LocalPlayer)
  2599. continue;
  2600.  
  2601. bool IsTeammate = pPlayerEntity->GetTeam() == Globals::LocalPlayer->GetTeam();
  2602. bool IsEnemy = pPlayerEntity->GetTeam() != Globals::LocalPlayer->GetTeam();
  2603. bool IsLocal = pPlayerEntity == Globals::LocalPlayer;
  2604.  
  2605.  
  2606. static std::vector< IMaterial* > materials;
  2607.  
  2608. static bool once{ false };
  2609. if (!once) {
  2610. materials.push_back(create_material(true, false, false)); // material.
  2611. materials.push_back(create_material(false, false, false, 0)); // flat.
  2612. materials.push_back(create_material(true, false, true)); // material zignore.
  2613. materials.push_back(create_material(false, false, true)); // flat zignore.
  2614. once = true;
  2615. }
  2616.  
  2617. float vis_color[3] = { c_config::get().chams_esp_color_r / 255.f, c_config::get().chams_esp_color_g / 255.f, c_config::get().chams_esp_color_b / 255.f };
  2618. float hid_color[3] = { c_config::get().chams_xqz_esp_color_r / 255.f, c_config::get().chams_xqz_esp_color_g / 255.f, c_config::get().chams_xqz_esp_color_b / 255.f };
  2619. float local_color[3] = { c_config::get().local_chams_color_r / 255.f, c_config::get().local_chams_color_g / 255.f, c_config::get().local_chams_color_b / 255.f };
  2620. float local_fcolor[3] = { c_config::get().local_fchams_color_r / 255.f, c_config::get().local_fchams_color_g / 255.f, c_config::get().local_fchams_color_b / 255.f };
  2621. float desync_color[3] = { c_config::get().local_desync_color_r / 255.f, c_config::get().local_desync_color_g / 255.f, c_config::get().local_desync_color_b / 255.f };
  2622. float inner_color[3] = { c_config::get().inner_color_r / 255.f, c_config::get().inner_color_g / 255.f, c_config::get().inner_color_b / 255.f };
  2623. float mettalic_color[3] = { c_config::get().mettalic_color_r / 255.f, c_config::get().mettalic_color_g / 255.f, c_config::get().mettalic_color_b / 255.f };
  2624. float gold_color[3] = { c_config::get().gold_color_r / 255.f, c_config::get().gold_color_g / 255.f, c_config::get().gold_color_b / 255.f };
  2625. float flat_color[3] = { c_config::get().flat_color_r / 255.f, c_config::get().flat_color_g / 255.f, c_config::get().flat_color_b / 255.f };
  2626. float platinum_color[3] = { c_config::get().platinum_color_r / 255.f, c_config::get().platinum_color_g / 255.f, c_config::get().platinum_color_b / 255.f };
  2627. if (IsEnemy) {
  2628. if (c_config::get().chams_enemies) {
  2629. if (c_config::get().chams_xqz_enemies) {
  2630. g_pRenderView->SetBlend(c_config::get().chams_esp_color_a / 100.f);
  2631. g_pModelRender->ForcedMaterialOverride(materials.at(2));
  2632. g_pRenderView->SetColorModulation(hid_color);
  2633. pPlayerEntity->DrawModel(0x00000001, 255);
  2634. }
  2635.  
  2636. g_pRenderView->SetBlend(c_config::get().chams_xqz_esp_color_a / 100.f);
  2637. g_pModelRender->ForcedMaterialOverride(materials.at(0));
  2638. g_pRenderView->SetColorModulation(vis_color);
  2639. pPlayerEntity->DrawModel(0x00000001, 255);
  2640. }
  2641. }
  2642. else if (IsLocal && !Globals::LocalPlayer->IsScoped() && c_config::get().local_chams) {
  2643. IMaterial* Dagtag = g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Other textures");
  2644. g_pRenderView->SetBlend(c_config::get().local_chams_color_a / 100.f);
  2645. g_pModelRender->ForcedMaterialOverride(Dagtag);
  2646. g_pRenderView->SetColorModulation(local_color);
  2647.  
  2648. pPlayerEntity->DrawModel(0x00000001, 155);
  2649. }
  2650. if (IsLocal)
  2651. {
  2652. if (c_config::get().visualizeFakeLag && pPlayerEntity == Globals::LocalPlayer)
  2653. {
  2654. // initializing the material
  2655. static IMaterial* material = nullptr;
  2656.  
  2657. material = g_pMaterialSys->FindMaterial("models\\inventory_items\\dogtags\\dogtags_outline", "Other textures"); // defining it as dogtags_outline
  2658.  
  2659.  
  2660.  
  2661. static auto last_networked_origin = Vector(0, 0, 0); // storing the origin
  2662.  
  2663. if (Globals::bSendPacket)
  2664. {
  2665. last_networked_origin = pPlayerEntity->GetAbsOrigin(); // defining it as our abs origin on sendpacket
  2666. }
  2667.  
  2668. pPlayerEntity->SetAbsOrigin(last_networked_origin); // set our origin to the last networked one
  2669. g_pModelRender->ForcedMaterialOverride(material); // force the material
  2670. g_pRenderView->SetColorModulation(platinum_color); // color modulate it
  2671. pPlayerEntity->DrawModel(0x00000001, 155); // draw it NOOB
  2672. pPlayerEntity->SetAbsOrigin(pPlayerEntity->GetAbsOrigin()); // set our origin back after drawing
  2673.  
  2674. }
  2675.  
  2676.  
  2677.  
  2678. if (c_config::get().desyncchams && pPlayerEntity == Globals::LocalPlayer)
  2679. {
  2680. Vector OrigAng;
  2681. Vector AbsOrigin;
  2682. IMaterial* Dagtag = g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Other textures");
  2683. OrigAng = Globals::LocalPlayer->GetAbsAngles();
  2684. Globals::LocalPlayer->SetAngles2(Vector(0, Globals::pCmd->viewangles.y, 0));
  2685. g_pRenderView->SetBlend(c_config::get().local_desync_color_a / 100.f);
  2686. g_pModelRender->ForcedMaterialOverride(Dagtag);
  2687. g_pRenderView->SetColorModulation(desync_color);
  2688. pPlayerEntity->DrawModel(0x00000001, 155);
  2689. Globals::LocalPlayer->SetAngles2(OrigAng);
  2690. }
  2691. else if (IsLocal && !Globals::LocalPlayer->IsScoped() && c_config::get().mettalicchams) {
  2692. IMaterial* Mettalic = g_pMaterialSys->FindMaterial("dev/glow_armsrace.vmt", "Other textures");
  2693. g_pRenderView->SetBlend(c_config::get().local_chams_color_a / 100.f);
  2694. g_pModelRender->ForcedMaterialOverride(Mettalic);
  2695. g_pRenderView->SetColorModulation(inner_color);
  2696.  
  2697. pPlayerEntity->DrawModel(0x00000001, 155);
  2698. }
  2699. // METALLIC
  2700. else if (IsLocal && !Globals::LocalPlayer->IsScoped() && c_config::get().actuallymettalic) {
  2701. IMaterial* Bubble = g_pMaterialSys->FindMaterial("models/inventory_items/cologne_prediction/cologne_prediction_glass", "Other textures");
  2702. g_pRenderView->SetBlend(c_config::get().local_chams_color_a / 100.f);
  2703. g_pModelRender->ForcedMaterialOverride(Bubble);
  2704. g_pRenderView->SetColorModulation(mettalic_color);
  2705.  
  2706. pPlayerEntity->DrawModel(0x00000001, 155);
  2707. }
  2708. //
  2709. else if (IsLocal && !Globals::LocalPlayer->IsScoped() && c_config::get().Platinum) {
  2710. Vector OrigAng;
  2711. Vector AbsOrigin;
  2712. IMaterial* Dagtag = g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Other textures");
  2713.  
  2714. AbsOrigin = Globals::LocalPlayer->GetAbsAngles();
  2715. Globals::LocalPlayer->SetAngles2(Vector(0, Globals::pCmd->viewangles.y, 0));
  2716. g_pRenderView->SetBlend(c_config::get().local_desync_color_a / 100.f);
  2717. g_pModelRender->ForcedMaterialOverride(Dagtag);
  2718. g_pRenderView->SetColorModulation(desync_color);
  2719. pPlayerEntity->DrawModel(0x1, 155);
  2720. Globals::LocalPlayer->SetAngles2(OrigAng);
  2721. }
  2722. //
  2723. else if (IsLocal && !Globals::LocalPlayer->IsScoped() && c_config::get().Gold) {
  2724. IMaterial* Gold = g_pMaterialSys->FindMaterial("models/inventory_items/cologne_prediction/cologne_prediction_glass", "Other textures");
  2725. g_pRenderView->SetBlend(c_config::get().local_chams_color_a / 100.f);
  2726. g_pModelRender->ForcedMaterialOverride(Gold);
  2727. g_pRenderView->SetColorModulation(gold_color);
  2728.  
  2729. pPlayerEntity->DrawModel(0x00000001, 155);
  2730. }
  2731. else if (IsLocal && !Globals::LocalPlayer->IsScoped() && c_config::get().flat) {
  2732. Vector OrigAng;
  2733. Vector AbsOrigin;
  2734.  
  2735. AbsOrigin = Globals::LocalPlayer->GetAbsAngles();
  2736. Globals::LocalPlayer->SetAbsAngles(Vector(0, Globals::pCmd->viewangles.y, 0));
  2737. g_pRenderView->SetBlend(c_config::get().flat_color_a / 100.f);
  2738. g_pModelRender->ForcedMaterialOverride(materials.at(2));
  2739. g_pRenderView->SetColorModulation(flat_color);
  2740. pPlayerEntity->DrawModel(0x01, 155);
  2741. Globals::LocalPlayer->SetAngles2(OrigAng);
  2742.  
  2743. }
  2744. else if (IsLocal && !Globals::LocalPlayer->IsScoped() && c_config::get().flatc) {
  2745. g_pRenderView->SetBlend(c_config::get().local_fchams_color_a / 100.f);
  2746. g_pModelRender->ForcedMaterialOverride(materials.at(0));
  2747. g_pRenderView->SetColorModulation(local_fcolor);
  2748. pPlayerEntity->DrawModel(0x00000001, 155);
  2749. }
  2750.  
  2751. }
  2752. g_pModelRender->ForcedMaterialOverride(nullptr);
  2753. }
  2754.  
  2755.  
  2756. for (auto i = 0; i < g_GlowManager->GetSize(); i++)
  2757. {
  2758. auto &glowObject = g_GlowManager->m_GlowObjectDefinitions[i];
  2759. auto entity = reinterpret_cast<C_BaseEntity*>(glowObject.m_pEntity);
  2760. auto m_pLocalPlayer = reinterpret_cast<C_BaseEntity*>(g_pEntityList->GetClientEntity(g_pEngine->GetLocalPlayer()));
  2761.  
  2762. if (!entity)
  2763. continue;
  2764.  
  2765. if (!m_pLocalPlayer)
  2766. continue;
  2767.  
  2768. if (glowObject.IsUnused())
  2769. continue;
  2770.  
  2771. bool is_local_player = entity == m_pLocalPlayer;
  2772. bool is_teammate = m_pLocalPlayer->GetTeam() == entity->GetTeam() && !is_local_player;
  2773. bool IsEnemy = entity->GetTeam() != m_pLocalPlayer->GetTeam();
  2774.  
  2775. if (is_local_player) {
  2776. if (c_config::get().local_glow && !m_pLocalPlayer->IsScoped()) {
  2777. auto class_id = entity->GetClientClass()->ClassID;
  2778.  
  2779.  
  2780. switch (class_id)
  2781. {
  2782. default:
  2783. glowObject.m_flAlpha = 0.0f;
  2784. break;
  2785. case 40:
  2786. glowObject.m_nGlowStyle = 0;
  2787. glowObject.m_flAlpha = c_config::get().local_glow_color_a / 255.f;
  2788. break;
  2789. }
  2790.  
  2791. glowObject.m_flRed = c_config::get().local_glow_color_r / 255.0f;
  2792. glowObject.m_flGreen = c_config::get().local_glow_color_g / 255.0f;
  2793. glowObject.m_flBlue = c_config::get().local_glow_color_b / 255.0f;
  2794. glowObject.m_bRenderWhenOccluded = true;
  2795. glowObject.m_bRenderWhenUnoccluded = false;
  2796. }
  2797. }
  2798. else if (!is_teammate) {
  2799. if (c_config::get().glow_enemies) {
  2800. auto class_id = entity->GetClientClass()->ClassID;
  2801.  
  2802.  
  2803. switch (class_id)
  2804. {
  2805. default:
  2806. glowObject.m_flAlpha = 0.0f;
  2807. break;
  2808. case 40:
  2809. glowObject.m_nGlowStyle = 0;
  2810. glowObject.m_flAlpha = c_config::get().glow_esp_color_a / 255.f;
  2811. break;
  2812. }
  2813.  
  2814. glowObject.m_flRed = c_config::get().glow_esp_color_r / 255.0f;
  2815. glowObject.m_flGreen = c_config::get().glow_esp_color_g / 255.0f;
  2816. glowObject.m_flBlue = c_config::get().glow_esp_color_b / 255.0f;
  2817. glowObject.m_bRenderWhenOccluded = true;
  2818. glowObject.m_bRenderWhenUnoccluded = false;
  2819. }
  2820. }
  2821. else if (is_teammate) {
  2822. if (c_config::get().glow_teammates) {
  2823. auto class_id = entity->GetClientClass()->ClassID;
  2824.  
  2825.  
  2826. switch (class_id)
  2827. {
  2828. default:
  2829. glowObject.m_flAlpha = 0.0f;
  2830. break;
  2831. case 40:
  2832. glowObject.m_nGlowStyle = 0;
  2833. glowObject.m_flAlpha = c_config::get().glow_alpha_teammates / 255.f;
  2834. break;
  2835. }
  2836.  
  2837. glowObject.m_flRed = 180 / 255.0f;
  2838. glowObject.m_flGreen = 60 / 255.0f;
  2839. glowObject.m_flBlue = 120 / 255.0f;
  2840. glowObject.m_bRenderWhenOccluded = true;
  2841. glowObject.m_bRenderWhenUnoccluded = false;
  2842. }
  2843. }
  2844.  
  2845.  
  2846.  
  2847. }
  2848. if (c_config::get().no_smoke) {
  2849. std::vector<const char*> vistasmoke_wireframe =
  2850. {
  2851. "particle/vistasmokev1/vistasmokev1_smokegrenade",
  2852. };
  2853.  
  2854. std::vector<const char*> vistasmoke_nodraw =
  2855. {
  2856. "particle/vistasmokev1/vistasmokev1_fire",
  2857. "particle/vistasmokev1/vistasmokev1_emods",
  2858. "particle/vistasmokev1/vistasmokev1_emods_impactdust",
  2859. };
  2860.  
  2861. for (auto mat_s : vistasmoke_wireframe)
  2862. {
  2863. IMaterial* mat = g_pMaterialSys->FindMaterial(mat_s, "Other textures");
  2864. mat->SetMaterialVarFlag(MATERIAL_VAR_WIREFRAME, true); //wireframe
  2865. }
  2866.  
  2867. for (auto mat_n : vistasmoke_nodraw)
  2868. {
  2869. IMaterial* mat = g_pMaterialSys->FindMaterial(mat_n, "Other textures");
  2870. mat->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  2871. }
  2872.  
  2873. static auto smokecout = *(DWORD*)(linegoesthrusmoke + 0x8);
  2874. *(int*)(smokecout) = 0;
  2875. }
  2876.  
  2877. }
  2878. inline bool isHand(std::string& modelName) {
  2879. if ((modelName.find("arms") != std::string::npos || modelName.find("v_models") != std::string::npos) && !(modelName.find("uid") != std::string::npos || modelName.find("stattrack") != std::string::npos)) {
  2880. return true;
  2881. }
  2882.  
  2883. return false;
  2884. }
  2885. void angleMatrixv2(const Vector angles, matrix3x4_t& matrix)
  2886. {
  2887. float sr, sp, sy, cr, cp, cy;
  2888.  
  2889. sy = sin(DEG2RAD(angles[1]));
  2890. cy = cos(DEG2RAD(angles[1]));
  2891.  
  2892. sp = sin(DEG2RAD(angles[0]));
  2893. cp = cos(DEG2RAD(angles[0]));
  2894.  
  2895. sr = sin(DEG2RAD(angles[2]));
  2896. cr = cos(DEG2RAD(angles[2]));
  2897.  
  2898. //matrix = (YAW * PITCH) * ROLL
  2899. matrix[0][0] = cp * cy;
  2900. matrix[1][0] = cp * sy;
  2901. matrix[2][0] = -sp;
  2902.  
  2903. float crcy = cr * cy;
  2904. float crsy = cr * sy;
  2905. float srcy = sr * cy;
  2906. float srsy = sr * sy;
  2907.  
  2908. matrix[0][1] = sp * srcy - crsy;
  2909. matrix[1][1] = sp * srsy + crcy;
  2910. matrix[2][1] = sr * cp;
  2911.  
  2912. matrix[0][2] = (sp * crcy + srsy);
  2913. matrix[1][2] = (sp * crsy - srcy);
  2914. matrix[2][2] = cr * cp;
  2915.  
  2916. matrix[0][3] = 0.0f;
  2917. matrix[1][3] = 0.0f;
  2918. matrix[2][3] = 0.0f;
  2919. }
  2920.  
  2921.  
  2922.  
  2923. void angleMatrix(const Vector angles, matrix3x4_t& matrix)
  2924. {
  2925. float sr, sp, sy, cr, cp, cy;
  2926.  
  2927. sy = sin(DEG2RAD(angles[1]));
  2928. cy = cos(DEG2RAD(angles[1]));
  2929.  
  2930. sp = sin(DEG2RAD(angles[0]));
  2931. cp = cos(DEG2RAD(angles[0]));
  2932.  
  2933. sr = sin(DEG2RAD(angles[2]));
  2934. cr = cos(DEG2RAD(angles[2]));
  2935.  
  2936. //matrix = (YAW * PITCH) * ROLL
  2937. matrix[0][0] = cp * cy;
  2938. matrix[1][0] = cp * sy;
  2939. matrix[2][0] = -sp;
  2940.  
  2941. float crcy = cr * cy;
  2942. float crsy = cr * sy;
  2943. float srcy = sr * cy;
  2944. float srsy = sr * sy;
  2945.  
  2946. matrix[0][1] = sp * srcy - crsy;
  2947. matrix[1][1] = sp * srsy + crcy;
  2948. matrix[2][1] = sr * cp;
  2949.  
  2950. matrix[0][2] = (sp * crcy + srsy);
  2951. matrix[1][2] = (sp * crsy - srcy);
  2952. matrix[2][2] = cr * cp;
  2953.  
  2954. matrix[0][3] = 0.0f;
  2955. matrix[1][3] = 0.0f;
  2956. matrix[2][3] = 0.0f;
  2957. }
  2958. FORCEINLINE float DotProductv2(const float *v1, const float *v2)
  2959. {
  2960. return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
  2961. }
  2962. void vectorRotate(const float *in1, const matrix3x4_t& in2, float *out)
  2963. {
  2964. out[0] = DotProductv2(in1, in2[0]);
  2965. out[1] = DotProductv2(in1, in2[1]);
  2966. out[2] = DotProductv2(in1, in2[2]);
  2967. }
  2968.  
  2969. void vectorRotate(const Vector& in1, const matrix3x4_t &in2, Vector &out)
  2970. {
  2971. vectorRotate(&in1.x, in2, &out.x);
  2972. }
  2973.  
  2974. void vectorRotate(const Vector &in1, const Vector &in2, Vector &out)
  2975. {
  2976. matrix3x4_t matRotate;
  2977. angleMatrix(in2, matRotate);
  2978. vectorRotate(in1, matRotate, out);
  2979. }
  2980. void matrixCopy(const matrix3x4_t& source, matrix3x4_t& target)
  2981. {
  2982. for (int i = 0; i < 3; i++)
  2983. {
  2984. for (int j = 0; j < 4; j++)
  2985. {
  2986. target[i][j] = source[i][j];
  2987. }
  2988. }
  2989. }
  2990.  
  2991. void matrixMultiply(matrix3x4_t& in1, const matrix3x4_t& in2)
  2992. {
  2993. matrix3x4_t out;
  2994. if (&in1 == &out)
  2995. {
  2996. matrix3x4_t in1b;
  2997. matrixCopy(in1, in1b);
  2998. matrixMultiply(in1b, in2);
  2999. return;
  3000. }
  3001. if (&in2 == &out)
  3002. {
  3003. matrix3x4_t in2b;
  3004. matrixCopy(in2, in2b);
  3005. matrixMultiply(in1, in2b);
  3006. return;
  3007. }
  3008. out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
  3009. in1[0][2] * in2[2][0];
  3010. out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
  3011. in1[0][2] * in2[2][1];
  3012. out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
  3013. in1[0][2] * in2[2][2];
  3014. out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] +
  3015. in1[0][2] * in2[2][3] + in1[0][3];
  3016. out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
  3017. in1[1][2] * in2[2][0];
  3018. out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
  3019. in1[1][2] * in2[2][1];
  3020. out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
  3021. in1[1][2] * in2[2][2];
  3022. out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] +
  3023. in1[1][2] * in2[2][3] + in1[1][3];
  3024. out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
  3025. in1[2][2] * in2[2][0];
  3026. out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
  3027. in1[2][2] * in2[2][1];
  3028. out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
  3029. in1[2][2] * in2[2][2];
  3030. out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
  3031. in1[2][2] * in2[2][3] + in1[2][3];
  3032.  
  3033. in1 = out;
  3034. }
  3035.  
  3036. void __fastcall Hooks::DrawModelExecute(void* ecx, void* edx, IMatRenderContext* context, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix)
  3037. {
  3038. static auto oDrawModelExecute = g_Hooks.pModelHook->GetOriginal<DrawModelExecute_t>(vtable_indexes::dme);
  3039.  
  3040. const char* ModelName = g_pModelInfo->GetModelName((model_t*)info.pModel);
  3041.  
  3042. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(info.index);
  3043. C_BaseEntity* pLocal = Globals::LocalPlayer;
  3044.  
  3045. float hand_chams[3] = { c_config::get().hand_chams_color_r / 255.f, c_config::get().hand_chams_color_g / 255.f, c_config::get().hand_chams_color_b / 255.f };
  3046. float vis_color[3] = { c_config::get().chams_esp_color_r / 255.f, c_config::get().chams_esp_color_g / 255.f, c_config::get().chams_esp_color_b / 255.f };
  3047. float hid_color[3] = { c_config::get().chams_xqz_esp_color_r / 255.f, c_config::get().chams_xqz_esp_color_g / 255.f, c_config::get().chams_xqz_esp_color_b / 255.f };
  3048. float local_color[3] = { c_config::get().local_chams_color_r / 255.f, c_config::get().local_chams_color_g / 255.f, c_config::get().local_chams_color_b / 255.f };
  3049. IMaterial* chamsType;
  3050. IMaterial* chamsTypeLocal;
  3051. IMaterial* chamsTypeHands;
  3052. if (pPlayerEntity && pPlayerEntity->IsAlive() && !pPlayerEntity->IsDormant() && strstr(ModelName, "models/player") && Globals::LocalPlayer && pPlayerEntity == Globals::LocalPlayer) {
  3053. if (Globals::LocalPlayer->IsScoped())
  3054. {
  3055. g_pRenderView->SetBlend(0.4f);
  3056. }
  3057. else if (c_config::get().local_chams != 0) {
  3058.  
  3059. if (c_config::get().local_chams == 4) {
  3060. g_pRenderView->SetBlend(0.f);
  3061. }
  3062. else {
  3063. IMaterial* Dagtag = g_pMaterialSys->FindMaterial("models/inventory_items/dogtags/dogtags_outline", "Other textures");
  3064. g_pRenderView->SetColorModulation(local_color);
  3065. g_pRenderView->SetBlend(c_config::get().local_chams_color_a / 100.f);
  3066. g_pModelRender->ForcedMaterialOverride(Dagtag);
  3067. }
  3068. }
  3069. oDrawModelExecute(ecx, context, state, info, matrix);
  3070. }
  3071.  
  3072. if (strstr(ModelName, "models/player") && pPlayerEntity && pLocal && !pPlayerEntity->IsDormant() && pPlayerEntity->IsAlive()) {
  3073.  
  3074. if (c_config::get().chams_enemies != 0) {
  3075.  
  3076. if (pPlayerEntity->GetTeam() != pLocal->GetTeam() && !pPlayerEntity->IsDormant() && pLocal && pPlayerEntity != pLocal) {
  3077. if (!c_config::get().chams_xqz_enemies) {
  3078.  
  3079. if (!chamsType || chamsType->IsErrorMaterial())
  3080. return;
  3081. g_pRenderView->SetColorModulation(vis_color);
  3082. g_pRenderView->SetBlend(c_config::get().chams_esp_color_a / 100.f);
  3083. g_pModelRender->ForcedMaterialOverride(chamsType);
  3084. }
  3085. else {
  3086. if (pLocal->IsAlive())
  3087. {
  3088. g_pRenderView->SetColorModulation(hid_color);
  3089. g_pRenderView->SetBlend(c_config::get().chams_esp_color_a / 100.f);
  3090. g_pModelRender->ForcedMaterialOverride(chamsType);
  3091. chamsType->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, true);
  3092. oDrawModelExecute(ecx, context, state, info, matrix);
  3093. }
  3094.  
  3095. chamsType->SetMaterialVarFlag(MATERIAL_VAR_IGNOREZ, false);
  3096. g_pRenderView->SetColorModulation(vis_color);
  3097. g_pRenderView->SetBlend(c_config::get().chams_xqz_esp_color_a / 100.f);
  3098. g_pModelRender->ForcedMaterialOverride(chamsType);
  3099. }
  3100. }
  3101. }
  3102. }
  3103. static std::vector< IMaterial * > materials;
  3104.  
  3105. static bool once{ false };
  3106. if (!once) {
  3107. materials.push_back(create_material(true, false, false)); // material.
  3108. materials.push_back(create_material(false, false, false, 0)); // flat.
  3109. materials.push_back(create_material(true, false, true)); // material zignore.
  3110. materials.push_back(create_material(false, false, true)); // flat zignore.
  3111. once = true;
  3112. }
  3113. /*
  3114. IMaterial *materials[32];
  3115. studiohdr_t* hdr = g_pModelInfo->GetStudiomodel(info.pModel);
  3116. g_pModelInfo->GetModelMaterials(info.pModel, hdr->numtextures, materials);
  3117.  
  3118. for (int i = 0; i < hdr->numtextures; i++)
  3119. {
  3120. IMaterial* mathands = materials[i];
  3121. if (!mathands)
  3122. continue;
  3123.  
  3124. mathands->SetMaterialVarFlag(MATERIAL_VAR_WIREFRAME, c_config::get().wireframe_arms);
  3125. }
  3126. */
  3127. float hand_xchams[3] = { c_config::get().hand_chamsx_color_r / 255.f, c_config::get().hand_chamsx_color_g / 255.f, c_config::get().hand_chamsx_color_b / 255.f };
  3128. auto HandChams = c_config::get().hand_chams;
  3129.  
  3130. if (strstr(ModelName, "arms") && c_config::get().Fatality_chams) {
  3131.  
  3132. if (HandChams == 4) {
  3133. g_pRenderView->SetBlend(1.f);
  3134.  
  3135. g_pRenderView->SetBlend(1.f);
  3136. }
  3137. {
  3138. IMaterial* Fatality = g_pMaterialSys->FindMaterial("models/inventory_items/cologne_prediction/cologne_prediction_glass", "Other textures");
  3139. g_pRenderView->SetBlend(c_config::get().hand_chamsx_color_a / 100.f);
  3140. g_pRenderView->SetColorModulation(hand_xchams);
  3141. g_pModelRender->ForcedMaterialOverride(Fatality);
  3142. }
  3143. oDrawModelExecute(ecx, context, state, info, matrix);
  3144. }
  3145. oDrawModelExecute(ecx, context, state, info, matrix);
  3146. g_pModelRender->ForcedMaterialOverride(NULL);
  3147.  
  3148.  
  3149. if (strstr(ModelName, "arms") && c_config::get().hand_chams > 0) {
  3150.  
  3151. if (HandChams == 4) {
  3152. g_pRenderView->SetBlend(1.f);
  3153. }
  3154. else {
  3155. IMaterial* Glowarms = g_pMaterialSys->FindMaterial("dev/glow_armsrace.vmt", "Other textures");
  3156. g_pRenderView->SetBlend(c_config::get().hand_chams_color_a / 100.f);
  3157. g_pRenderView->SetColorModulation(hand_chams);
  3158. g_pModelRender->ForcedMaterialOverride(Glowarms);
  3159. }
  3160. oDrawModelExecute(ecx, context, state, info, matrix);
  3161. }
  3162. oDrawModelExecute(ecx, context, state, info, matrix);
  3163. g_pModelRender->ForcedMaterialOverride(NULL);
  3164. }
  3165.  
  3166.  
  3167.  
  3168. void Hooks::HookPlayers()
  3169. {
  3170. static bool Init[65];
  3171. static bool Hooked[65];
  3172.  
  3173. for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  3174. {
  3175. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  3176.  
  3177. if (!pPlayerEntity
  3178. || !pPlayerEntity->IsAlive()
  3179. || pPlayerEntity->IsDormant())
  3180. {
  3181. if (Hooked[i])
  3182. g_Hooks.pPlayerHook[i]->Unhook(vtable_indexes::extraBonePro);
  3183.  
  3184. Hooked[i] = false;
  3185. continue;
  3186. }
  3187.  
  3188. if (!Init[i])
  3189. {
  3190. g_Hooks.pPlayerHook[i] = std::make_unique<ShadowVTManager>();
  3191. Init[i] = true;
  3192. }
  3193.  
  3194. if (Hooked[i])
  3195. g_Hooks.pPlayerHook[i]->Unhook(vtable_indexes::extraBonePro);
  3196.  
  3197. if (!Hooked[i])
  3198. {
  3199. g_Hooks.pPlayerHook[i]->Setup(pPlayerEntity);
  3200. g_Hooks.pPlayerHook[i]->Hook(vtable_indexes::extraBonePro, Hooks::DoExtraBonesProcessing);
  3201.  
  3202. Hooked[i] = true;
  3203. }
  3204. }
  3205. }
  3206.  
  3207.  
  3208. void __fastcall Hooks::DoExtraBonesProcessing(void * ECX, void * EDX, void * unkn1, void * unkn2, void * unkn3, void * unkn4, CBoneBitList & unkn5, void * unkn6)
  3209. {
  3210. C_BaseEntity* pPlayerEntity = (C_BaseEntity*)ECX;
  3211.  
  3212. if (!pPlayerEntity || pPlayerEntity == nullptr)
  3213. return;
  3214.  
  3215. if (!pPlayerEntity->IsAlive() || pPlayerEntity->IsDormant())
  3216. return;
  3217.  
  3218. if (!pPlayerEntity->AnimState())
  3219. return;
  3220.  
  3221. auto oDoExtraBonesProcessing = g_Hooks.pPlayerHook[pPlayerEntity->EntIndex()]->GetOriginal<ExtraBoneProcess_t>(vtable_indexes::extraBonePro);
  3222.  
  3223. float Backup = pPlayerEntity->AnimState()->m_flStopToFullRunningFraction;
  3224. pPlayerEntity->AnimState()->m_flStopToFullRunningFraction = 0;
  3225.  
  3226. oDoExtraBonesProcessing(ECX, unkn1, unkn2, unkn3, unkn4, unkn5, unkn6);
  3227.  
  3228. pPlayerEntity->AnimState()->m_flStopToFullRunningFraction = Backup;
  3229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement