Basic memory editing problem c++ GTA
I have recently got involved in game hacking and wanted to try making a small trainer for GTA SA:MP using tutorials.
It's a basic tool to change the money, I found out the memory address which is correct
But when I try t run the hack it just doesn't change the money.
It can't seem to open the process correctly so I tried using PROCESS_QUERY_INFORMATION instead of PROCESS_ALL_ACCESS which seems to work but it still won't change the money value. It's getting frustrating and I wonder if anyone can help me out.
It's a basic tool to change the money, I found out the memory address which is correct
But when I try t run the hack it just doesn't change the money.
Code:
#include <iostream>
#include <windows.h>
int newdata = 99999999;
int main()
{
HWND hWnd = FindWindow(0, "GTA:SA:MP");
if(hWnd == 0)
{
printf("Error cannot find window.");
}
else
{
DWORD ProcessID;
GetWindowThreadProcessId(hWnd, &ProcessID);
HANDLE handleprocess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessID);
if(!handleprocess)
printf("Error opening process");
else{
WriteProcessMemory(handleprocess, (LPVOID)0xB7CE50, &newdata, (DWORD)sizeof(newdata), NULL);
}
CloseHandle(handleprocess);
}
getchar();
return 0;
}
