SAMP ReadProcessMemory

Posts 1–3 of 3 · Page 1 of 1
SAMP ReadProcessMemory
Why this doesn't work?

[HTML]
DWORD PlayerPointer = 0xB6F5F0;
DWORD HealthOffset = 0x544;

ReadProcessMemory(hProc, (LPVOID*)(PlayerPointer + HealthOffset), &f, sizeof(float), NULL);[/HTML]

ht tp://ww w.gtamodding.co m/?title=Memory_Addresses_%28SA%29#General

0xB6F5F0 - Player pointer (CPed)
CPed +0x540 = [float] Health
I've never done external hacks or games without static addresses but my guess would be that you need to add the game's base address. So it becomes :

Code:
ReadProcessMemory(hProc, (LPVOID*)((DWORD)GetModuleHandle(0) + PlayerPointer + HealthOffset), &f, sizeof(float), NULL);
You need a better understanding of how pointers work.
Since I'm too lazy to explain, I'll leave you to google.

Code:
// N.B. This differs from multi-level points as it requires multiple ReadProcessMemory's.
DWORD PlayerPointer = 0xB6F5F0;
DWORD HealthOffset = 0x544;

DWORD ptrOffs = 0, out = 0;
if(ReadProcessMemory(hProc, LPCVOID(PlayerPointer), &ptrOffs, sizeof(DWORD), &out) && ( ptrOffs += HealthOffset, ReadProcessMemory(hProc, LPCVOID(ptrOffs), &f, sizeof(float), &out) )
   Alert( "Read memory: [ %f ]", f );
else
   Alert( "RPM returned false!" );
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us