I have a little problem with my simple and stupid farm bot for a game.
The bot need to read current Hp and the map ID.
These are my functions for doing so.
Code:
DWORD getCurrentHp()
{
return *(DWORD*)(*(DWORD*)hpBaseAdress + hpOffset);
}
DWORD getCurrentMapID()
{
return *(DWORD*)(*(DWORD*)mapBaseAddress);
}
Code:
//HP
DWORD currHp2 = getCurrentHp();
if (currHp2 != currHp)
{
char hp[10];
sprintf_s(Hp, "%i", currHp2);
SetWindowText(GetDlgItem(HackInterface, hpEdit), hp);
currHp = currHp2;
}
if (currHp < hpLimit)
{
//restore hp.
}
Code:
//Map ID DWORD currMapID = getCurrentMapID(); char mapID[10]; sprintf_s(mapID, "%i", currMapID); SetWindowText(GetDlgItem(HackInterface, mapEdit), mapID);
I know that the HP is from an INT and technically the mapID is an byte, but it doesn't matter if I make the address a byte/2 byte or 4 byte in cheat engine, the value stays the same.
My game crashes when I inject the dll and tries to get the mapID.
So, any hints on what I do wrong? :P






