DatPawn Posted March 30, 2014 Share Posted March 30, 2014 (edited) Hello, I will read the Health from my DLL. My DLL: #include <iostream>#include <windows.h>using namespace std;extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);DWORD PlayerPointer = 0xB6F5F0;DWORD HealthOffset = 0x540;//MemoryDWORD pid; //Process IDHWND hwnd; //handleint checkGTAProcess(){ hwnd = FindWindow(NULL, L"GTA:SA:MP"); if (!hwnd) { return -1; } else { return 1; }};extern "C" __declspec(dllexport) float samp_health(){ if (checkGTAProcess() == -1) return -1; float value; hwnd = FindWindow(NULL, L"GTA:SA:MP"); GetWindowThreadProcessId(hwnd, &pid); HANDLE open = OpenProcess(PROCESS_VM_READ, false, pid); ReadProcessMemory(open, (LPVOID)(PlayerPointer + HealthOffset), &value, sizeof(value), NULL); CloseHandle(open); return value;} Everytime I get 0.0000. Why? Edited March 30, 2014 by DatPawn Link to comment Share on other sites More sharing options...
Silent Posted March 30, 2014 Share Posted March 30, 2014 Sounds like you're trying to cheat? Link to comment Share on other sites More sharing options...
DatPawn Posted March 30, 2014 Author Share Posted March 30, 2014 Sounds like you're trying to cheat? No, I will read my Health from GTA:SA. (SAMP) Link to comment Share on other sites More sharing options...
Silent Posted March 30, 2014 Share Posted March 30, 2014 (edited) 0xB6F5F0 holds a pointer to CPed and you're treating it as if there was a CPed struct at that address. Edited March 30, 2014 by Silent DatPawn 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now