2016-04-04 1 views
0

私はC++を使ってcs:sのボットカンニングを行うチュートリアル(https://www.youtube.com/watch?v=RiS-j_ecG0A)に従った。チュートリアルでは、チートはエンジンを呼び出してプレーヤーをジャンプさせ、スペースバーを使用して切り替えます。私はそれを使わずに、スペースバープレスをシミュレートしてプレイヤーをジャンプさせようとしましたが、動作しません。私はまた、スペースバーを持っているときだけ、BunnyHop()の(GetAsyncKeyState(SPACE_BAR))のinfrontの間に使うべきかどうかを知っていません。Bhopハックのためにスペースバープレスをゲームに送ろう

#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
SendKeys.Send("{SPACE BAR}"); 

これを試してみてください。

関連する問題