CSGO Hack Source C#


SUBMITTED BY: realstyla

DATE: Jan. 31, 2017, 2:29 p.m.

FORMAT: C#

SIZE: 6.6 kB

HITS: 1208

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Trigger
  8. {
  9. class Trigger
  10. {
  11. const int dwLocalPlayer = 0x00A77D3C; //Local Player
  12. const int dwTeamNumber = 0x000000F0; //Team number offset, Either T or CT.
  13. const int dwCrosshairID = 0x00002410; // Crosshair offset
  14. const int dwEntityList = 0x04A19DA4; // Entity List offset
  15. const int dwEntitySize = 0x10; // Size of Entity List
  16. const int dwHealth = 0x000000FC; // Health offset
  17. const int dwActiveWeapon = 0x000012C0; // Active weapon offset (Weapon that's in hands.)
  18. const int dwWeaponID = 0x00001690; // Offset of weapon ID (See Weapon Names Enum)
  19. public static int dwDelay = 75;
  20. [DllImport("user32.dll")]
  21. static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, UIntPtr dwExtraInfo);
  22. [DllImport("user32.dll")]
  23. public static extern short GetAsyncKeyState(UInt16 virtualKeyCode);
  24. public enum WindowsVirtualKey
  25. {
  26. VK_XBUTTON1 = 0x05, // Extended mouse button 1
  27. VK_XBUTTON2 = 0x06, // Extended mouse button 2
  28. }
  29. public enum WeaponNames : int
  30. {
  31. Deagle = 1,
  32. DualBerettas = 2,
  33. FiveSeven = 3,
  34. Glock18 = 4,
  35. AK47 = 7,
  36. AUG = 8,
  37. AWP = 9,
  38. Famas = 10,
  39. G35G1 = 11, //T-Side Auto
  40. Galil = 13,
  41. M249 = 14,
  42. M4A4 = 16,
  43. Mac10 = 17,
  44. P90 = 19,
  45. UMP45 = 24,
  46. XM1014 = 25,
  47. PPBizon = 26,
  48. Mag7 = 27,
  49. Negev = 28,
  50. SawedOff = 29,
  51. Tec9 = 30,
  52. Zues = 31,
  53. P2000 = 32,
  54. Mp7 = 33,
  55. Mp9 = 34,
  56. Nova = 35,
  57. P250 = 36,
  58. Scar20 = 38, // CT-Side Auto
  59. SG553 = 39,
  60. SSG08 = 40,
  61. CTKnife = 42, //default
  62. Flasbang = 43,
  63. HEGrenade = 44,
  64. Smoke = 45,
  65. Molotov = 46,
  66. Decoy = 47,
  67. Incendiary = 48,
  68. C4 = 49,
  69. TKnife = 59,// Default
  70. M4A1 = 60,
  71. USP = 61,
  72. CZ75 = 63,
  73. Bayonet = 500,
  74. FlipKnife = 505,
  75. GutKnife = 506,
  76. Karambit = 507,
  77. M9Bayo = 508,
  78. Huntsman = 509,
  79. Falchion = 512,
  80. Butterfly = 515,
  81. };
  82. public Trigger()
  83. {
  84. Memory mem = new Memory("csgo"); // Attach to CSGO
  85. mem.StartProcess(); // Start reading memory
  86. while (true)
  87. {
  88. int cDLL = mem.DllImageAddress("client.dll"); // Load modules in Client.dll
  89. int localPlayer = mem.ReadInt(cDLL + dwLocalPlayer); // Read Client.dll + dwLocalPlayer offset -- Get's the base LocalPlayer, where all information is stored that we need.
  90. int localPlayerHealth = mem.ReadInt(localPlayer + dwHealth); // Read localPlayer + dwHealth offset -- Gets the health of players.
  91. int localTeam = mem.ReadInt(localPlayer + dwTeamNumber); // read localPlayer + dwTeamNumber offset -- Gets the team number of players.
  92. int crosshairID = mem.ReadInt(localPlayer + dwCrosshairID); // read localPlayer + dwCrosshairID -- Gets the crosshairID
  93. int enemyInCrosshair = mem.ReadInt(cDLL + dwEntityList + ((crosshairID - 1) * dwEntitySize)); // read client.dll + dwEntityList + crosshairID - 1 * dwEntityList -- Determins if anyone is within the crosshair
  94. int enemyInCrosshairHealth = mem.ReadInt(enemyInCrosshair + dwHealth); // read enemyInCrosshair + dwHealth -- Checks to players health within the crosshair.
  95. int enemyCrosshairTeam = mem.ReadInt(enemyInCrosshair + dwTeamNumber); // read nemyinCrosshair + dwTeamNumber -- Checkes the players teamnumber.
  96. //Credits : reidenz @ Unknown // Translated C++ to C#.
  97. int wLocalPlayer = mem.ReadInt(cDLL + dwLocalPlayer); // read client.dll + dwLocalPlayer
  98. int dwWeaponIndex = mem.ReadInt(wLocalPlayer + dwActiveWeapon) & 0xFFF; // read wLocalPlayer + dwActiveweapon & 0xFFF.
  99. int dwWeaponEntity = mem.ReadInt((cDLL + dwEntityList + dwWeaponIndex * 0x10) - 0x10); // read client.dll + dwWeaponIndex * 0x10 - 0x10 // gets the weapon entity position.
  100. int weaponID = mem.ReadInt(dwWeaponEntity + dwWeaponID); // Reads the entity position and weapon ID.
  101. if (localPlayer != enemyCrosshairTeam && enemyInCrosshairHealth > 0 && enemyCrosshairTeam != localTeam) // If localPlayer is not enemyCrosshairTeam && enemyincrosshairhealth is greater than 0, and enemyincrosshair is not on the same team
  102. {
  103. //Acts as a boolean function, isn't triggered once a loop, but seems to be triggered and stays true on button press.
  104. if (GetAsyncKeyState((ushort)WindowsVirtualKey.VK_XBUTTON2) != 0 || GetAsyncKeyState((ushort)WindowsVirtualKey.VK_XBUTTON1) != 0) // Determine if hotkey was pressed.
  105. {
  106. //Check for knife/Grenade/Etc.
  107. if (weaponID != (int)WeaponNames.Bayonet || weaponID != (int)WeaponNames.Butterfly || weaponID != (int)WeaponNames.C4 || weaponID != (int)WeaponNames.CTKnife || weaponID != (int)WeaponNames.Decoy || weaponID != (int)WeaponNames.Falchion || weaponID != (int)WeaponNames.Flasbang || weaponID != (int)WeaponNames.FlipKnife || weaponID != (int)WeaponNames.GutKnife || weaponID != (int)WeaponNames.HEGrenade || weaponID != (int)WeaponNames.Huntsman || weaponID != (int)WeaponNames.Incendiary || weaponID != (int)WeaponNames.Karambit || weaponID != (int)WeaponNames.M9Bayo || weaponID != (int)WeaponNames.Molotov || weaponID != (int)WeaponNames.Smoke || weaponID != (int)WeaponNames.TKnife || weaponID != (int)WeaponNames.Zues)
  108. {
  109. System.Threading.Thread.Sleep(dwDelay); // Delay
  110. mouse_event(0x002, 0, 0, 0, (System.UIntPtr)0); // Click
  111. mouse_event(0x004, 0, 0, 0, (System.UIntPtr)0); // Release
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }

comments powered by Disqus