Ok, so i just tried dereferencing the pointer and changing the value of the health but the game crashes. I don't know why. This is my code:
Code:
#include <Windows.h>
#include <iostream>
#include "player.h"
void hack();
DWORD base = (DWORD)GetModuleHandle(TEXT("ac_client.exe"));
DWORD *playerStruct = (DWORD*)(base + 0x4E4DBC);
int *hpPtr = (int*)(playerStruct + 0xF4);
player *me = *(player**)0x4E4DBC;
float zpos;
float xsaved;
float ysaved;
float zsaved;
void hack()
{
*hpPtr = 200;
while(true)
{
if(GetAsyncKeyState(VK_SPACE)&1)
{
me->z += 5;
zpos = me->z;
while(!GetAsyncKeyState(VK_NUMPAD1)&1)
{
if(GetAsyncKeyState(VK_SPACE)&1)
{
me->z+= 5;
zpos = me->z;
}
me->z = zpos;
}
}
if(GetAsyncKeyState(VK_SHIFT)&1)
{
me->z -= 5;
}
if(GetAsyncKeyState(VK_LEFT)&1)
{
me->x -= 5;
}
if(GetAsyncKeyState(VK_RIGHT)&1)
{
me->x += 5;
}
if(GetAsyncKeyState(VK_UP)&1)
{
me->y += 5;
}
if(GetAsyncKeyState(VK_DOWN)&1)
{
me->y -= 5;
}
if(GetAsyncKeyState(VK_NUMPAD8)&1)
{
xsaved = me->x;
ysaved = me->y;
zsaved = me->z;
}
if(GetAsyncKeyState(VK_NUMPAD9)&1)
{
me->x = xsaved;
me->y = ysaved;
me->z = zsaved;
}
}
}
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
CreateThread(NULL, NULL,(LPTHREAD_START_ROUTINE)hack, NULL, NULL, NULL);
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
/* Returns TRUE on success, FALSE on failure */
return TRUE;
}
@Jason
@Hassan