I thought I'd make a thread where people can post snippets and/or tutorials for anyone who wants to develop a MW2 hack.
Get current map name - by Chod
Code:
char * GetCurrentMap( )
{
char * stringData = (char*)0xAC26D8;
int * stringOffsets = (int*) 0xABE62C;
DWORD dwInfo_ValueForKey = 0x449E90;
char * mapIdent = (char *)(stringData + stringOffsets[0]);
if( !*mapIdent )
return "";
char * mapName = "";
char * mapCmd = "mapname";
__asm {
push mapCmd
push mapIdent
call dwInfo_ValueForKey
mov mapName, eax
}
return mapName;
}
Working with 1.0.174