Rapid fire script in lua language

102 views Asked by At

I just want rapid fire script.
I want to fire with left click, but I only want it to work while holding down the right click button.
I want 125ms between each left click (firing)
It also requires some amount of norecoil (I can add this myself).
Actually, I can arrange most things myself. but I don't know how to code it.
I tried this but when I stop firing (left click) it still keeps firing and doesn't stop for long.

function OnEvent(event, arg) 
    OutputLogMessage("event = %s, arg = %d\n", event, arg)
        if (event == "PROFILE_ACTIVATED") then 
    EnablePrimaryMouseButtonEvents(true) 
        elseif event == "PROFILE_DEACTIVATED" then 
    ReleaseMouseButton(2) 
end

    if (event == "MOUSE_BUTTON_PRESSED" and arg == 6) then
        recoil = not recoil 
        spot = not spot 
    end 
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil) then
        if recoil then 
            repeat

        MoveMouseRelative(-1,125)   
        MoveMouseRelative(0,30)
            Sleep(1)
        PressMouseButton(1)
            Sleep(1)
        ReleaseMouseButton(1) 

            until (not IsMouseButtonPressed(1) or not IsMouseButtonPressed(3))
        end
    end 
end
0

There are 0 answers