Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // aaaaa.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include <Windows.h>
- #include <vector>
- #include "proc.h"
- int main()
- {
- //Get ProcId of the target process
- DWORD procId = GetProcId(L"ac_client.exe");
- //Getmodulebaseaddress
- uintptr_t moduleBase = GetModuleBaseAddress(procId, L"ac_client.exe");
- //Get Handle to Process
- HANDLE hProcess = 0;
- hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, procId);
- //Resolve base address of the pointer chain
- uintptr_t dynamicPtrBaseAddrHealth = moduleBase + 0x109B74; // health
- uintptr_t dynamicPtrBaseAddrAmmo = moduleBase + 0x10F4F4; // ammo // pistol ammo
- //Resolve our cheats pointer chain
- std::vector<unsigned int> HealthOffsets = { 0xF8 };
- uintptr_t healthAddr = FindDMAAddy(hProcess, dynamicPtrBaseAddrHealth, HealthOffsets);
- std::vector<unsigned int> AmmoOffsets = { 0x150 };
- uintptr_t AmmoAddr = FindDMAAddy(hProcess, dynamicPtrBaseAddrAmmo, AmmoOffsets);
- std::vector<unsigned int> pistolAmmoOffsets = { 0x13C };
- uintptr_t PistolAmmoAddr = FindDMAAddy(hProcess, dynamicPtrBaseAddrAmmo, pistolAmmoOffsets);
- //Read Ammo value
- int HealthValue = 0;
- int AmmoValue = 0;
- int PistolAmmoValue = 0;
- ReadProcessMemory(hProcess, (BYTE*)healthAddr, &HealthValue, sizeof(HealthValue), nullptr);
- ReadProcessMemory(hProcess, (BYTE*)AmmoAddr, &AmmoValue, sizeof(AmmoValue), nullptr);
- ReadProcessMemory(hProcess, (BYTE*)PistolAmmoAddr, &PistolAmmoValue, sizeof(PistolAmmoValue), nullptr);
- bool ONOFFhealth = false;
- bool ONOFFAmmo = false;
- bool ONOFFAmmop = false;
- while (TRUE)
- {
- //---------------------------------------
- if (GetAsyncKeyState(VK_NUMPAD1)) //Health on or off
- {
- if (ONOFFhealth)
- {
- ONOFFhealth = false;
- }
- else
- {
- ONOFFhealth = true;
- }
- }
- if (ONOFFhealth)// if its ON DO THIS
- {
- int newHealth = 666;
- WriteProcessMemory(hProcess, (BYTE*)healthAddr, &newHealth, sizeof(newHealth), nullptr);
- ReadProcessMemory(hProcess, (BYTE*)healthAddr, &HealthValue, sizeof(HealthValue), nullptr);
- std::cout << "New Health = " << std::dec << HealthValue << std::endl;
- Sleep(1000);
- }
- //---------------------------------------
- if (GetAsyncKeyState(VK_NUMPAD2)) // AMMO on or off
- {
- if (ONOFFAmmo)
- {
- ONOFFAmmo = false;
- }
- else
- {
- ONOFFAmmo = true;
- }
- }
- if (ONOFFAmmo)// if ON execute
- {
- int newAmmo = 666;
- WriteProcessMemory(hProcess, (BYTE*)AmmoAddr, &newAmmo, sizeof(newAmmo), nullptr);
- ReadProcessMemory(hProcess, (BYTE*)AmmoAddr, &AmmoValue, sizeof(AmmoValue), nullptr);
- std::cout << "New Ammo = " << std::dec << AmmoValue << std::endl;
- Sleep(1000);
- }
- //---------------------------------------
- if (GetAsyncKeyState(VK_NUMPAD3)) // PISTOL AMMO on or off
- {
- if (ONOFFAmmop)
- {
- ONOFFAmmop = false;
- }
- else
- {
- ONOFFAmmop = true;
- }
- }
- if (ONOFFAmmop)// if ON execute
- {
- int newPistolAmmo = 666;
- WriteProcessMemory(hProcess, (BYTE*)PistolAmmoAddr, &newPistolAmmo, sizeof(newPistolAmmo), nullptr);
- ReadProcessMemory(hProcess, (BYTE*)PistolAmmoAddr, &PistolAmmoValue, sizeof(PistolAmmoValue), nullptr);
- std::cout << "New Pistol Ammo = " << std::dec << PistolAmmoValue << std::endl;
- Sleep(1000);
- }
- //---------------------------------------
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement