我按照教程(https://www.youtube.com/watch?v=RiS-j_ecG0A)使用c ++为cs:s做了一个bhop作弊。在教程中,作弊使引擎调用以使玩家跳跃,并使用空格键切换。我尝试不使用它并尝试模拟空格键按下以使玩家跳跃,但它不起作用。我也尝试制作我的作弊bhop只有在拿着空格键并且不知道我是否应该使用while或者如果在BunnyHop()中使用(GetAsyncKeyState(SPACE_BAR))。
#include <Windows.h>
#include <iostream>
#include "HackProcess.h"
CHackProcess fProcess;
using namespace std;
const DWORD Player_Base = 0x4C6708;
const DWORD dw_JumpOffset = 0x350;
#define FL_ONGROUND 257
#define SPACE_BAR 0x20
#define F6_KEY 0x75
bool b_true = true;
bool b_false = false;
bool BunnyHopStatus = false;
struct MyPlayer_t
{
DWORD ClocalPlayer;
int m_fFlags;
void ReadInformation()
{
ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*) (fProcess.__dwordClient + Player_Base), &ClocalPlayer, sizeof(DWORD), 0);
ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(ClocalPlayer + dw_JumpOffset), &m_fFlags, sizeof(int), 0);
}
}MyPlayer;
void BunnyHop()
{
INPUT space = {0};
space.type = INPUT_KEYBOARD;
space.ki.wVk = VK_SPACE;
if(GetAsyncKeyState(SPACE_BAR))
{
if(MyPlayer.m_fFlags == FL_ONGROUND)
{
SendInput(1, &space, sizeof(INPUT)); // Send KeyDown
space.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &space, sizeof(INPUT)); // Send KeyUp
cout << "player on ground" << endl; //added for debugging
}else
{
cout << "player whatever" << endl; //added for debugging
}
}
}
int main()
{
fProcess.RunProcess();
cout << "Game Found! Running Bunny Hop..." << endl;
while(!GetAsyncKeyState(F6_KEY))
{
MyPlayer.ReadInformation();
BunnyHop();
}
}
(HackProcess.h:http://pastebin.com/vVauF3dS)
答案 0 :(得分:0)
SendKeys.Send("{SPACE BAR}");
Try this.