Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- // Grabs a handle to the specified window
- HANDLE GrabHandle(char * windowName) {
- // Get a handle to the window
- HWND windHandle = FindWindowA(NULL, windowName);
- // Get the process identifier
- DWORD pid;
- GetWindowThreadProcessId(windHandle, &pid);
- // Open a handle to the process
- HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
- return handle;
- }
- int main() {
- HANDLE handle = GrabHandle("AssaultCube");
- bool healthToggleOn = false;
- bool ammoToggleOn = false;
- bool stillHacking = true;
- while (stillHacking) {
- // Toggle the health hack feature
- if (GetAsyncKeyState(VK_NUMPAD1) & 1) {
- healthToggleOn = !healthToggleOn;
- }
- // Toggle the ammo hack feature
- if (GetAsyncKeyState(VK_NUMPAD2) & 1) {
- ammoToggleOn = !ammoToggleOn;
- }
- // Allow the user to close the hack
- if (GetAsyncKeyState(VK_NUMPAD9) & 1) {
- stillHacking = false;
- }
- // Set our health to 1337 if the health toggle is currently on
- if (healthToggleOn) {
- // The value we're setting the health to
- int newValue = 1337;
- // The pointer to the player object
- DWORD playerObjectPointer = 0x50F4F4;
- // Read into the player object pointer to get the dynamic address of the player object
- DWORD playerObject;
- ReadProcessMemory(handle, (LPCVOID)playerObjectPointer, &playerObject, sizeof(playerObject), NULL);
- // Write to the health
- DWORD healthOffset = 0xF8;
- DWORD healthAddress = playerObject + healthOffset;
- WriteProcessMemory(handle, (LPVOID)healthAddress, &newValue, sizeof(newValue), NULL);
- }
- // Set the ammo for our assault rifle and pistol to 1337
- if (ammoToggleOn) {
- // The value we're setting the ammos to
- int newValue = 1337;
- // The pointer to the player object
- DWORD playerObjectPointer = 0x50F4F4;
- // Read into the player object pointer to get the dynamic address of the player object
- DWORD playerObject;
- ReadProcessMemory(handle, (LPCVOID)playerObjectPointer, &playerObject, sizeof(playerObject), NULL);
- // Write to the assault rifle ammo
- DWORD arOffset = 0x150;
- DWORD arAddress = playerObject + arOffset;
- WriteProcessMemory(handle, (LPVOID)arAddress, &newValue, sizeof(newValue), NULL);
- // Write to the pistol offset
- DWORD pistolOffset = 0x13C;
- DWORD pistolAddress = playerObject + pistolOffset;
- WriteProcessMemory(handle, (LPVOID)pistolAddress, &newValue, sizeof(newValue), NULL);
- }
- }
- CloseHandle(handle);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement