Need help with reading memory.

Posts 1–2 of 2 · Page 1 of 1
Need help with reading memory.
So i'm attempting to read the games memory, which works fine when done a certain way, but doesn't work in another way that it should. It is hard to explain so I will just post code.

WORKING CODE
Code:
DWORD localPlayer = mem.ReadMem<DWORD>(clientDLL + dwLocalPlayer);
int crosshairID = mem.ReadMem<int>(localPlayer + iCrosshairID);
NOT WORKING CODE
Code:
int crosshairID = mem.ReadMem<int>(clientDLL + dwLocalPlayer + iCrosshairID);
From what I can see, they should both be identical. But the second one does not work correctly while the first does. Any help?

EDIT: I'm an idiot. Can a mod close this?
That's because the localPlayer offset + client.dll = pointer to a location in the memory which is LocalPlayer. LocalPlayer + m_iCrosshairID is your crosshair id.

Code:
int crosshairID = mem.Readmem<int>(mem.Readmem(clientDLL + dwLocalPlayer) + iCrosshairID);
That's how you make it in one line but it's not really efficient.

- - - Updated - - -

Quote Originally Posted by deathstrike1313 View Post
EDIT: I'm an idiot. Can a mod close this?

Oops didn't see that xD, on my phone now.
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us