Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <windows.h>
- POINT Center, CurPos;
- bool FirstTime=true;
- int SendKeyPress(unsigned short KeyCode, bool IsDown);
- int main()
- {
- printf("Mouse4 to set strafe center point");
- while(true)
- {
- if(GetAsyncKeyState(VK_XBUTTON1) & (1 << 15))
- {
- if(FirstTime)
- {
- GetCursorPos(&Center);
- FirstTime=false;
- printf("Strafebot activated\nHold Mouse4 to strafe\nThis is made by ongiK @hf\nCompiled this source for d3scene members - Atex");
- MessageBox(NULL, "Center Position Set", "Strafe Bot", NULL);
- }
- GetCursorPos(&CurPos);
- if(CurPos.x > Center.x)
- {
- SendKeyPress(0x20, true);
- Sleep(1);
- SendKeyPress(0x20, false);
- }
- else if(CurPos.x < Center.x)
- {
- SendKeyPress(0x1e, true);
- Sleep(1);
- SendKeyPress(0x1e, false);
- }
- }
- }
- return 0;
- }
- int SendKeyPress(unsigned short KeyCode, bool KeyDown)
- {
- INPUT InputData;
- InputData.type =INPUT_KEYBOARD;
- InputData.ki.wScan =KeyCode;
- InputData.ki.time = time(NULL));
- InputData.ki.dwExtraInfo = 0;
- if(KeyDown)
- InputData.ki.dwFlags = KEYEVENTF_SCANCODE;
- else
- InputData.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
- return SendInput(1, &InputData, sizeof(InputData));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement