Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.38 KB | None | 0 0
  1. // aaaaa.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include <iostream>
  5. #include <Windows.h>
  6. #include <vector>
  7. #include "proc.h"
  8.  
  9.  
  10.  
  11.  
  12.  
  13. int main()
  14. {
  15.     //Get ProcId of the target process
  16.     DWORD procId = GetProcId(L"ac_client.exe");
  17.  
  18.     //Getmodulebaseaddress
  19.     uintptr_t moduleBase = GetModuleBaseAddress(procId, L"ac_client.exe");
  20.  
  21.     //Get Handle to Process
  22.     HANDLE hProcess = 0;
  23.     hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, procId);
  24.  
  25.     //Resolve base address of the pointer chain
  26.     uintptr_t dynamicPtrBaseAddrHealth = moduleBase + 0x109B74; // health
  27.     uintptr_t dynamicPtrBaseAddrAmmo = moduleBase + 0x10F4F4; // ammo // pistol ammo
  28.  
  29.     //Resolve our cheats pointer chain
  30.     std::vector<unsigned int> HealthOffsets = { 0xF8 };
  31.     uintptr_t healthAddr = FindDMAAddy(hProcess, dynamicPtrBaseAddrHealth, HealthOffsets);
  32.     std::vector<unsigned int> AmmoOffsets = { 0x150 };
  33.     uintptr_t AmmoAddr = FindDMAAddy(hProcess, dynamicPtrBaseAddrAmmo, AmmoOffsets);
  34.     std::vector<unsigned int> pistolAmmoOffsets = { 0x13C };
  35.     uintptr_t PistolAmmoAddr = FindDMAAddy(hProcess, dynamicPtrBaseAddrAmmo, pistolAmmoOffsets);
  36.  
  37.     //Read Ammo value
  38.     int HealthValue = 0;
  39.     int AmmoValue = 0;
  40.     int PistolAmmoValue = 0;
  41.  
  42.     ReadProcessMemory(hProcess, (BYTE*)healthAddr, &HealthValue, sizeof(HealthValue), nullptr);
  43.     ReadProcessMemory(hProcess, (BYTE*)AmmoAddr, &AmmoValue, sizeof(AmmoValue), nullptr);
  44.     ReadProcessMemory(hProcess, (BYTE*)PistolAmmoAddr, &PistolAmmoValue, sizeof(PistolAmmoValue), nullptr);
  45.  
  46.     bool ONOFFhealth = false;
  47.     bool ONOFFAmmo = false;
  48.     bool ONOFFAmmop = false;
  49.    
  50.  
  51.     while (TRUE)
  52.     {
  53.         //---------------------------------------
  54.         if (GetAsyncKeyState(VK_NUMPAD1)) //Health on or off
  55.         {
  56.             if (ONOFFhealth)
  57.             {
  58.                 ONOFFhealth = false;
  59.             }
  60.             else
  61.             {
  62.                 ONOFFhealth = true;
  63.             }
  64.        
  65.         }
  66.         if (ONOFFhealth)// if its ON DO THIS
  67.         {
  68.             int newHealth = 666;
  69.             WriteProcessMemory(hProcess, (BYTE*)healthAddr, &newHealth, sizeof(newHealth), nullptr);
  70.             ReadProcessMemory(hProcess, (BYTE*)healthAddr, &HealthValue, sizeof(HealthValue), nullptr);
  71.             std::cout << "New Health = " << std::dec << HealthValue << std::endl;
  72.             Sleep(1000);
  73.         }
  74.         //---------------------------------------
  75.         if (GetAsyncKeyState(VK_NUMPAD2)) // AMMO on or off
  76.         {
  77.             if (ONOFFAmmo)
  78.             {
  79.                 ONOFFAmmo = false;
  80.             }
  81.             else
  82.             {
  83.                 ONOFFAmmo = true;
  84.             }
  85.         }
  86.         if (ONOFFAmmo)// if ON execute
  87.         {  
  88.             int newAmmo = 666;
  89.             WriteProcessMemory(hProcess, (BYTE*)AmmoAddr, &newAmmo, sizeof(newAmmo), nullptr);
  90.             ReadProcessMemory(hProcess, (BYTE*)AmmoAddr, &AmmoValue, sizeof(AmmoValue), nullptr);
  91.             std::cout << "New Ammo = " << std::dec << AmmoValue << std::endl;
  92.             Sleep(1000);
  93.         }
  94.         //---------------------------------------
  95.         if (GetAsyncKeyState(VK_NUMPAD3)) // PISTOL AMMO on or off
  96.         {
  97.             if (ONOFFAmmop)
  98.             {
  99.                 ONOFFAmmop = false;
  100.             }
  101.             else
  102.             {
  103.                 ONOFFAmmop = true;
  104.             }
  105.         }
  106.         if (ONOFFAmmop)// if ON execute
  107.         {
  108.             int newPistolAmmo = 666;
  109.             WriteProcessMemory(hProcess, (BYTE*)PistolAmmoAddr, &newPistolAmmo, sizeof(newPistolAmmo), nullptr);
  110.             ReadProcessMemory(hProcess, (BYTE*)PistolAmmoAddr, &PistolAmmoValue, sizeof(PistolAmmoValue), nullptr);
  111.             std::cout << "New Pistol Ammo = " << std::dec << PistolAmmoValue << std::endl;
  112.             Sleep(1000);
  113.         }
  114.         //---------------------------------------
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement