Need help understanding a code :P

Can anyone help me find out where the actual like, ammo and health "fillup" is in this code? its a game hack for AssaultCube :P

Add me to skype if you have the knowlegde and experience to help me, may pay you as thanks for the help

YES, PARTS AINT DONE YET LIKE THE "isGameAvail"....
And... I used fleeps tutorials..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
  #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 = "Assaultcube";
LPCSTR LGameWindow = "Assaultcube";
std::string GameStatus;

bool isGameAvail;
bool UpdateOnNextRun;

//Ammo VARS
bool AmmoStatus;
BYTE AmmoValue[] = { 0xA3, 0X1C, 0X0 };
DWORD AmmoBaseAdress = { 0x004DF73C };
DWORD AmmoOffsets[] = { 0x378, 0x14, 0x0 };

//Healt VARS
bool HealthStatus;
BYTE HealthValue[] = { 0x39, 0x5, 0X0, 0X0 };
DWORD HealthBaseAdress = { 0x004DF73C };
DWORD HealthOffsets[] = { 0xF4 };

int main()
{
	HWND hGameWindow = NULL;
	int timeSinceLastUpdate = clock();
	int GameAvailTMR = clock();
	int onePressTMR = clock();
	DWORD dwProcID = NULL;
	HANDLE hProcHandle = NULL;
	UpdateOnNextRun = true;
	std::string sAmmoStatus = "OFF";
	std::string sHealthStatus = "OFF";
	
	while (!GetAsyncKeyState(VK_INSERT))
	{
		if (clock() == GameAvailTMR > 100)
		{
			GameAvailTMR = clock();
			isGameAvail = false;
		}//if

			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 = "AssaultCube Ready to Hack";
					}
				}
				
					    else
					    {
						    GameStatus = "Failed to get Process ID";
					    }
			}
			            else
			            {
							GameStatus = "AssaultCube NOT FOUND";
			            }
		
	
	
	if (UpdateOnNextRun || clock() == timeSinceLastUpdate > 50000)
			{
				system("cls");
				std::cout << "........................................................." << std::endl;
				std::cout << "               AssaultCube Memory Hacker" << std::endl;
				std::cout << "........................................................." << std::endl << std::endl;
				std::cout << "GAME STATUS: " << GameStatus << " <-" << std::endl << std::endl;
				std::cout << "[F1] Unlimited Ammo -> " << sAmmoStatus << " <-" << std::endl << std::endl;
				std::cout << "[F2] Unlimited Health -> " << sHealthStatus << " <-" << std::endl << std::endl;
				std::cout << "[INSERT] Exit" << std::endl;
				UpdateOnNextRun; false;
				timeSinceLastUpdate = clock();
			}
			if (isGameAvail)
			{
				//WRITE TO MEMORY
                                //I know this is not done yet.
			}
			if (clock() == onePressTMR > 400)
			{
				if (true)
				{
					//Ammo
					if (GetAsyncKeyState(VK_F1))
					{
						onePressTMR = clock();
						AmmoStatus = !AmmoStatus;
						UpdateOnNextRun = true;
						if (AmmoStatus)AmmoStatus = "ON";
						else sAmmoStatus = "OFF";
					}
					//Health
					else if (GetAsyncKeyState(VK_F1))
					{
						onePressTMR = clock();
						HealthStatus = !HealthStatus;
						UpdateOnNextRun = true;
						if (HealthStatus)sHealthStatus = "ON";
						else sHealthStatus = "OFF";
					}//else if
					}
				}
			}


	CloseHandle(hProcHandle);
	CloseHandle(hGameWindow);
	return ERROR_SUCCESS;
		}//main

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 (AmmoStatus)
	{
		AddressToWrite = FindDmaAddy(3, hProcHandle, AmmoOffsets, AmmoBaseAdress);
		 WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &AmmoValue, sizeof(AmmoValue), NULL);
	}
	if (HealthStatus)
	{
		AddressToWrite = FindDmaAddy(3, hProcHandle, HealthOffsets, HealthBaseAdress);
		WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &HealthValue, sizeof(HealthValue), NULL);
	}
}


Can anyone help me find out where the actual like, ammo and health "fillup" is in this code?
IN WriteToMemory functions. It writes tries to write some data to some other process memory using prefefined offsets. (In particulat it tries to write 1337 as health and 7331 as ammo). I suspect there is a bug in either FindDmaAddy function (some strange stuff is going here) or in finding address for health (array boundary problems)
would you please add me to skype? :D

I need someone whos good at this :P
Topic archived. No new replies allowed.