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

    QuickScope + Switch Macro

    Just combines code for quickswitching and quickscoping (I haven't seen a quickscope macro yet though)

    Code:
    #define WINVER 0x0500
    #include <iostream>
    #include <windows.h>
    #include <winable.h>
    
    using namespace std;
    
    void quick_switch(){
        INPUT input;
    
        input.type = INPUT_KEYBOARD;
        input.ki.wScan = 0;
        input.ki.time = 0;
        input.ki.dwExtraInfo = 0;
        input.ki.wVk = 0x51;
        SendInput(1, &input, sizeof(INPUT));
    
        Sleep(10);
    
        input.ki.dwFlags = KEYEVENTF_KEYUP;
        SendInput(1, &input, sizeof(INPUT));
    }
    
    void unclick(bool left_or_right){
        INPUT input = {0};
        //input.mi.dwExtraInfo = 0x200;
        input.type = INPUT_MOUSE;
        if(left_or_right){ //"left" is middle
            input.mi.dwFlags = MOUSEEVENTF_MIDDLEUP;
            SendInput(1, &input, sizeof(INPUT));
        }
        else if(!left_or_right){
            input.mi.dwFlags = MOUSEEVENTF_RIGHTUP;
            SendInput(1, &input, sizeof(INPUT));
        }
    }
    
    void click(bool left_or_right){
        INPUT input = {0};
        input.mi.dwExtraInfo = 0x200;
        input.type = INPUT_MOUSE;
        if(left_or_right){ //"left" is middle
            input.mi.dwFlags = MOUSEEVENTF_MIDDLEDOWN;
            SendInput(1, &input, sizeof(INPUT));
        }
        else if(!left_or_right){
            input.mi.dwFlags = MOUSEEVENTF_RIGHTDOWN;
            SendInput(1, &input, sizeof(INPUT));
        }
    }
    
    int main(){
        bool active = true;
        float scope_speed_seconds;
        int scope_speed_milliseconds;
        cout << "Scope speeds:" << endl;
        cout << "0.12s: Mosin Nagant Basic Scope, AWM Precision Scope" << endl;
        cout << "0.14s: FR-F2 Sharpshooter Scope, ASW.338 Quick Scope II, AWM Basic Scope, DSR-1 Quick Scope 2, Blaser R93 Sharpshooter Scope" << endl;
        cout << "0.16s: ASW.338 Sharpshooter Scope II" << endl;
        cout << "0.18s: ASW.338 Basic Scope" << endl;
        cout << "0.20s: 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.21s: SV98 Basic Scope" << endl;
        cout << "0.22s: Blaser R93 Basic Scope, FR-F2 Quick Scope, DSR-1 High Powered Scope 2" << endl;
        cout << "0.30s: TPG1 High Powered Scope, PGM.338 High Powered Scope" << endl;
        cout << "0.34s: 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;
    
        while(true){
            while(active){
                if((GetKeyState(VK_LBUTTON) & 0x80) != 0){
                    click(false); //click right
                    unclick(false); //un_click right
                    Sleep(scope_speed_milliseconds - 20); //wait for the scope to zoom
                    click(true); //click left
                    unclick(true); //un_click left
                    Sleep(5);
                    quick_switch(); //quick switch using Q
                    Sleep(15);
                    quick_switch(); //switch back to main weapon
                }
                if((GetKeyState(VK_END) & 0x80) != 0){
                    active = false;
                }
            }
            if((GetKeyState(VK_HOME) & 0x80) != 0){
                active = true;
            }
        }
        return 0;
    }
    Written in C++, under Windows 7. I got the table of scope speeds from http://www.aeriagames.com/forums/en/....php?t=1842561
    Last edited by Hunter; 02-02-2016 at 09:51 AM.

  2. The Following User Says Thank You to asqapro For This Useful Post:

    The Conjurer (12-30-2014)

Similar Threads

  1. [Outdated] QuickScope + Switch Macro
    By asqapro in forum Alliance of Valiant Arms (AVA) Hacks & Cheats
    Replies: 17
    Last Post: 03-16-2014, 04:42 PM
  2. [Request] A quick scope + switch macro
    By asqapro in forum Alliance of Valiant Arms (AVA) Coding / Source Code
    Replies: 2
    Last Post: 03-12-2014, 05:09 PM
  3. Project Blackout Quickscope Macro Script
    By Angelus1337 in forum Piercing Blow Help
    Replies: 0
    Last Post: 12-31-2013, 12:23 AM
  4. QuickScope Macro
    By Ceifeiro in forum Call of Duty Modern Warfare 3 Help
    Replies: 3
    Last Post: 08-02-2012, 07:05 PM
  5. AUG switch for sniper
    By AdamWest in forum WarRock - International Hacks
    Replies: 9
    Last Post: 02-10-2006, 06:43 AM