Solved TrackMania Trainer

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Status
Not open for further replies.

JWNJWN

Newbie
Full Member
Apr 1, 2013
5
172
0
Well i have been following fleeps tutorial for a trainer (the prompt one) and i was changing the code and address' correctly, This is for the beta of the new TrackMania game.
C++:
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>

DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD offsets[], DWORD BaseAddress);
void WriteToMemory(HANDLE hProcHandle);

std::string GameName = "ManiaPlanet";
LPCSTR LGameWindow = "ManiaPlanet";
std::string GameStatus;

bool IsGameAvail;
bool UpdateOnNextRun;

//Co-ordinate Vars
bool XStatus;
BYTE XValue[] = {0x1E};
DWORD XBaseAddress = ((DWORD)GetModuleHandleA("ManiaPlanet.exe")) + 0x00F73C24;
DWORD XOffset[] = {0x124, 0x88, 0x78, 0x1C, 0x28};

int main()
{
	HWND hGameWindow = NULL;
	int TimeSinceLastUpdate = clock();
	int GameAvailTimer = clock();
	int onePressTimer = clock();
	DWORD dwProcID = NULL;
	HANDLE hProcHandle = NULL;
	UpdateOnNextRun = true;
	std::string sXStatus = "OFF";

	while(!GetAsyncKeyState(VK_INSERT))
	{
		if(clock() - GameAvailTimer > 100)
		{
			GameAvailTimer = clock();
			IsGameAvail = false;

			hGameWindow = FindWindow(NULL, LGameWindow);
			if(hGameWindow)
			{
				GetWindowThreadProcessId(hGameWindow, &dwProcID);
				if(dwProcID != 0)
				{
					hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);
					if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
					{
						GameStatus = "Failed To Open Process For Valid Handle";
					}
					else
					{
						GameStatus = "ManiaPlanet Ready To Hack";
						IsGameAvail = true;
					}
				}
				else
				{
					GameStatus = "Failed To Get Process ID";
				}
			}
			else
			{
				GameStatus = "ManiaPlanet Not Found";
			}

			if(UpdateOnNextRun || clock() - TimeSinceLastUpdate > 5000)
			{
				system("cls");
				std::cout << "--------------------------------------------------------------------" << std::endl;
				std::cout << "			ManiaPlanet Trainer" << std::endl;
				std::cout << "--------------------------------------------------------------------" << std::endl << std::endl;
				std::cout << "GAME STATUS: " << GameStatus << std::endl << std::endl;
				std::cout << "[F1] X -> " << sXStatus << " <- " << std::endl << std::endl;
				std::cout << "[INSERT] Exit" << std::endl;
				UpdateOnNextRun = false;
				TimeSinceLastUpdate = clock();
			}

			if(IsGameAvail)
			{
				WriteToMemory(hProcHandle);

			}
		}

		if(clock() - onePressTimer > 400)
		{
			if(IsGameAvail)
			{

				if(GetAsyncKeyState(VK_F1))
				{
					onePressTimer = clock();
					XStatus = !XStatus;
					UpdateOnNextRun = true;
					if(XStatus)sXStatus = "ON";
					else sXStatus = "OFF";
				}
			}
		}
	}

	return ERROR_SUCCESS;
}

DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD offsets[], DWORD BaseAddress)
{
	DWORD pointer = BaseAddress;
	DWORD pTemp;

	DWORD pointerAddr;
	for(int c = 0; c < PointerLevel; c++)
	{
		if(c == 0)
		{
			ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof(pTemp), NULL);
		}
		pointerAddr = pTemp + offsets[c];
		ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &pTemp, sizeof(pTemp), NULL);
	}
	return pointerAddr;

}

void WriteToMemory(HANDLE hProcHandle)
{
	DWORD AddressToWrite;
	
	if(XStatus)
	{
		AddressToWrite = FindDmaAddy(4, hProcHandle, XOffset, XBaseAddress);
		WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &XValue, sizeof(XValue), NULL);
	}
}

If someone could try and tell me what is wrong i would appreciate it a lot.
Thank you in advance
 
Last edited:

jamesst20

The Future Hacker
Dank Tier Donator
Nobleman
Apr 1, 2013
86
633
0
I didn't test anything but I know in Fleep tutorial, he does if (GetAsyncKeyState(VK_INSERT)&1), could the &1 be the issue ? You didn't tell what the issue so it is pretty hard to guess ^^
 

JWNJWN

Newbie
Full Member
Apr 1, 2013
5
172
0
The issue is that is simply doesn't work, It is meant to change the X of the car to the XValue specified but it does nothing.
Well nothing that i can tell
 

jamesst20

The Future Hacker
Dank Tier Donator
Nobleman
Apr 1, 2013
86
633
0
The issue is that is simply doesn't work, It is meant to change the X of the car to the XValue specified but it does nothing.
Well nothing that i can tell
Try to add some std::cout at some places to make sure it gets to that point
 

Syperus

RTFM
Meme Tier VIP
Dank Tier Donator
Oct 29, 2012
432
2,638
7
What does the status say when you load the game? Is it detecting the window? If it keeps saying "ManiaPlanet Not Found" then your game window name is wrong. Needs to be exactly as it looks in the window. If it's not that then double check your addresses. Check your offsets and make sure they're not backwards.

jamesst20 &1 prevents the key being pressed from spamming on/off while the key is being held down. Yes this could actually be an issue cause if it's held down for any amount of seconds it will have spammed the key on/off multiple times. Chances of it actually stopping at off every time is unlikely, but not impossible. JWNJWN try this and see if it fixes your issue as well.
 
Status
Not open for further replies.
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods