Results 1 to 3 of 3
  1. #1
    asqapro's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    228
    Reputation
    18
    Thanks
    1,686
    My Mood
    Tired

    Macro Pack + Spammer Source [C++]

    Spammer:

    Code:
    #include <iostream>
    #include <windows.h>
    #include <winable.h>
    #include <map>
    #include <algorithm>
    #define Winver 0x500
    
    using namespace std;
    
    void Generate_Key(int key, bool shift){
        INPUT input;
        if(shift){
            input.type = INPUT_KEYBOARD;
            input.ki.wScan = 0;
            input.ki.time = 0;
            input.ki.dwExtraInfo = 0;
            input.ki.wVk = VK_SHIFT;
            SendInput(1, &input, sizeof(INPUT));
        }
        input.type = INPUT_KEYBOARD;
        input.ki.wScan = 0;
        input.ki.time = 0;
        input.ki.dwExtraInfo = 0;
        input.ki.wVk = key;
        SendInput(1, &input, sizeof(INPUT));
    
        input.ki.dwFlags = KEYEVENTF_KEYUP;
        SendInput(1, &input, sizeof(INPUT));
        if(shift){
            input.type = INPUT_KEYBOARD;
            input.ki.wScan = 0;
            input.ki.time = 0;
            input.ki.dwExtraInfo = 0;
            input.ki.wVk = VK_SHIFT;
            input.ki.dwFlags = KEYEVENTF_KEYUP;
            SendInput(1, &input, sizeof(INPUT));
        }
    }
    
    int main()
    {
        int sleep_time = 1000;
        cout << "Wait how long between each message? (in milliseconds) ";
        cin >> sleep_time;
        map<string, int> keycodes;
        keycodes.insert(make_pair("a", 0x41)); //map of letters and virtual keys
        keycodes.insert(make_pair("b", 0x42));
        keycodes.insert(make_pair("c", 0x43));
        keycodes.insert(make_pair("d", 0x44));
        keycodes.insert(make_pair("e", 0x45));
        keycodes.insert(make_pair("f", 0x46));
        keycodes.insert(make_pair("g", 0x47));
        keycodes.insert(make_pair("h", 0x48));
        keycodes.insert(make_pair("i", 0x49));
        keycodes.insert(make_pair("j", 0x4A));
        keycodes.insert(make_pair("k", 0x4B));
        keycodes.insert(make_pair("l", 0x4C));
        keycodes.insert(make_pair("m", 0x4D));
        keycodes.insert(make_pair("n", 0x4E));
        keycodes.insert(make_pair("o", 0x4F));
        keycodes.insert(make_pair("p", 0x50));
        keycodes.insert(make_pair("q", 0x51));
        keycodes.insert(make_pair("r", 0x52));
        keycodes.insert(make_pair("s", 0x53));
        keycodes.insert(make_pair("t", 0x54));
        keycodes.insert(make_pair("u", 0x55));
        keycodes.insert(make_pair("v", 0x56));
        keycodes.insert(make_pair("w", 0x57));
        keycodes.insert(make_pair("x", 0x58));
        keycodes.insert(make_pair("y", 0x59));
        keycodes.insert(make_pair("z", 0x5A));
        keycodes.insert(make_pair(" ", VK_SPACE));
        string phrase = "";
        while(phrase == ""){ //make sure they enter something
            cin.clear();cin.sync();
            cout << "Enter the phrase you wish to spam: ";
            getline(cin, phrase);
        }
        string upper_alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        string phrase_copy = phrase; //save the phrase 
        while(true){
            if((GetKeyState(VK_HOME) & 0x80) != 0){
                Sleep(50);
                while(true){
                    Generate_Key(VK_RETURN, false); //in-lobby does nothing, but in-game it opens the chat box
                    Sleep(50);
                    for(unsigned int iter = 0; iter < phrase.length(); iter++){ //loop through the string
                        string letter(1, phrase[iter]); //turn each char in the string into a string
                        if(upper_alpha.find(letter) != string::npos){ //if the letter is found in the uppercase letters
                            transform(phrase.begin(), phrase.end(), phrase.begin(), ::tolower); //revert the entire string to lowercase (I should do 1 letter, but bleh, I did this quick and dirty) so it can be found in the map
                            string letter(1, phrase[iter]); //convert that letter back to a string
                            Generate_Key(keycodes.find(letter)->second, true); //find the letter's keycode, and generate it along with shift
                            phrase = phrase_copy; //restore the phrase
                        }
                        else{ //if the letter is lowercase
                            transform(phrase.begin(), phrase.end(), phrase.begin(), ::tolower); //same stuff
                            string letter(1, phrase[iter]);
                            Generate_Key(keycodes.find(letter)->second, false); //generate it without shift pressed
                            phrase = phrase_copy;
                        }
                        if((GetKeyState(VK_END) & 0x80) != 0){ 
                            break;
                        }
                        Sleep(1);
                    }
                    if((GetKeyState(VK_END) & 0x80) != 0){
                        break;
                    }
                    Generate_Key(VK_RETURN, false); //actually send the phrase
                    int count = 1;
                    while(count < sleep_time){ //this is so the user can end it even when it's pausing between spams
                        Sleep(1);
                        count++;
                        if((GetKeyState(VK_END) & 0x80) != 0){
                            break;
                        }
                    }
                    if(count < sleep_time){ //if the user ended it early, end it completely
                        break;
                    }
                }
                Sleep(1);
            }
        }
        return 0;
    }
    Macro Pack:
    Code:
    #define WINVER 0x0500 //windows version XP or higher
    #include <iostream>
    #include <windows.h>
    #include <time.h>
    #include <winable.h>
    #include <map>
    #include <algorithm> //for looping through the map
    #include <pthread.h> //threading
    #include <ctime> //for the time stuff in the mouse hook
    #include <sys/timeb.h> //time stuff in the mouse hook. These two may not be necessary, I had a different time loop that I was using and forgot to remove these 2
    #include <vector>
    
    using namespace std;
    
    HHOOK mousehook;
    
    bool chat_active = false;
    bool command_active = false;
    
    int qswitch_key;
    //==========================//
    int crouch_key;
    //==========================//
    int walk_key;
    //==========================//
    int scope_speed_milliseconds;
    //==========================//
    bool burst;
    int burst_amount;
    int burst_speed;
    int click_amount;
    //==========================//
    
    void Generate_Key(int key){
        INPUT input;
    
        input.type = INPUT_KEYBOARD;
        input.ki.wScan = 0;
        input.ki.time = 0;
        input.ki.dwExtraInfo = 0;
        input.ki.wVk = key;
        SendInput(1, &input, sizeof(INPUT));
    
        input.ki.dwFlags = KEYEVENTF_KEYUP;
        SendInput(1, &input, sizeof(INPUT));
    }
    
    void Generate_Key_down(int key){
        INPUT input;
    
        input.type = INPUT_KEYBOARD;
        input.ki.wScan = 0;
        input.ki.time = 0;
        input.ki.dwExtraInfo = 0;
        input.ki.wVk = key;
        SendInput(1, &input, sizeof(INPUT));
    }
    
    void Generate_Key_up(int key){
        INPUT input;
    
        input.type = INPUT_KEYBOARD;
        input.ki.wScan = 0;
        input.ki.time = 0;
        input.ki.dwExtraInfo = 0;
        input.ki.wVk = key;
    
        input.ki.dwFlags = KEYEVENTF_KEYUP;
        SendInput(1, &input, sizeof(INPUT));
    }
    
    void unclick(bool middle_or_right){
        INPUT input = {0};
        //input.mi.dwExtraInfo = 0x200;
        input.type = INPUT_MOUSE;
        if(middle_or_right){ //
            input.mi.dwFlags = MOUSEEVENTF_MIDDLEUP;
            SendInput(1, &input, sizeof(INPUT));
        }
        else if(!middle_or_right){
            input.mi.dwFlags = MOUSEEVENTF_RIGHTUP;
            SendInput(1, &input, sizeof(INPUT));
        }
    }
    
    void click(bool middle_or_right){
        INPUT input = {0};
        //input.mi.dwExtraInfo = 0x200;
        input.type = INPUT_MOUSE;
        if(middle_or_right){
            input.mi.dwFlags = MOUSEEVENTF_MIDDLEDOWN;
            SendInput(1, &input, sizeof(INPUT));
        }
        else if(!middle_or_right){
            input.mi.dwFlags = MOUSEEVENTF_RIGHTDOWN;
            SendInput(1, &input, sizeof(INPUT));
        }
    }
    
    void macro_click(){ //this is a separate function because I didn't wanna have to call the click/unclick functions with their parameters for a simple click
        INPUT    input={0};
        // middle down
        input.type      = INPUT_MOUSE;
        input.mi.dwFlags  = MOUSEEVENTF_MIDDLEDOWN;
        SendInput(1,&input,sizeof(INPUT));
    
        // middle up
        input.type      = INPUT_MOUSE;
        input.mi.dwFlags  = MOUSEEVENTF_MIDDLEUP;
        SendInput(1,&input,sizeof(INPUT));
    }
    
    clock_t start;
    float duration;
    MSG msg;
    int wep_spot = 1;
    
    LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) { //hook for mouse wheel
        if (nCode >= 0) {
            if (wParam == WM_MOUSEWHEEL){ //only care if the mouse wheel moves
                bool cont = true;
                duration = (clock() - start ) / (float) CLOCKS_PER_SEC; //I kinda forgot what this does, something about the mouse wheel scrolling too fast and AVA not being able to keep up
                if(duration < 0.01){
                    cont = false;
                }
                else{
                    start = -1;
                }
                if(cont){
                    if(start == -1){
                        start = clock();
                    }
                    MSLLHOOKSTRUCT *pMhs = (MSLLHOOKSTRUCT *)lParam;
                    short zDelta = HIWORD(pMhs->mouseData); //get how much the wheel moved
                    if(duration > 0.05){ //this is where it really stops the mouse wheel from switching the program's wep spot too fast
                        if(zDelta < 0){ //if it moved down
                            if(wep_spot < 4){ //move the wep spot that way
                                wep_spot++;
                            }
                            else{ //if the wep spot goes past 1 grenade, cycle back to the primary weapon
                                wep_spot = 1;
                            }
                        }
                        else if(zDelta > 0){ //vice versa for when the mouse wheel moves up
                            if(wep_spot == 1){
                                wep_spot = 4;
                            }
                            else{
                                wep_spot--;
                            }
                        }
                    }
                }
            }
        }
        return CallNextHookEx(0, nCode, wParam, lParam);
    }
    
    int prev_wep = 2; //default prev wep is the pistol, so I default to that
    
    void* mouse_event_loop(void* ignore){ //this was originally an event loop for the mouse, but I changed it and forgot to change the name. I repurposed it for the sake of catching the Switch key when the user switches weapons
        while(true){
            if(!chat_active && !command_active){
                Sleep(250);
                if((GetKeyState(qswitch_key) & 0x80) != 0){
                    int temp = wep_spot; //save the wep spot (will become the previous wep spot)
                    wep_spot = prev_wep; //update the current wep spot to the prev wep spot
                    prev_wep = temp; //set the prev wep spot to what the prev wep was
                }
            }
            Sleep(1);
        }
        return NULL;
    }
    
    bool qswitch_active = false; //this is for the weapon spot
    bool qscope_active = false;
    bool qswitch_active_toggled = false; //this is for the 7 and 8 keys
    bool qscope_active_toggled = false;
    
    void get_wep(){ //update the weapon spot, turn the qswitch and qscope functions off and on
        if(qswitch_active_toggled || qscope_active_toggled){
            if(!chat_active && !command_active){
                if((GetKeyState(0x31) & 0x80) != 0){
                    wep_spot = 1;
                    Sleep(100);
                }
                if((GetKeyState(0x32) & 0x80) != 0){
                    wep_spot = 2;
                    Sleep(100);
                }
                if((GetKeyState(0x33) & 0x80) != 0){
                    wep_spot = 3;
                    Sleep(100);
                }
                if((GetKeyState(0x34) & 0x80) != 0){
                    wep_spot = 4;
                    Sleep(100);
                }
                if(wep_spot != 1){
                    if(qswitch_active_toggled){
                        qswitch_active = false;
                    }
                    if(qscope_active_toggled){
                        qscope_active = false;
                    }
                }
                else if(wep_spot == 1){
                    if(qswitch_active_toggled){
                        qswitch_active = true;
                    }
                    if(qscope_active_toggled){
                        qscope_active = true;
                    }
                }
            }
        }
    }
    
    int choose_scope_speed(){
        cin.clear();cin.sync();
        float scope_speed_seconds;
        int scope_speed_milliseconds;
        cout << "Scope speeds:" << endl;
        cout << "0.21s: Mosin Nagant Basic Scope, AWM Precision Scope" << endl;
        cout << "0.23s: FR-F2 Sharpshooter Scope, ASW.338 Quick Scope II, AWM Basic Scope, DSR-1 Quick Scope 2, Blaser R93 Sharpshooter Scope" << endl;
        cout << "0.25s: ASW.338 Sharpshooter Scope II" << endl;
        cout << "0.27s: ASW.338 Basic Scope" << endl;
        cout << "0.29s: M24 Basic Scope, SV98 Precision Scope, FR-F2 Basic Scope, DSR-1 Basic Scope, PGM.338 Precision Scope, Blaser R93 Precison Scope" << endl;
        cout << "0.30s: SV98 Basic Scope" << endl;
        cout << "0.31s: Blaser R93 Basic Scope, FR-F2 Quick Scope, DSR-1 High Powered Scope 2" << endl;
        cout << "0.39s: TPG1 High Powered Scope, PGM.338 High Powered Scope" << endl;
        cout << "0.43s: TPG1 Basic Scope, PGM.338 Basic Scope" << endl << endl;
    
        cout << "Enter your scope speed in seconds: ";
        cin >> scope_speed_seconds;
    
        scope_speed_milliseconds = scope_speed_seconds * 1000;
        return scope_speed_milliseconds;
    }
    
    string catch_key(map<string, int> keycodes){
        while(true){
            for(map<string, int>::iterator it = keycodes.begin(); it != keycodes.end(); it++){
                int key_int = it->second;
                if((GetKeyState(key_int) & 0x80) != 0){
                    return it->first;
                }
            }
            Sleep(1);
        }
    }
    
    int choose_key(int type){
        Sleep(700);
        cin.clear();cin.sync();
        map<string, int> keycodes;
        keycodes.insert(make_pair("a", 0x41));
        keycodes.insert(make_pair("b", 0x42));
        keycodes.insert(make_pair("c", 0x43));
        keycodes.insert(make_pair("d", 0x44));
        keycodes.insert(make_pair("e", 0x45));
        keycodes.insert(make_pair("f", 0x46));
        keycodes.insert(make_pair("g", 0x47));
        keycodes.insert(make_pair("h", 0x48));
        keycodes.insert(make_pair("i", 0x49));
        keycodes.insert(make_pair("j", 0x4A));
        keycodes.insert(make_pair("k", 0x4B));
        keycodes.insert(make_pair("l", 0x4C));
        keycodes.insert(make_pair("m", 0x4D));
        keycodes.insert(make_pair("n", 0x4E));
        keycodes.insert(make_pair("o", 0x4F));
        keycodes.insert(make_pair("p", 0x50));
        keycodes.insert(make_pair("q", 0x51));
        keycodes.insert(make_pair("r", 0x52));
        keycodes.insert(make_pair("s", 0x53));
        keycodes.insert(make_pair("t", 0x54));
        keycodes.insert(make_pair("u", 0x55));
        keycodes.insert(make_pair("v", 0x56));
        keycodes.insert(make_pair("w", 0x57));
        keycodes.insert(make_pair("x", 0x58));
        keycodes.insert(make_pair("y", 0x59));
        keycodes.insert(make_pair("z", 0x5A));
        keycodes.insert(make_pair("left control", VK_LCONTROL));
        keycodes.insert(make_pair("right control", VK_RCONTROL));
        keycodes.insert(make_pair("left click", VK_LBUTTON));
        keycodes.insert(make_pair("right click", VK_RBUTTON));
        keycodes.insert(make_pair("middle click", VK_MBUTTON));
        keycodes.insert(make_pair("enter", VK_RETURN));
        keycodes.insert(make_pair("shift", VK_SHIFT));
        keycodes.insert(make_pair("alt", VK_MENU));
        keycodes.insert(make_pair("capslock", VK_CAPITAL));
        keycodes.insert(make_pair("1-2-1", 0x32));
        keycodes.insert(make_pair("1-3-1", 0x33));
        keycodes.insert(make_pair("1-4-1", 0x34));
        if(type == 0){ //switch
            cout << "What do you want as your quickswitch key? "; //NOTE: this part was nuts to figure out, because the user never had to press enter. whatever key they had pressed was carrying over into whatever they needed to type next
            string key = catch_key(keycodes);
            Sleep(250);
            Generate_Key(VK_RETURN); //so I press enter for them
            cin.clear();
            cin.ignore(INT_MAX, '\n'); //then clear the input buffer. I do the same thing for the rest of the blocks
            cout << "Your quickswitch key is " << key << endl;
            return keycodes.find(key)->second;
        }
        else if(type == 1){ //crouch
            cout << "What do you want as your crouch key? ";
            string key = catch_key(keycodes);
            Sleep(250);
            Generate_Key(VK_RETURN);
            cin.clear();
            cin.ignore(INT_MAX, '\n');
            cout << "Your crouch key is " << key << endl;
            return keycodes.find(key)->second;
        }
        else if(type == 2){
            cout << "What do you want as your walk key? ";
            string key = catch_key(keycodes);
            Sleep(250);
            Generate_Key(VK_RETURN);
            cin.clear();
            cin.ignore(INT_MAX, '\n');
            cout << "Your walk key is " << key << endl;
            return keycodes.find(key)->second;
        }
        else{
            return -1;
        }
    }
    
    void* qswitch(void* ignore){
        while(true){
            while(qswitch_active_toggled){
                if(!chat_active && !command_active){
                    if((GetKeyState(0x38) & 0x80) != 0){
                        Sleep(200);
                        if((GetKeyState(0x38) & 0x80) != 0){
                            cout << "Quickswitch macro paused" << endl;
                            qswitch_active_toggled = false;
                        }
                    }
                }
                while(qswitch_active_toggled && qswitch_active){
                    if(!chat_active && !command_active){
                        if((GetKeyState(0x38) & 0x80) != 0){
                            Sleep(200);
                            if((GetKeyState(0x38) & 0x80) != 0){
                                cout << "Quickswitch macro paused" << endl;
                                qswitch_active_toggled = false;
                            }
                        }
                    }
                    if((GetKeyState(VK_LBUTTON) & 0x80) != 0){
                        click(true);
                        Sleep(50);
                        unclick(true);
                        Sleep(50);
                        if(qswitch_key == 2 || qswitch_key == 3 || qswitch_key == 4){
                            Generate_Key(qswitch_key); //quick switch using the key chosen
                            Sleep(5);
                            Generate_Key(1); //switch back to main weapon
                            Sleep(1);
                        }
                        else{
                            Generate_Key(qswitch_key); //quick switch using the key chosen
                            Sleep(5);
                            Generate_Key(qswitch_key); //switch back to main weapon
                            Sleep(1);
                        }
                    }
                    Sleep(1);
                }
                Sleep(1);
            }
            if(!chat_active && !command_active){
                if((GetKeyState(0x37) & 0x80) != 0){
                    Sleep(200);
                    if((GetKeyState(0x37) & 0x80) != 0){
                        cout << "Quickswitch macro activated" << endl;
                        qswitch_active_toggled = true;
                    }
                }
            }
            Sleep(1);
        }
        return NULL;
    }
    
    
    void* qscope(void* ignore){
        while(true){
            while(qscope_active_toggled){
                if(!chat_active && !command_active){
                    if((GetKeyState(0x30) & 0x80) != 0){
                        Sleep(200);
                        if((GetKeyState(0x30) & 0x80) != 0){
                            cout << "Quickscope macro paused" << endl;
                            qscope_active_toggled = false;
                        }
                    }
                }
                while(qscope_active && qscope_active_toggled){ 
                    if((GetKeyState(VK_LBUTTON) & 0x80) != 0){
                        Sleep(50);
                        click(false); //click right
                        Sleep(5);
                        unclick(false); //un_click right
                        Sleep(scope_speed_milliseconds); //wait for the scope to zoom
                        click(true); //click middle
                        Sleep(50);
                        unclick(true); //un_click middle
                        if(qswitch_key == 2 || qswitch_key == 3 || qswitch_key == 4){
                            Generate_Key(qswitch_key); //quick switch using the key chosen
                            Sleep(5);
                            Generate_Key(1); //switch back to main weapon
                            Sleep(1);
                        }
                        else{
                            Generate_Key(qswitch_key); //quick switch using the key chosen
                            Sleep(5);
                            Generate_Key(qswitch_key); //switch back to main weapon
                            Sleep(1);
                        }
                    }
                    if(!chat_active && !command_active){
                        if((GetKeyState(0x30) & 0x80) != 0){
                            Sleep(200);
                            if((GetKeyState(0x30) & 0x80) != 0){
                                cout << "Quickscope macro paused" << endl;
                                qscope_active_toggled = false;
                            }
                        }
                    }
                    Sleep(1);
                }
                Sleep(1);
            }
            if(!chat_active && !command_active){
                if((GetKeyState(0x39) & 0x80) != 0){
                    Sleep(200);
                    if((GetKeyState(0x39) & 0x80) != 0){
                        cout << "Quickscope macro activated" << endl;
                        qscope_active_toggled = true;
                    }
                }
            }
            Sleep(1);
        }
        return NULL;
    }
    
    void* crouch(void* ignore){
        bool crouch_active = false;
        while(true){
            while(crouch_active){
                if((GetKeyState(VK_LBUTTON) & 0x80) != 0){
                    Generate_Key_down(crouch_key);
                    click(true);
                }
                else{
                    Generate_Key_up(crouch_key);
                    unclick(true);
                }
                if(!chat_active){
                    if((GetKeyState(0x28) & 0x80) != 0){
                        cout << "Crouch macro paused" << endl;
                        crouch_active = false;
                        Sleep(100);
                    }
                }
                Sleep(1);
            }
            if(!chat_active){
                if((GetKeyState(0x26) & 0x80) != 0){
                    cout << "Crouch macro activated" << endl;
                    crouch_active = true;
                    Sleep(100);
                }
            }
            Sleep(1);
        }
        return NULL;
    }
    
    void* walk(void* ignore){
        bool walk_active = false;
        while(true){
            while(walk_active){
                if((GetKeyState(VK_LBUTTON) & 0x80) != 0){
                    Generate_Key_down(walk_key);
                    click(true);
                }
                else{
                    Generate_Key_up(walk_key);
                    unclick(true);
                }
                if(!chat_active){
                    if((GetKeyState(0x27) & 0x80) != 0){
                        cout << "Walk macro paused" << endl;
                        walk_active = false;
                        Sleep(100);
                    }
                }
                Sleep(1);
            }
            if(!chat_active){
                if((GetKeyState(0x25) & 0x80) != 0){
                    cout << "Walk macro activated" << endl;
                    walk_active = true;
                    Sleep(100);
                }
            }
            Sleep(1);
        }
        return NULL;
    }
    
    void* tap(void* ignore){
        bool tap_active = false;
        int counter1 = 0;
        int counter2 = 0;
        while(true){
            while(tap_active){
                if((GetKeyState(VK_LBUTTON) & 0x80) != 0){
                    if(burst){
                        while(counter2 < burst_amount){
                            while(counter1 < click_amount){
                                macro_click();
                                Sleep(1000/click_amount);
                                counter1++;
                            }
                            counter1 = 0;
                            Sleep(burst_speed);
                            counter2++;
                        }
                        counter2 = 0;
                    }
                    else{
                        while(counter1 < click_amount){
                            macro_click();
                            Sleep(1000/click_amount);
                            counter1++;
                        }
                        counter1 = 0;
                    }
                }
                if(!chat_active){
                    if((GetKeyState(VK_END) & 0x80) != 0){
                        cout << "Tap macro paused" << endl;
                        tap_active = false;
                        Sleep(100);
                    }
                }
                Sleep(1);
            }
            if(!chat_active){
                if((GetKeyState(VK_HOME) & 0x80) != 0){
                    cout << "Tap macro activated" << endl;
                    tap_active = true;
                    Sleep(100);
                }
            }
            Sleep(1);
    	}
    	return NULL;
    }
    
    void* normal(void* ignore){
        bool normal_active = false;
        while(true){
            while(normal_active){
                if((GetKeyState(VK_LBUTTON) & 0x80) != 0){
                    click(true);
                }
                else{
                    unclick(true);
                }
                if(!chat_active && !command_active){
                    if((GetKeyState(0x4C) & 0x80) != 0){
                        cout << "Normal macro paused" << endl;
                        normal_active = false;
                        Sleep(100);
                    }
                }
                Sleep(1);
            }
            if(!chat_active && !command_active){
                if((GetKeyState(0x4B) & 0x80) != 0){
                    cout << "Normal macro activated" << endl;
                    normal_active = true;
                    Sleep(100);
                }
            }
            Sleep(1);
    	}
    	return NULL;
    }
    
    void* catch_chat_command(void* ignore){
        while(true){
            if((GetKeyState(0x5A) & 0x80) != 0){ //z key
                if(!command_active){
                    command_active = true;
                    cout << "Command menu activated." << endl;
                }
                else if(command_active){
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                Sleep(200);
            }
            if((GetKeyState(0x58) & 0x80) != 0){ //x key
                if(!command_active){
                    command_active = true;
                    cout << "Command menu activated." << endl;
                }
                else if(command_active){
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                Sleep(200);
            }
            if((GetKeyState(0x43) & 0x80) != 0){ //c key
                if(!command_active){
                    command_active = true;
                    cout << "Command menu activated." << endl;
                }
                else if(command_active){
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                Sleep(200);
            }
            if((GetKeyState(VK_RETURN) & 0x80) != 0){
                if(chat_active){
                    chat_active = false;
                    cout << "Chat deactivated." << endl;
                }
                else if(!chat_active){
                    chat_active = true;
                    cout << "Chat activated." << endl;
                }
                Sleep(300);
            }
            if(!chat_active){
                if((GetKeyState(VK_F9) & 0x80) != 0){
                    chat_active = true;
                    cout << "Chat activated." << endl;
                }
                if((GetKeyState(VK_F10) & 0x80) != 0){
                    chat_active = true;
                    cout << "Chat activated." << endl;
                }
                if((GetKeyState(VK_F11) & 0x80) != 0){
                    chat_active = true;
                    cout << "Chat activated." << endl;
                }
            }
            if(command_active){
                if((GetKeyState(0x30) & 0x80) != 0){ //#0
                    Sleep(300); //this drives me crazy. since the threads run at the same time, the user won't be able to press and release a key fast enough for another function (say Quickswitch) to catch it too when this bool goes false. So I threw in these sleeps to allow the user to release the key, but it only half works. I have no idea why, I gave up trying to figure it out
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x31) & 0x80) != 0){ //#1
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x32) & 0x80) != 0){ //#2
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x33) & 0x80) != 0){ //#3
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x34) & 0x80) != 0){ //#4
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x35) & 0x80) != 0){ //#5
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x36) & 0x80) != 0){ //#6
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x37) & 0x80) != 0){ //#7
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x38) & 0x80) != 0){ //#8
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
                if((GetKeyState(0x39) & 0x80) != 0){ //#9
                    Sleep(300);
                    command_active = false;
                    cout << "Command menu deactivated." << endl;
                }
            }
            Sleep(1);
        }
        return NULL;
    }
    
    bool run_qswitch = false;
    bool run_qscope = false;
    bool run_crouch = false;
    bool run_walk = false;
    bool run_tap = false;
    
    void setup(){
        if(run_qswitch || run_qscope){
            qswitch_key = choose_key(0);
            Sleep(700); //each sleep is so the key the user is pressing doesn't carry over to the next key grab
        }
        //==========================//
        if(run_qscope){
            scope_speed_milliseconds = choose_scope_speed();
            Sleep(700);
        }
        //==========================//
        if(run_crouch){
            crouch_key = choose_key(1);
            Sleep(700);
        }
        //==========================//
        if(run_walk){
            walk_key = choose_key(2);
            Sleep(700);
        }
        //==========================//
        if(run_tap){
            string response;
            while(true){
                cout << "Burst? (y/n) ";
                cin >> response;
                if(response == "y"){
                    burst = true;
                    cout << "Wait time between bursts? (in milliseconds) ";
                    cin >> burst_speed;
                    cout << "How many bursts? ";
                    cin >> burst_amount;
                    break;
                }
                else if(response == "n"){
                    break;
                }
                else{
                    cout << "Please enter \'y\' or \'n\'" << endl;
                }
            }
            cout << "Clicks per second? ";
            cin >> click_amount;
        }
    }
    
    vector<string> split_string(string split, string token){ //splits a string based on a token //note: I found the original version of this off stackoverflow, but modified it to my needs
        vector<string> ret_val{split};
        size_t pos;
        bool stop_loop = false;
        while(true){
            unsigned int iter = 0;
            for(iter = 0; iter < ret_val.size();iter++){
                string split_this = ret_val[iter];
                pos = split_this.find(token);
                if(pos != string::npos){
                    ret_val.pop_back();
                    ret_val.push_back(split_this.substr(0, pos));
                    ret_val.push_back(split_this.substr(pos+1));
                    break;
                }
                if(iter == ret_val.size()-1){
                    stop_loop = true;
                }
            }
            if(stop_loop){
                break;
            }
        }
        return ret_val;
    }
    
    int main()
    {
        string macros_chosen = "";
        cout << "1: Quickswitch\n";
        cout << "2: Quickscope\n";
        cout << "3: Crouch\n";
        cout << "4: Walk\n";
        cout << "5: Tap\n";
        bool chosen = false;
        while(!chosen){
            cin.clear();cin.sync();
            cout << "Select which macros you want to run (enter the numbers separated by single spaces):";
            getline(cin, macros_chosen);
            vector<string> to_run = split_string(macros_chosen, " "); //get a vector containing the numbers separated out
            for(vector<string>::iterator it = to_run.begin(); it != to_run.end(); it++){
                string num = *it;
                switch(atoi(num.c_str())){
                    case 1: run_qswitch = true; chosen = true; break;
                    case 2: run_qscope = true; chosen = true; break;
                    case 3: run_crouch = true; chosen = true; break;
                    case 4: run_walk = true; chosen = true; break;
                    case 5: run_tap = true; chosen = true; break;
                    default: cout << "Choose at least one of the numbers.\n";
                }
            }
        }
        mousehook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProc, NULL, 0); //mouse hooks are undetected? lel aeria
        setup(); //set the macro settings
        Sleep(700); //because the program runs so fast, the user will still be pressing buttons in setup() if this sleep isn't here
        if(run_qswitch){
            pthread_t qswitch_thread;
            pthread_create(&qswitch_thread, NULL, &qswitch, NULL);
        }
        if(run_qscope){
            pthread_t qscope_thread;
            pthread_create(&qscope_thread, NULL, &qscope, NULL);
        }
        if(run_crouch){
            pthread_t crouch_thread;
            pthread_create(&crouch_thread, NULL, &crouch, NULL);
        }
        if(run_walk){
            pthread_t walk_thread;
            pthread_create(&walk_thread, NULL, &walk, NULL);
        }
        if(run_tap){
            pthread_t tap_thread;
            pthread_create(&tap_thread, NULL, &tap, NULL);
        }
    
        pthread_t normal_thread;
        pthread_t catch_thread;
        pthread_t mouse_thread;
        pthread_create(&normal_thread, NULL, &normal, NULL);
        pthread_create(&catch_thread, NULL, &catch_chat_command, NULL);
        pthread_create(&mouse_thread, NULL, &mouse_event_loop, NULL);
        while(true){
            Sleep(1);
        }
        UnhookWindowsHookEx(mousehook);
        return 0;
    }
    A lot of this code is pretty messy/ straight up bad, sorry about that. I don't write code to release it, that just happens sometimes. I tried to comment it, but I forgot how some of the stuff worked/ why I did stuff.

    Compiled this with Code::Blocks. You still need pthreads (https://www.sourceware.org/pthreads-win32/) to compile this.
    AVA IGN: NutVBanned

    Current releases:

  2. #2
    COD3RIN's Avatar
    Join Date
    May 2013
    Gender
    male
    Location
    Posts
    4,939
    Reputation
    315
    Thanks
    22,148
    My Mood
    Busy
    great code


    Love you.
    ~Kenshit13
    Quote Originally Posted by cheaterman26 View Post
    COD3RIN PUT A BACKDOOR ON HIS OWN CHEAT HE HACK MY COMPUTER AND MY STEAM, DON'T TRUST THIS GUYS !

  3. #3
    daviddidi's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    1,164
    Reputation
    13
    Thanks
    1,963
    My Mood
    Doh
    Thank for your SourceCode.

Similar Threads

  1. [Source Code] Chat Spammer: Source Code [VC++]
    By BestBlitzcrank in forum League of Legends Guides
    Replies: 2
    Last Post: 04-17-2014, 10:30 AM
  2. [Release] AVA AimAssist Macro Pack
    By UCSerge in forum Alliance of Valiant Arms (AVA) Spammers, Injectors and Multi Tools
    Replies: 5
    Last Post: 10-07-2013, 02:00 AM
  3. [Source Code] CrossFire Spammer Source + Help
    By [CFGH]AhMaD in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 4
    Last Post: 07-04-2011, 06:57 AM
  4. [Source Code] Spammer Source Code
    By Takari in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 6
    Last Post: 05-25-2011, 08:12 AM
  5. (tut)My spammer Source code
    By sam22 in forum Visual Basic Programming
    Replies: 5
    Last Post: 11-01-2010, 12:12 AM