Skip to content

Instantly share code, notes, and snippets.

@dantheman213
Last active April 29, 2018 21:11
Show Gist options
  • Select an option

  • Save dantheman213/d7801ececf4379b15797f75c099301ef to your computer and use it in GitHub Desktop.

Select an option

Save dantheman213/d7801ececf4379b15797f75c099301ef to your computer and use it in GitHub Desktop.
LeagueHelperUrf - League of Legends Urf Mode Assist. Spam the QWER keys as fast as possible using C++.
#include <iostream>
#include <thread>
#include <windows.h>
#include <conio.h>
const WORD keyCodes[4] = {
0x51, // Q
0x57, // W
0x45, // E
0x52 // R
};
const int waitTimeMillis = 1000;
const int keyRepeatTimeMillis = 100;
bool isRunning = true;
bool isSpamModeRegActivated = false; // ALL BUT ULT
bool isSpamModeUltActivated = false; // ALL WITH ULT
using namespace std;
void checkInputs() {
if (GetKeyState(VK_F6) & 0x8000) {
isSpamModeRegActivated = !isSpamModeRegActivated;
if (isSpamModeRegActivated) {
isSpamModeUltActivated = false;
}
printf("Spam mode WITHOUT ULT has been %s.\n", ((isSpamModeRegActivated) ? "activated" : "deactivated"));
Sleep(waitTimeMillis);
}
if (GetKeyState(VK_F7) & 0x8000) {
isSpamModeUltActivated = !isSpamModeUltActivated;
printf("Spam mode WITH ULT has been %s.\n", ((isSpamModeUltActivated) ? "activated" : "deactivated"));
if (isSpamModeUltActivated) {
isSpamModeRegActivated = false;
}
Sleep(waitTimeMillis);
}
if (GetKeyState(VK_F8) & 0x8000) {
isRunning = false;
printf("Exiting...\n");
Sleep(waitTimeMillis);
}
}
void spamKeys(bool includeUlt) {
int length = size(keyCodes);
if(!includeUlt)
length--;
for (int i = 0; i < length; i++) {
INPUT input;
WORD vkey = keyCodes[i];
input.type = INPUT_KEYBOARD;
input.ki.wScan = MapVirtualKey(vkey, MAPVK_VK_TO_VSC);
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
input.ki.wVk = vkey;
input.ki.dwFlags = 0; // there is no KEYEVENTF_KEYDOWN
SendInput(1, &input, sizeof(INPUT));
Sleep(50);
input.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &input, sizeof(INPUT));
Sleep(50);
}
Sleep(keyRepeatTimeMillis);
}
void doActions() {
while (isRunning) {
if (isSpamModeUltActivated) {
spamKeys(true);
}
if (isSpamModeRegActivated) {
spamKeys(false);
}
}
}
int main() {
printf("Welcome to League Helper - Urf Mode!\n\n");
printf("F6 - Activate/deactivate SPAM MODE WITHOUT ULT\n");
printf("F7 - Activate/deactivate SPAM MODE WITH ULT\n");
printf("F8 - Exit program\n\n");
thread actionTimer(doActions);
while (isRunning) {
checkInputs();
}
actionTimer.join();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment