c++ triggerfinger problem

Blume

Active member
Joined
May 14, 2018
Messages
38
Reaction score
11
Location
China
i made a triggerfinger function,it work normal,but while i died and ready to spawn,the game crashed by that function toggled.
Code:
void Triggerfinger() {
    static unsigned int delayy = GetTickCount();
    if (GetTickCount() - delayy >= 50) {
        static bool aimming = false;
        int addr1 = *(int *)0xB6F3B8; 
        addr1 += 0x79C;
        int addr2 = *(int *)addr1;

        if (addr2) {
            if (!aimming)
            {
                INPUT    Input = { 0 };
                Input.type = INPUT_MOUSE;
                Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
                SendInput(1, &Input, sizeof(INPUT));
                aimming = true;
            }
            addr1 = *(int *)0xB6F3B8;
            addr1 += 0x79C;
            *(int *)addr1 = 0; 
            
        }
        else
        {
            if (aimming) {
                INPUT    Input = { 0 };
                Input.type = INPUT_MOUSE;
                Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
                SendInput(1, &Input, sizeof(INPUT));
                aimming = false;
            }
        }
    }
}
plz help me find out what's wrong with it,thank
 
Top