Help with the code :/

Posts 1–14 of 14 · Page 1 of 1
Help with the code :/
Hey guys, I'm learning how to make a basic trainer for Assault Cube. It's a free game. I got a sourcecode from: http://www.mpgh.net/forum/31-c-c-pro...hack-tool.html
I changed it a bit. I got address for HP: 02A7A3D8, I guess I should add 0x before the code? Sorry for the noobie question :/.
When I run it with the game and I want to change HP, the trainer doesn't do this.
Code:
using namespace std;

int main()
{
	system("color 0A");
	cout << "Waiting for the Assault Cube..." << endl;
	system("Pause");
	LPCWSTR Dupa = L"AssaultCube";
	HWND hwnd = FindWindow(0, Dupa);
	if (hwnd == 0)
	{
		cout << "The game has not been found... please open it before opening the tool next time..." << endl;
		system("Pause");
	}
	else
	{
		DWORD proces;
		GetWindowThreadProcessId(hwnd, &proces);
		HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proces);
		cout << "Game was found...Enjoy it!" << endl;
		system("Pause");
		cout << "Type 1 for HP" << endl;
		cout << "Type : ";
		int Option;
		cin >> Option;
		if (Option > 1)
		{
			cout << "There is no option higher than 1..." << endl;
			system("Pause");
		}
		if (Option == 1)
		{
			cout << "What do you want to set your HP as?" << endl;
			cout << "Type : ";
			int HP;
			cin >> HP;
			DWORD nowa = sizeof(HP);
			if (WriteProcessMemory(hProcess, (LPVOID)0x02A7A3D8, &HP, nowa, NULL))
			{
				cout << "The HP has been written sucessfully!!" << endl;
				system("Pause");
			}
			else
			{
				cout << "There was an error writing the HP..." << endl;
				system("Pause");
			}


		}
		CloseHandle(hProcess);
	}
	main();
	return 0;
}
Help please.
Sorry? Could you explain this? Sorry I'm not that good at this.
I have question about address, I found static address for Assult Cube 02A7A3D8. If i want to use this address in my program I just add 0x to this address?
Thanks.
Alright, I have something I tried using this code with address that is not static(Just found the value and added to it 0x and then to the code) and It worked!!! Just now I must know how to find static address :P Could someone link me with good tutorial how to do this? I looked it at google but I think I'm too stupid to understand :P. Thanks again for the help!
Quote Originally Posted by coca12345 View Post
Alright, I have something I tried using this code with address that is not static(Just found the value and added to it 0x and then to the code) and It worked!!! Just now I must know how to find static address :P Could someone link me with good tutorial how to do this? I looked it at google but I think I'm too stupid to understand :P. Thanks again for the help!
if your using cheat engine which i think you are, right click on the address, then click Find out what writes to this address. then shoot and you should see a few new lines come up, and everytime you shoot, the number to the left will increase by 1. it should say something like esx(4D), look down at the bottem for the esx, or edx or whatever it is. ill just link a video lol
You need to add 0x so the compiler knows that you're using a hexadecimal number
Hey, could you guys tell me something? Look at this video and stop it at http://www.youtube.com/watch?v=8CJdV1Vfvv0#t=01m56s At the bottom you see 2 addresses with 3333. The first one is pointer and is static and second one dynamic address. Those 2 addresses are the same, so how to put this pointer into the code? I know you have to add 0x before the address. But they are the same addresses??/ Little confusing.
They aren't the same address.

He finds the dynamic address, and then does a pointer-scan to find a pointer that points to that dynamic address.

starts the pointer-scan at 2:00 and at 3:15 you see the 1 pointer that was found.



3:27 also shows the pointer path (offset list).
Quote Originally Posted by abuckau907 View Post
They aren't the same address.

He finds the dynamic address, and then does a pointer-scan to find a pointer that points to that dynamic address.

starts the pointer-scan at 2:00 and at 3:15 you see the 1 pointer that was found.



3:27 also shows the pointer path (offset list).
The first one is from previous video that he found(static address) and then he searched for new address and this addres was the same as static but without P->. Oh, so It can happen that dynamic addres can be static address like in his video[After he searched for it in pointer scanner]? Also I have another question. He found static addess[green one] and then he restarted the game and the address changed but it pointed at right value. So this is how it works?
If I put the pointer[static address with 0x] to code, won't my program have a problem with that[It won't change the value]?
Sorry for stupid questions, but I must know that. Thanks for answers!
Oh, so It can happen that dynamic addres can be static address like in his video[After he searched for it in pointer scanner]?
No, dynamic and static mean totally opposite things..it's one, or the other.

Also I have another question. He found static addess[green one] and then he restarted the game and the address changed but it pointed at right value. So this is how it works?
Um..yes.

If I put the pointer[static address with 0x] to code, won't my program have a problem with that[It won't change the value]?
What? Not sure what you mean. What type of problem?

Tho I'm not sure answering those questions helps you much.. If you download Skype and create an account, we can chat about it and I'll try to fill in the blanks. Or ask more questions here : )
use GetLastError() and print the result to your console

Code:
printf("Error: 0x%X", GetLastError())
Ok Thanks everyone for answers, I have it now.
Posts 1–14 of 14 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us