Code:
#include <iostream>
#include <Windows.h>
using namespace std;
int main(){
int newvalue;
cout << "Welcome to [D]opeDog's Basic Memory Hacking" << endl;
cout << "Enter the new value: " << endl;
cin >> newvalue;
HWND handle = FindWindow(0, "Alliance of Valiant Arms");
if(handle == 0){
cerr << "Failed to find window." << endl;
}else{
cout << "Found the window ." << endl;
Sleep(5);
cout << "Getting Process ID" << endl;
Sleep(5);
cout << "Opening Process" << endl;
DWORD PID;
GetWindowThreadProcessId(handle, &PID);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID);
Sleep(10);
if(!hProc){
cerr << "Failed to Open the Process" << endl;
}else{
int WritePMemory = WriteProcessMemory(hProc, (LPVOID)0x04162870, &newvalue, (DWORD)sizeof newvalue, NULL);
if(WritePMemory > 0){
clog << "Value has been written to memory." << endl;
}else{
cerr << "Failed to write the value to memory." << endl;
}
}
}
system("PAUSE");
system("CLS");
return main();
}