gpt4 book ai didi

c++ - 如何使2个功能起作用,而不是仅1个起作用

转载 作者:行者123 更新时间:2023-12-02 10:22:56 25 4
gpt4 key购买 nike

我有2个void函数和一个主要函数。

但是由于第一个函数具有while(true),因此它始终可以工作,并且由于第二个函数不起作用。如何使其同时工作?

   void shoot()
{
*(DWORD*)(val.gameModule + offsets.ForceAttack, 5);
Sleep(5000);
*(DWORD*)(val.gameModule + offsets.ForceAttack, 4);
}

void bunny()
{


val.gameModule = (DWORD)GetModuleHandle("client_panorama.dll");

std::cout << (GetModuleHandle("client_panorama.dll")) << std::endl;;
val.localPlayer = *(DWORD*)(val.gameModule + offsets.lplayer);
while (true)
{
if (bunnyON == 1);
else
return;
val.flag = *(BYTE*)(val.localPlayer + offsets.flags);
if (isMoving())
if (GetAsyncKeyState(VK_SPACE) && val.flag & (1 << 0))
* (DWORD*)(val.gameModule + offsets.jump) = 6;
}
}




int main()
{


bunny();
shoot();
}
`

最佳答案

尝试执行此操作,并检查这是否是您需要的:

#include <thread>

void shoot()
{
*(DWORD*)(val.gameModule + offsets.ForceAttack, 5);
Sleep(5000);
*(DWORD*)(val.gameModule + offsets.ForceAttack, 4);
}

void bunny()
{
val.gameModule = (DWORD)GetModuleHandle("client_panorama.dll");

std::cout << (GetModuleHandle("client_panorama.dll")) << std::endl;;
val.localPlayer = *(DWORD*)(val.gameModule + offsets.lplayer);
while (true)
{
if (bunnyON == 1);
else
return;
val.flag = *(BYTE*)(val.localPlayer + offsets.flags);
if (isMoving())
if (GetAsyncKeyState(VK_SPACE) && val.flag & (1 << 0))
* (DWORD*)(val.gameModule + offsets.jump) = 6;
}
}

int main()
{
std::thread t1(bunny);
std::thread t2(shoot);

t1.join();
t2.join();

return 0;
}

关于c++ - 如何使2个功能起作用,而不是仅1个起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59287597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com