Solved Getting player HP in assault cube

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

rocketchroma

Newbie
Full Member
Feb 24, 2017
5
188
0
So I'm just learning at the moment, and i've created a DLL that I inject into assault cube and all I want is a console window to tell me my HP

I already know that the address of the HP is "0x0290AC88" but how can I get the value of it?

I call the Init() function when the DLL is injected

C++:
DWORD GetBaseAddress()
{
	return (DWORD)GetModuleHandle(NULL);
}

void Init()
{
	AllocConsole();

	std::freopen("COIN$", "r", stdin);
	std::freopen("CONOUT$", "w", stdout);

	SetConsoleTitle("Debug");
	std::cout << "BASE ADDRESS: " << std::hex << GetBaseAddress() << std::endl;

	DWORD playerHP = 0x0290AC88;

}
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
Is that address valid when you check it?
Like Rake said, that seems to be a dynamic address, meaning it changes every time you enter a new game or restart the game.

Usually, you'll want to resolve the player base address and from there you'd resolve the address for the health variable by adding the offset.

For example, the local player pointer in Assault Cube is at ac_client.exe + 0x10F4F4.
So you'd add 0x10F4F4 to the base address of ac_client.exe and read the value. The value is the base address of your local player.
From here, you'd add the offset to the player base to get the address of your health.

Example.
C++:
void Init()
{
     DWORD dwModBase = (DWORD)GetModuleHandle(NULL); // Get ac_client.exe module base
     DWORD dwPlayerBase = *(DWORD*)(dwModeBase + 0x10F4F4); // Get local player base address.
     int iPlayerHealth = *(int*)(dwPlayerBase + 0xF8); // Add the offset to the health address and read the value stored in the address
}
And I'm sure you can figure out the rest.
 

Lukor

ded
Meme Tier VIP
Fleep Tier Donator
Dec 13, 2013
488
5,353
25
You might want to check out the tutorials again.
What you are searching for is called dereferencing pointers.
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
If you already have the address then like Lukor said you just cast it into a pointer and dereference.

So in your case you can have something like this at the bottom
C++:
int Health = *(int*)playerHP;
Notice the (int*) is casting the playerHP variable as a pointer, an int pointer to be exact and the the * before all that reads the value pointed at by the pointer. Derefrencing.
 

rocketchroma

Newbie
Full Member
Feb 24, 2017
5
188
0
Thanks for the insight guys, I have progressed, however I can't get it to output the value of my hp

It says 0



C++:
DWORD GetBaseAddress()
{
	return (DWORD)GetModuleHandle(NULL);
}

void Init()
{
	AllocConsole();

	DWORD moduleBase = GetBaseAddress();
	DWORD playerHP = moduleBase + 0x0264AC88;

	std::freopen("COIN$", "r", stdin);
	std::freopen("CONOUT$", "w", stdout);

	SetConsoleTitle("Debug");
	std::cout << "BASE ADDRESS: " << std::hex << moduleBase << std::endl;

	int notHealth = *(int*)(playerHP);

	std::cout << "Health value is: " << notHealth << std::endl;

}
 

Roman_Ablo

Banned
Feb 27, 2017
355
2,402
1
Fun fact: I have no idea if these codes actually work for you but here they are anyway 'cause I gotta farm those posts, ya know?
C++:
#define Module GetModuleHandleA(nullptr)
#define Address (void*)(Module + 0x0264AC88)
void Init(){
	DWORD HealthAddy = reinterpret_cast<DWORD>(reinterpret_cast<DWORD>(Address)) + 0xF8);
	int Health = *reinterpret_cast<int*>(playerHP);
}
 

rocketchroma

Newbie
Full Member
Feb 24, 2017
5
188
0
Is that address valid when you check it?
Like Rake said, that seems to be a dynamic address, meaning it changes every time you enter a new game or restart the game.

Usually, you'll want to resolve the player base address and from there you'd resolve the address for the health variable by adding the offset.

For example, the local player pointer in Assault Cube is at ac_client.exe + 0x10F4F4.
So you'd add 0x10F4F4 to the base address of ac_client.exe and read the value. The value is the base address of your local player.
From here, you'd add the offset to the player base to get the address of your health.

Example.
C++:
void Init()
{
     DWORD dwModBase = (DWORD)GetModuleHandle(NULL); // Get ac_client.exe module base
     DWORD dwPlayerBase = *(DWORD*)(dwModeBase + 0x10F4F4); // Get local player base address.
     int iPlayerHealth = *(int*)(dwPlayerBase + 0xF8); // Add the offset to the health address and read the value stored in the address
}
And I'm sure you can figure out the rest.
Thanks this is working perfectly

If I wanted the console to update when I took damage, would the best way be to hook a function?
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,074
78,998
2,371
Thanks this is working perfectly

If I wanted the console to update when I took damage, would the best way be to hook a function?
Hook a function that gets called every frame, such as SwapBuffers is good or make a seperate thread and make an infinite loop in it
 
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