我目前有这个代码:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
DWORD address = 0x94AD28; //Ped Pointer
DWORD offset1 = 0x5F4; //Wanted Pointer
DWORD offset2 = 0x0; //Wanted Counter
DWORD newvalue[] = {1200}; //Four Wanted Stars
HANDLE phandle = NULL;
ReadProcessMemory(phandle, (LPVOID)address, (LPVOID) &address, 4, 0);
address = address + offset1;
ReadProcessMemory(phandle, (LPVOID)address, (LPVOID) &address, 4, 0);
address = address + offset2;
WriteProcessMemory(phandle, (LPVOID)address, (LPVOID) &newvalue, 4, 0);
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
注意:想要的指针在 ped 指针块内。
现在,我认为这会在开始新游戏时为玩家 4 提供想要的开始,因为它在我在控制台中执行时有效,但我了解到我需要挂钩在玩家加载时发生的游戏功能,然后打电话给我的代码。
这样在定义播放器时调用代码并更改内存地址。我还读到您不使用 Write/Read/ProcessMemory?
如果有人能解决这个问题并指导我,我将不胜感激。我是这方面的真正初学者。谢谢你。