所以我正在尝试为dayz创建一个autowalk / run程序。我当前的脚本似乎可以用于将'w'键发送到除dayz之外的任何内容。我将如何制作运行脚本或修改我当前的代码?
#include <iostream>
#define _WIN32_WINNT 0x0500
#include "windows.h"
using namespace std;
void pressW(bool x){
INPUT ip;
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0x57;
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
ip.ki.wVk = 0; //Hex code for 'W'
ip.ki.dwFlags = KEYEVENTF_UNICODE; //Press the key down ?
SendInput(1, &ip, sizeof(ip)); //Use function
Sleep(10); //Sleep so it doesn't spam the key press
//ip.ki.dwFlags = KEYEVENTF_KEYUP; //Release the key
//SendInput(1, &ip, sizeof(ip)); //Use function
}
void releaseW(){
}
int main()
{
bool run = false;
while(true){
if(GetAsyncKeyState(VK_INSERT)){run = !run;}
while(run){
pressW(run);
if(GetAsyncKeyState(VK_HOME)){run = !run;}
}
}
return 0;
}