Post: [C++] Make a Game Trainer (Memory Editor , Game Hack)
12-08-2013, 12:48 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Hey everyone today I will be teaching you on how to make a Game trainer with C++ (Console app)...

So let´s start...

First add some includes...

    #include <iostream>
#include <windows.h>


Now just add the usual namespace :P

    using namespace std;


Now add your main function

    int main()
{

}


Alright now let´s make a cout...

    cout << "Make sure Modern Warfare 2 is Opened before opening the tool! << endl;
system("Pause");


Now let´s create a FindWindow function (WINDOW NAME NOT PROCESS NAME!!)!

    LPCWSTR Fuck = L"Modern Warfare 2";
HWND hwnd = FindWindow(0, Fuck);


Now we need to create some basic if code to determinate if the Window is opened or not...

    if (hwnd == 0)
{
cout << "The game has not been found... please open it before opening the tool next time..." << endl;
system("Pause");
}
else
{
cout << "Modern Warfare 2 has been found... Enjoy the tool!" << endl;
}


Great!


Now you need to add a DWORD , a Function that gets the process ID and writes it to the DWORD and a
Handle function...

    DWORD process_ID;
GetWindowThreadProcessId(hwnd, &process_ID);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, process_ID);


Now populate it with options!

I will just be doing XP here...

    cout << "Type 1 for XP" << endl;
cout << "Type : ";
int Option;
cin >> Option;


Now let´s make the options if code and the actual write memory code Smile

    if (Option > 1)
{
cout << "There is no option higher than 1..." << endl;
system("Pause");
}
if (Option == 1)
{
...
}


Ok Smile
Now let´s make a cout that ask us how much XP do we want to write..

    cout << "What do you want to set your XP as?" << endl;
cout << "Type : ";
int XP;
cin >> XP;


Alright now you need to convert the XP to a byte....

by doing this :
    DWORD newdatasize = sizeof(XP);


Now finally we are going to write process memory!!

    if (WriteProcessMemory(hProcess, (LPVOID)0x01B2C89C, &XP, newdatasize, NULL))
{
cout << "The XP has been written sucessfully!!" << endl;
system("Pause");
}
else
{
cout << "There was an error writing the XP..." << endl;
system("Pause");
}


Basicly we are doing if code so we dont get a nasty error when something goes wrong..
Also il explain the WriteProcessMemory syntax... :
WriteProcessMemory(ToThisProcessID, (LPVOID)ToThisOffset, &XP , WithTheseBytes, NULL))...

Now just add the "looping" main(); and a return 0; code Smile ...

You have just made a memory editor!!!

Final source : You must login or register to view this content.


Video version :



*Yes this was copied from my blog and "adapted" to NGU

Original (Blog) Version : You must login or register to view this content.
Last edited by MW2TopTenWORLD ; 12-14-2013 at 02:50 PM.

The following 2 users say thank you to MW2TopTenWORLD for this useful post:

milky4444, QuantumDev
12-09-2013, 09:17 PM #2
QuantumDev
Can’t trickshot me!
Very nice dude! Nice tutorial for the more experienced C++ users.
12-09-2013, 10:26 PM #3
Originally posted by xQuantumModz View Post
Very nice dude! Nice tutorial for the more experienced C++ users.


I started yesterday with C++ .. That was my first C++ program so I am not experienced at all xD... however thank you Smile
12-10-2013, 07:18 PM #4
Styx-
Gobble
No offense but this is a really bad tutorial for several reasons.

1. You have simply pasted code in. This does not help readers because you have not explained the code or its usage(Probably because you can't (You did say you started learning C++ a day ago)).

2. This is supposed to be a tutorial on how to create a game trainer yet you have only pasted some code and not explained how to scan a games memory and search for addresses (among other things). As far as your code goes, I suppose it could be used as a template

3. You have not stated which game this is to be used for. I assume that you know this will only work for MW2 (It's in your code).

Anyway, perhaps you should improve your tutorial a bit.
12-10-2013, 08:02 PM #5
Originally posted by Styx
No offense but this is a really bad tutorial for several reasons.

1. You have simply pasted code in. This does not help readers because you have not explained the code or its usage(Probably because you can't (You did say you started learning C++ a day ago)).

2. This is supposed to be a tutorial on how to create a game trainer yet you have only pasted some code and not explained how to scan a games memory and search for addresses (among other things). As far as your code goes, I suppose it could be used as a template

3. You have not stated which game this is to be used for. I assume that you know this will only work for MW2 (It's in your code).

Anyway, perhaps you should improve your tutorial a bit.


He didn't copy and paste. I did a quick google search and saw he was on another forum talking about this. He got some bugs worked out and he released here.

@OP, good job at your first C++ app. Note, you shouldn't use Visual C++ as it's shit imo lol.
12-14-2013, 02:29 PM #6
Originally posted by TheUnexpected View Post
He didn't copy and paste. I did a quick google search and saw he was on another forum talking about this. He got some bugs worked out and he released here.

@OP, good job at your first C++ app. Note, you shouldn't use Visual C++ as it's shit imo lol.


This isn´t coded in VC++ its in C++ Smile .. VC++ it´s like MessageBox::Show("...."); .. aka a fake stupid C++ lol , also I am going to change the thread now, because I have made a better tutorial in my blog and youtube so I am going to change the thread Smile Also yeah on MPGH I Got some help , because I was using the #include <windows.h> and also putting the C++ "Classes" for those :S also I was familiar with C# string , int , uint , .... all C# variables and not these DWORDS , LPCWSTR so I was a bit confused.. I will update the thread in a second and also thanks for your post Smile
12-14-2013, 03:56 PM #7
Originally posted by MW2TopTenWORLD View Post
This isn´t coded in VC++ its in C++ Smile .. VC++ it´s like MessageBox::Show("...."); .. aka a fake stupid C++ lol , also I am going to change the thread now, because I have made a better tutorial in my blog and youtube so I am going to change the thread Smile Also yeah on MPGH I Got some help , because I was using the #include <windows.h> and also putting the C++ "Classes" for those :S also I was familiar with C# string , int , uint , .... all C# variables and not these DWORDS , LPCWSTR so I was a bit confused.. I will update the thread in a second and also thanks for your post Smile


I wasn't referring to the Microsoft version. I was talking about the IDE you use.
12-14-2013, 08:02 PM #8
Originally posted by TheUnexpected View Post
I wasn't referring to the Microsoft version. I was talking about the IDE you use.


Ohhh ... which one should I use? DevC++??? Also Why does Visual Studio sucks?.. What are the differences between VS and DEV C++ or whatever you suggest
12-14-2013, 08:22 PM #9
Originally posted by MW2TopTenWORLD View Post
Ohhh ... which one should I use? DevC++??? Also Why does Visual Studio sucks?.. What are the differences between VS and DEV C++ or whatever you suggest


DevC++ is outdated and is shit. I don't like Visual Studio lol. I use MinGW haha, all command line Happy
01-06-2014, 04:44 AM #10
You did more in the video than you explained?

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo