AssaultCube Ammo Memory Reading

Posts 1–13 of 13 · Page 1 of 1
AssaultCube Ammo Memory Reading
Hey guys! I am trying to make a program that reads the ammo, i think something is wrong with the offsets and base address. It would be insanely helpful if someone could help me

Code:
#include <iostream>
#include <Windows.h>

using namespace std;



int main()
{
	HWND hwnd = FindWindow(NULL, "AssaultCube");

	if (!hwnd)
	{
		cout << "Window could not be found.\n";
		system("PAUSE");
	}
	else
	{
		cout << "Window found\n";

		DWORD pId;

		GetWindowThreadProcessId(hwnd, &pId);

		HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);

		if (!hProc)
		{
			cout << "Process could not be opened\n";
			system("PAUSE");
		}
		else
		{
			cout << "Process opened, all access.\n";

			DWORD address = 0x004DF73C;
			DWORD pointed1, pointed2, pointed3;
			WORD offset1 = 0x0;
			WORD offset2 = 0x14;
			WORD offset3 = 0x378;
			int currentAmmo;

			while (1) {
				ReadProcessMemory(hProc, (LPCVOID)(address), &pointed1, 4, NULL);
				ReadProcessMemory(hProc, (LPCVOID)(pointed1 + offset1), &pointed2, 4, NULL);
				ReadProcessMemory(hProc, (LPCVOID)(pointed2 + offset2), &pointed3, 4, NULL);
				ReadProcessMemory(hProc, (LPCVOID)(pointed3 + offset3), &currentAmmo, 4, NULL);
				

				cout << "Your current ammo is " << currentAmmo << endl;
				Sleep(9999);
			}


		}
	}
	cin.get();
	return 0;
}
Quote Originally Posted by samlarenskoog View Post
Hey guys! I am trying to make a program that reads the ammo, i think something is wrong with the offsets and base address. It would be insanely helpful if someone could help me

Code:
#include <iostream>
#include <Windows.h>

using namespace std;



int main()
{
	HWND hwnd = FindWindow(NULL, "AssaultCube");

	if (!hwnd)
	{
		cout << "Window could not be found.\n";
		system("PAUSE");
	}
	else
	{
		cout << "Window found\n";

		DWORD pId;

		GetWindowThreadProcessId(hwnd, &pId);

		HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);

		if (!hProc)
		{
			cout << "Process could not be opened\n";
			system("PAUSE");
		}
		else
		{
			cout << "Process opened, all access.\n";

			DWORD address = 0x004DF73C;
			DWORD pointed1, pointed2, pointed3;
			WORD offset1 = 0x0;
			WORD offset2 = 0x14;
			WORD offset3 = 0x378;
			int currentAmmo;

			while (1) {
				ReadProcessMemory(hProc, (LPCVOID)(address), &pointed1, 4, NULL);
				ReadProcessMemory(hProc, (LPCVOID)(pointed1 + offset1), &pointed2, 4, NULL);
				ReadProcessMemory(hProc, (LPCVOID)(pointed2 + offset2), &pointed3, 4, NULL);
				ReadProcessMemory(hProc, (LPCVOID)(pointed3 + offset3), ¤tAmmo, 4, NULL);
				

				cout << "Your current ammo is " << currentAmmo << endl;
				Sleep(9999);
			}


		}
	}
	cin.get();
	return 0;
}
Could you explain what actually isn't working? Compile error? Crashes? Anything?
Quote Originally Posted by Sammy View Post
Could you explain what actually isn't working? Compile error? Crashes? Anything?
Its the address that is the problem, I think I need a base address. I have no idea how to get it though, shouldn't it work if the address I use is static?
Quote Originally Posted by samlarenskoog View Post
Its the address that is the problem, I think I need a base address. I have no idea how to get it though, shouldn't it work if the address I use is static?
you'll need to find a base address yes, a green addr in cheat engine. Do you got that? Save it and reload the game to see if it still shows the right value
Quote Originally Posted by Sammy View Post
you'll need to find a base address yes, a green addr in cheat engine. Do you got that? Save it and reload the game to see if it still shows the right value
Aren't the base address and offsets the same for everyone? Are there any places online where I can find for example csgo base addresses?
Quote Originally Posted by samlarenskoog View Post
Aren't the base address and offsets the same for everyone? Are there any places online where I can find for example csgo base addresses?
I think the best is to find them yourselves. Do some cheat engine tutorials and learn about multilevel pointers.
Quote Originally Posted by Sammy View Post
I think the best is to find them yourselves. Do some cheat engine tutorials and learn about multilevel pointers.
Does adding offsets work on both of these ways?

ReadProcessMemory(hProc, (LPCVOID)(address), &pointed1, 4, NULL);
ReadProcessMemory(hProc, (LPCVOID)(pointed1 + offset1), &pointed2, 4, NULL);
ReadProcessMemory(hProc, (LPCVOID)(pointed2 + offset2), &pointed3, 4, NULL);
ReadProcessMemory(hProc, (LPCVOID)(pointed3 + offset3), &currentAmmo, 4, NULL);
---------------------------------------------------------------------------------------------------
ReadProcessMemory(hProc, (LPCVOID)(address + offset1 + offset2+ offset3), &currentAmmo, 4, NULL);
Quote Originally Posted by samlarenskoog View Post
Does adding offsets work on both of these ways?

ReadProcessMemory(hProc, (LPCVOID)(address), &pointed1, 4, NULL);
ReadProcessMemory(hProc, (LPCVOID)(pointed1 + offset1), &pointed2, 4, NULL);
ReadProcessMemory(hProc, (LPCVOID)(pointed2 + offset2), &pointed3, 4, NULL);
ReadProcessMemory(hProc, (LPCVOID)(pointed3 + offset3), ¤tAmmo, 4, NULL);
---------------------------------------------------------------------------------------------------
ReadProcessMemory(hProc, (LPCVOID)(address + offset1 + offset2+ offset3), ¤tAmmo, 4, NULL);

Alright I'm a little rusty on c++ and memory editing but yea, I do think this is a correct way to get the right address. Do you know how to find a multilevel pointer with cheat engine?
Quote Originally Posted by Sammy View Post
Alright I'm a little rusty on c++ and memory editing but yea, I do think this is a correct way to get the right address. Do you know how to find a multilevel pointer with cheat engine?
Yes, but I dont really know if something is wrong with the code
Quote Originally Posted by samlarenskoog View Post
Yes, but I dont really know if something is wrong with the code
I recommend learning about multi level pointers from cheat engine
Google "Assault Cube Addys" and your answer will be the first thing that will pop up. Also, make the names of the dword and offset vars more understandable then just 1,2,3.
Quote Originally Posted by romponu View Post
Google "Assault Cube Addys" and your answer will be the first thing that will pop up. Also, make the names of the dword and offset vars more understandable then just 1,2,3.
He is just trying to learn at the moment, although it's a good tip. Not very necessary in this case.
You don´t need to use offsets to get this address and you don´t need to do this externally.

For example :

Code:
#define Ammo 0x4637E9 // FF 0E

ReadMemory((void*)Ammo,0x90,2);
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us