• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Results 1 to 8 of 8
    1. #1
      Hacker
      Turning to page 394...
       
      Coding
       
      Liduen's Avatar
      Join Date
      May 2013
      Location
      Germany
      Posts
      713
      Thanks (-->)
      161
      Thanks (<--)
      225

      Multihack source

      John Kittz
      Hi guys,

      just finished my multihack- what do you think?
      What should I do better next time, how can I improve the code?
      Please let me know. This is an external multihack.


      And for those who haven't done a hack before, you're welcome. Feel free to use the code.
      (You still have to get the addresses for your own game by yourself)


      Known issues:
      - Aimbot will flicker a lot, because it checks if you can hit a player (if he is visible) by switching through all enemys really fast and reading the crosshair value.
      - I found no way to check if a player is still alive or not, so it checks this fact by comparing the position from the run before and the run now
      (aimbot won't aim on campers, which is the reason why I binded the aimbot on c, to switch it off fast and to kill them too ).


      Source code:

      // INCLUDES
      #include <iostream>
      #include <windows.h>
      #include <sstream>
      #include <conio.h>
      #include <cmath>
      #include <math.h>
      #include <ctime>


      using namespace::std;


      // METHODS
      void CheckProcess();
      void GetAllPointers();
      void CheckKeys();
      void Graphics();
      void WriteToMemory();
      void AimbotFunc();
      void LeftClick();
      DWORD FindFinalAddy(int PointerLevel, DWORD Offsets[], DWORD BaseAddress); // Thanks to Fleep for this wonderful function!


      // VARIABLES
      DWORD dwProcId; // Process ID
      HWND window; // Window
      HANDLE hProcess; // Handle to process
      string sWindowTitle = "mygame"; // same as GameName
      LPCSTR GameName = "mygame";
      const float pi = 3.14159265;
      bool GameAvailable = false;
      bool InitialPointers = true;
      bool SthChanged = true;
      bool Wallhack = false;
      bool Health = false;
      bool Stamina = false;
      bool NoRecoil = false;
      bool NoSpread = false;
      bool Triggerbot = false;
      bool Aimbot = false;
      int adressen[32][4]; //[Player][x, y, z, Team]
      float positions[32][3][2]; //[Player][x, y, z][before, after]
      bool ismoving[32]; //[Player] -> Is Moving?
      int team[32]; //[Player] -> Which Team?
      float a, b, c;
      float angleX, angleY;
      float xPlayerView, yPlayerView;
      float xPlayerViewWriteable, yPlayerViewWriteable;
      int target = 0, oldtarget;
      int playerNumber, playerHealth;
      int nTriggerbot;
      int nAimspot = 15; // 2 = Head, 15 = Torso, 25 = Groin
      string sAimspot = "Torso";
      int nPlayerCrouched, nPlayerCrouchedCompensation = 20;


      // TEMPS
      int nTemp[36];
      float fTemp[100];




      int main()
      {
      // As long as the end-key wasn't pressed
      while(!GetAsyncKeyState(VK_END) &1)
      {
      // Don't waste CPU power (18 or 50 ms pause between each run)
      Sleep(18);
      // Is the game available?
      CheckProcess();
      if(GameAvailable)
      {
      // First get all the pointers
      if(InitialPointers) GetAllPointers();
      // Check if an important key was pressed (aka shortcut)
      CheckKeys();
      // Update the menu if necessary
      if(SthChanged) Graphics();
      // Execute all the memory stuff (read + write)
      WriteToMemory();
      }
      }
      CloseHandle(hProcess);
      return 0;
      }




      void CheckProcess()
      {
      // Find the game window.
      if ((window = FindWindow(0, GameName)) == NULL) cout << "Cannot find " + sWindowTitle + " window!\n";
      // Get the Process ID for use in OpenProcess
      if (!GetWindowThreadProcessId(window, &dwProcId)) cout << "Cannot retrieve process Id!\n";
      // Get a process handle to the game
      if ((hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcId)) == NULL)
      {
      cout << "Cannot open process!\n\n\n";
      GameAvailable = false;
      _getch();
      }
      else GameAvailable = true;
      }


      void CheckKeys()
      {
      if(GetAsyncKeyState(VK_NUMPAD0) &1)
      {
      Wallhack = !Wallhack;
      SthChanged = true;
      }
      if(GetAsyncKeyState(VK_NUMPAD1) &1)
      {
      Health = !Health;
      SthChanged = true;
      }
      if(GetAsyncKeyState(VK_NUMPAD2) &1)
      {
      Stamina = !Stamina;
      SthChanged = true;
      }
      if(GetAsyncKeyState(VK_NUMPAD3) &1)
      {
      NoRecoil = !NoRecoil;
      SthChanged = true;
      }
      /*if(GetAsyncKeyState(VK_NUMPAD4) &1) // Still have to find the right address...
      {
      NoSpread = !NoSpread;
      SthChanged = true;
      }*/
      if(GetAsyncKeyState(VK_NUMPAD5) &1)
      {
      Triggerbot = !Triggerbot;
      if(Aimbot) Triggerbot = true;
      SthChanged = true;
      }
      // Binded on c for faster switching but normally it's binded on VK_NUMPAD6
      if(GetAsyncKeyState(0x43) &1)
      {
      Aimbot = !Aimbot;
      if(Aimbot) Triggerbot = true;
      else Triggerbot = false;
      SthChanged = true;
      }
      if(GetAsyncKeyState(VK_NUMPAD7) &1)
      {
      if(nAimspot == 2)
      {
      nAimspot = 15;
      sAimspot = "Torso";
      }
      else if(nAimspot == 15)
      {
      nAimspot = 25;
      sAimspot = "Groin";
      }
      else if(nAimspot == 25)
      {
      nAimspot = 2;
      sAimspot = "Head";
      }
      SthChanged = true;
      }
      }


      void Graphics()
      {
      // Just the main menu, nothing special here...
      cout << "_______________ Multihack by Liduen\n"
      << "Hack Status:\n\n"
      << "(0) Wallhack: " << Wallhack << "\n"
      << "(1) Unlimited Health: " << Health << "\n"
      << "(2) Unlimited Stamina: "<< Stamina << "\n"
      << "(3) NoRecoil: " << NoRecoil << "\n"
      << "(4) NoSpread: " << NoSpread << "\n"
      << "(5) Triggerbot: " << Triggerbot << "\n"
      << "(6) Aimbot: " << Aimbot << "\n"
      << "(7) - Aimspot: " << sAimspot << "\n"
      << "\n\n\n\n\n\n\n\n\n\n\n\n\n";
      }

      void GetAllPointers()
      {
      afWall = FindFinalAddy(1, oWall, abWall);
      afHealth = FindFinalAddy(1, oHealth, GameBase);
      afStamina = FindFinalAddy(1, oStamina, GameBase);
      afRecoil = FindFinalAddy(1, oRecoil, GameBase);
      afTriggerbot = FindFinalAddy(1, oTriggerbot, GameBase);
      afXPlayerView = FindFinalAddy(1, oXPlayerView, GameBase);
      afYPlayerView = FindFinalAddy(1, oYPlayerView, GameBase);
      afTeam = FindFinalAddy(1, oTeam, GameBase);

      for (int i = 0; i <= 31; i++)
      {
      adressen[i][0] = afPositionX + (gapPosition * i);
      adressen[i][1] = afPositionZ + (gapPosition * i);
      adressen[i][2] = afPositionY + (gapPosition * i);
      adressen[i][3] = afTeam + (gapTeam * i);
      }

      // Only do this once
      InitialPointers = false;
      }


      DWORD FindFinalAddy(int PointerLevel, DWORD Offsets[], DWORD BaseAddress)
      {
      // Thanks to Fleep!
      DWORD pTemp, pointerAddr;
      for(int i = 0; i < PointerLevel; i ++)
      {
      if(i == 0) ReadProcessMemory(hProcess, (LPCVOID)BaseAddress, &pTemp, 4, NULL);
      pointerAddr = pTemp + Offsets[i]; //add first offset to that address
      ReadProcessMemory(hProcess, (LPCVOID)pointerAddr, &pTemp, 4, NULL); //Read memory one more time and exit the loop
      }
      return pointerAddr;
      }


      void WriteToMemory()
      {
      // Get all the information from each player
      for (int i = 0; i <= 31; i++)
      {
      // Old positions
      positions[i][0][2] = positions[i][0][1];
      positions[i][1][2] = positions[i][1][1];
      positions[i][2][2] = positions[i][2][1];

      // New positions
      ReadProcessMemory(hProcess, (LPCVOID)adressen[i][0], &fTemp[i], sizeof(float), NULL);
      positions[i][0][1] = fTemp[i];
      ReadProcessMemory(hProcess, (LPCVOID)adressen[i][1], &fTemp[i+1], sizeof(float), NULL);
      positions[i][1][1] = fTemp[i+1];
      ReadProcessMemory(hProcess, (LPCVOID)adressen[i][2], &fTemp[i+2], sizeof(float), NULL);
      positions[i][2][1] = fTemp[i+2];

      // Which player is moving? (not dead)
      ismoving[i] = (positions[i][0][1] != positions[i][0][2] || positions[i][1][1] != positions[i][1][2] || positions[i][2][1] != positions[i][2][2]);

      // Which player is in which team?
      ReadProcessMemory(hProcess, (LPCVOID)adressen[i][3], &nTemp[i], 4, NULL);
      team[i] = nTemp[i];
      }

      // Own slotnumber
      ReadProcessMemory(hProcess, (LPCVOID)afPlayerNumber, &nTemp[33], 4, NULL);
      playerNumber = nTemp[33];

      // Own health
      ReadProcessMemory(hProcess, (LPCVOID)afPlayerHealth, &nTemp[34], 4, NULL);
      playerHealth = nTemp[34];

      // Reading crosshairvalue
      ReadProcessMemory(hProcess, (LPCVOID)afTriggerbot, &nTemp[35], 4, NULL);
      nTriggerbot = nTemp[35];

      // Are you crouched?
      ReadProcessMemory(hProcess, (LPCVOID)afPlayerCrouched, &nTemp[36], 4, NULL);
      nPlayerCrouched = nTemp[36];


      // Player view angles and those we can write
      ReadProcessMemory(hProcess, (LPCVOID)afXPlayerView, &fTemp[97], sizeof(float), NULL);
      xPlayerView = fTemp[97];
      ReadProcessMemory(hProcess, (LPCVOID)afYPlayerView, &fTemp[98], sizeof(float), NULL);
      yPlayerView = fTemp[98];
      ReadProcessMemory(hProcess, (LPCVOID)afXPlayerViewWriteable, &fTemp[99], sizeof(float), NULL);
      xPlayerViewWriteable = fTemp[99];
      ReadProcessMemory(hProcess, (LPCVOID)afYPlayerViewWriteable, &fTemp[100], sizeof(float), NULL);
      yPlayerViewWriteable = fTemp[100];

      // Write this to memory only once
      if(SthChanged)
      {
      if(Wallhack) vWall = 1;
      else vWall = 0;
      WriteProcessMemory( hProcess, (BYTE*)afWall, &vWall, sizeof(vWall), NULL);

      SthChanged = false;
      }

      if(Health) WriteProcessMemory( hProcess, (BYTE*)afHealth, &vHealth, sizeof(vHealth), NULL);
      if(Stamina) WriteProcessMemory( hProcess, (BYTE*)afStamina, &vStamina, sizeof(vStamina), NULL);
      if(NoRecoil) WriteProcessMemory( hProcess, (BYTE*)afRecoil, &vRecoil, sizeof(vRecoil), NULL);
      if(Triggerbot
      && (nTriggerbot > -1 && nTriggerbot < 32) // Valid playernumber?
      && (team[nTriggerbot] != team[playerNumber] || team[playerNumber] == 0) // Not in our team or free-for-all mode?
      && (playerHealth > 0 && playerHealth < 101) // Am I alive?
      && (team[playerNumber] < 3 && team[playerNumber] > -1)) // Am I ingame or just spectator?
      LeftClick(); // Do the leftclick!
      if(Aimbot
      && (playerHealth > 0 && playerHealth < 101) // Am I alive?
      && (team[playerNumber] < 3 && team[playerNumber] > -1)) // Am I ingame or just spectator?
      AimbotFunc(); // Do the aimbotfunction!
      }


      void AimbotFunc()
      {
      // Switching target, if the enemy is behind a wall
      if (nTriggerbot < 0 || nTriggerbot > 31)
      {
      // Remember which one was the old target
      oldtarget = target;
      for(int i = 0; i < 32; i++)
      {
      // Switch our target
      target++;
      // If the old target is dead and there is no other, the aimbot won't be executed
      if (target == oldtarget && !ismoving[target]) return;
      // If we went once through the list, start at the beginning
      if (target == 32) target = 0;
      // We just found our next target
      if (ismoving[target] // Is the target moving (alive)?
      && (team[target] != team[playerNumber] || team[target] == 0) // Is the target in our team or is the mode free-for-all?
      && target != playerNumber) // We won't aim at ourself
      break; // Do the aimbotfunction!
      // The aimbot won't be executed if we didn't find a valid target
      if (i == 31) return;
      }
      }

      // Aimbot execution
      a = positions[playerNumber][0][1] - positions[target][0][1];
      b = positions[playerNumber][1][1] - positions[target][1][1];
      angleX = atan(b / a) / pi * 180.0;
      if (a > 0) angleX = xPlayerViewWriteable - (xPlayerView - (angleX - 180));
      else angleX = xPlayerViewWriteable - (xPlayerView - angleX);
      // Write our new x-angle
      WriteProcessMemory(hProcess, (LPVOID) afXPlayerViewWriteable, &angleX, sizeof(float), NULL);

      c = sqrt(a*a + b*b);
      a = (positions[playerNumber][2][1] - (nPlayerCrouchedCompensation * nPlayerCrouched)) - (positions[target][2][1] - nAimspot);
      angleY = atan(a / c) / pi * 180.0;
      angleY = yPlayerViewWriteable - (yPlayerView - angleY);
      // Write our new y-angle
      WriteProcessMemory(hProcess, (LPVOID) afYPlayerViewWriteable, &angleY, sizeof(float), NULL);

      // Enemy just got owned :D
      }


      void LeftClick()
      {
      // Thanks to some guy from a forum on the internet who's name I've unfortunately forgotten long time ago :/
      INPUT input = {0};

      // left down
      input.type = INPUT_MOUSE;
      input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
      ::SendInput(1,&input,sizeof(INPUT));

      // left up
      ::ZeroMemory(&input,sizeof(INPUT));
      input.type = INPUT_MOUSE;

      input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
      ::SendInput(1,&input,sizeof(INPUT));
      }


      Aaaaaand the outcome
      Not perfect (recoil and spread is serversided) but useful.

      https://www.youtube.com/watch?v=D_lx2qpvYIk

      Have fun
      Liduen
      Last edited by Liduen; 10-21-2015 at 11:46 AM.
      My contributions
      UrbanTerror | OpenGL - ModelLogger | Polymorphic junk code | Tutorial/Article Collection
      Admiring technological singularity

    2. Thanks NTvalk, Marcus, TYPEX, squeenie, __Steven thanked for this post
    3. #2
      Hacker
      ^.^
       
      Eating
       
      NTvalk's Avatar
      Join Date
      Jul 2013
      Location
      Your RAM
      Posts
      512
      Thanks (-->)
      176
      Thanks (<--)
      145
      Thanks for sharing

    4. #3
      Learning to hack games!
       
      Feeling Normal
       
      's Avatar
      Join Date
      Jan 1970
      Posts
      0
      Thanks (-->)
      294
      Thanks (<--)
      328
      Thanks for sharing.

    5. #4
      Kim Kong Trasher
      I don't have status.
       
      Raging
       
      c5's Avatar
      Join Date
      Jul 2012
      Location
      Mankei Iland
      Posts
      1,221
      Thanks (-->)
      97
      Thanks (<--)
      491
      Avoid global variables where you can, nicely structured code otherwise.

      PS, I'd add a little sleep between mouse down and up, to be sure it gets registered, if you are hooking rendering functions next time, your sendinputs won't be noticed by the game.
      Multihack source

    6. #5
      Hacker
      Turning to page 394...
       
      Coding
       
      Liduen's Avatar
      Join Date
      May 2013
      Location
      Germany
      Posts
      713
      Thanks (-->)
      161
      Thanks (<--)
      225
      Quote Originally Posted by c5 View Post
      Avoid global variables where you can, nicely structured code otherwise.

      PS, I'd add a little sleep between mouse down and up, to be sure it gets registered, if you are hooking rendering functions next time, your sendinputs won't be noticed by the game.
      I used them to not have to use so much parameters in the functions, as you can see most of them are void.
      But I never thought about it in detail.
      What are the advantages of not using global variables? Just keen to know

      I noticed that when I set the sleep() function under 18 milliseconds, the baretta didn't shoot as fast as the M4 anymore. In fact it then shot very inconstantly.

      Thanks for your feedback!
      My contributions
      UrbanTerror | OpenGL - ModelLogger | Polymorphic junk code | Tutorial/Article Collection
      Admiring technological singularity

    7. #6
      Kim Kong Trasher
      I don't have status.
       
      Raging
       
      c5's Avatar
      Join Date
      Jul 2012
      Location
      Mankei Iland
      Posts
      1,221
      Thanks (-->)
      97
      Thanks (<--)
      491
      Multihack source

    8. Thanks Liduen, NTvalk thanked for this post
    9. #7
      Jr.Coder
      Somewhere Causing Trouble
       
      Hate Mailing
       
      Marcus's Avatar
      Join Date
      Jan 2013
      Location
      Sweden
      Posts
      99
      Thanks (-->)
      33
      Thanks (<--)
      12
      Thanks for sharing mate!

    10. #8
      Newbie
      read, read, read ...
       
      Zombies
       
      ABartX's Avatar
      Join Date
      Dec 2013
      Posts
      2
      Thanks (-->)
      17
      Thanks (<--)
      0
      Cheats'n'Trainers
      thanks for sharing the source code


      greetz ABartX

    Similar Game Hacker Threads

    1. [Release] Multihack (4.2.017 / 4.2.018)
      By Liduen in forum Urban Terror Cheats
      Replies: 40
      Last Post: 10-29-2016, 04:55 AM
    2. [Source Code] Simple Bunny Hop Using Source Engine Functions [CS:Source]
      By Simon-Benyo in forum Tutorials and Snippets
      Replies: 7
      Last Post: 10-11-2015, 01:18 PM
    3. [Source Code] Multihack (4.2.018)
      By Liduen in forum Urban Terror Cheats
      Replies: 8
      Last Post: 07-15-2014, 10:00 AM
    4. Css multihack
      By squeenie in forum Counter-Strike: Source Hacks
      Replies: 14
      Last Post: 01-03-2014, 06:35 PM
    5. Counter-Strike Source Multihack Trainer
      By B0M8AY in forum Counter-Strike: Source Hacks
      Replies: 15
      Last Post: 02-20-2013, 07:55 AM

    Tags for this Thread