Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- typedef struct pos {
- int x;
- int y;
- int z;
- } pos;
- char process_name[] = "AssaultCube";
- HWND hWnd;
- DWORD process_id;
- HANDLE handle;
- int base_address = 0x400000;
- int local_offset = 0x10F4F4;
- // Boolean Addresses
- int ENABLE = 1;
- int DISABLE = 0;
- // Game Addresses
- int local_player; // IMPORTANT
- //
- // Offsets
- int health_offset = 0x00F8;
- int armor_offset = 0x00FC;
- int x_offset = 0x0038;
- int y_offset = 0x003C;
- int z_offset = 0x0040;
- int magazine_offset = 0x0128;
- int clip_offset = 0x0150;
- int frag_offset = 0x0158;
- int adminJack = 0x220;
- //
- HWND hook() {
- HWND hWnd = FindWindowA(NULL, process_name);
- return hWnd;
- }
- int GetAddress(int offset) {
- return (local_player + offset);
- }
- void setup() {
- // Retrieve the local player
- ReadProcessMemory(handle, (LPVOID)(base_address + local_offset), &local_player, sizeof(int), 0);
- // Give the player admin access
- WriteProcessMemory(handle, (LPVOID)GetAddress(adminJack), &ENABLE, sizeof(int), 0);
- // Controls
- printf("\nControls\n");
- printf("Press %s to add %s\n", "F1", "Health");
- printf("Press %s to add %s\n", "F2", "Armor");
- printf("Press %s to add %s\n", "F3", "Ammo");
- printf("Press %s to add %s\n", "F4", "Frags");
- printf("Press %s to add %s\n", "F5", "Magazines");
- }
- // POSITION
- pos GetPosition() {
- int x, y, z = 0;
- ReadProcessMemory(handle, (LPVOID)GetAddress(x_offset), &x, sizeof(int), 0);
- ReadProcessMemory(handle, (LPVOID)GetAddress(y_offset), &y, sizeof(int), 0);
- ReadProcessMemory(handle, (LPVOID)GetAddress(z_offset), &z, sizeof(int), 0);
- pos position;
- position.x = x;
- position.y = y;
- position.z = z;
- return position;
- }
- // ARMOR
- int GetArmor() {
- int ap = 0;
- ReadProcessMemory(handle, (LPVOID)GetAddress(armor_offset), &ap, sizeof(int), 0);
- return ap;
- }
- void SetArmor(int value = 100) {
- WriteProcessMemory(handle, (LPVOID)GetAddress(armor_offset), &value, sizeof(int), 0);
- }
- void AddArmor(int amount) {
- int ap = amount + GetArmor();
- SetArmor(ap);
- }
- // HEALTH
- int GetHealth() {
- int hp = 0;
- ReadProcessMemory(handle, (LPVOID)GetAddress(health_offset), &hp, sizeof(int), 0);
- return hp;
- }
- void SetHealth(int value = 100) {
- WriteProcessMemory(handle, (LPVOID)GetAddress(health_offset), &value, sizeof(int), 0);
- }
- void AddHealth(int amount) {
- int hp = amount + GetHealth();
- SetHealth(hp);
- }
- // AMMO
- int GetMagazines() {
- int ammo = 0;
- ReadProcessMemory(handle, (LPVOID)GetAddress(magazine_offset), &ammo, sizeof(int), 0);
- return ammo;
- }
- void SetMagazines(int value = 20) {
- WriteProcessMemory(handle, (LPVOID)GetAddress(magazine_offset), &value, sizeof(int), 0);
- }
- void AddMagazine() {
- int ammo = 20 + GetMagazines();
- SetMagazines(ammo);
- }
- int GetAmmoInClip() {
- int ammo = 0;
- ReadProcessMemory(handle, (LPVOID)GetAddress(clip_offset), &ammo, sizeof(int), 0);
- return ammo;
- }
- void SetAmmoInClip(int value = 20) {
- WriteProcessMemory(handle, (LPVOID)GetAddress(clip_offset), &value, sizeof(int), 0);
- }
- void AddAmmoInClip(int amount) {
- int clip = amount + GetAmmoInClip();
- SetAmmoInClip(clip);
- }
- // Frags
- int GetFrags() {
- int frags = 0;
- ReadProcessMemory(handle, (LPVOID)GetAddress(frag_offset), &frags, sizeof(int), 0);
- return frags;
- }
- void SetFrags(int value = 20) {
- WriteProcessMemory(handle, (LPVOID)GetAddress(frag_offset), &value, sizeof(int), 0);
- }
- void AddFrags(int amount) {
- int clip = amount + GetFrags();
- SetFrags(clip);
- }
- void stats() {
- printf("\n Current Data: \n");
- printf("Health: %d%%\n", GetHealth());
- printf("Armor: %d%%\n", GetArmor());
- printf("Magazines: %d\n", GetMagazines());
- printf("Ammo In Clip: %d\n", GetAmmoInClip());
- pos position = GetPosition();
- printf("Position: {%d, %d, %d}", position.x, position.y, position.z);
- }
- void options() {
- while (true) {
- if (GetKeyState(VK_F1)) {
- AddHealth(10);
- break;
- }
- if (GetKeyState(VK_F2)) {
- AddArmor(100);
- break;
- }
- if (GetKeyState(VK_F3)) {
- AddAmmoInClip(100);
- break;
- }
- if (GetKeyState(VK_F4)) {
- AddFrags(1);
- break;
- }
- if (GetKeyState(VK_F5)) {
- AddMagazine();
- break;
- }
- }
- stats();
- Sleep(1000);
- options();
- }
- int main()
- {
- printf("Welcome to the Assault Cube Console.\nThe console will help you gain an advantage when pressing function keys.\n", "");
- hWnd = hook();
- if (hWnd == NULL) {
- printf("Failed to find window named '%s'\n", process_name);
- return -1;
- }
- printf("Found window named '%s'! Attempting to open.\n", process_name);
- GetWindowThreadProcessId(hWnd, &process_id);
- handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, process_id);
- if (handle == NULL) {
- printf("Failed to hook into '%s'\n", process_name);
- return -2;
- }
- printf("Successfully opened the '%s' process.\n", process_name);
- setup();
- stats();
- options();
- // Remove admin access
- WriteProcessMemory(handle, (LPVOID)GetAddress(adminJack), &DISABLE, sizeof(int), 0);
- return 0;
- }
Add Comment
Please, Sign In to add comment