Hi,
I am trying to make it when press mouse button 4 will deactivate mouse button 5 and 9. Because right now when mb4 are activated and press mb5 both function are activated at the sometime. How can I make it only activate one function when the other are turn on?

Code:
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)  -- to prevent it from being stuck on
    
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
        recoildot = not recoildot
        spot = not spot
    end
	if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoildot) then
        if recoildot then
            repeat
                --Sleep(9)
                Sleep(9)
                MoveMouseRelative(0, 2)
            until not IsMouseButtonPressed(1)
        end
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
        recoilx4 = not recoilx4
        spot = not spot
    end
	if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoilx4) then
        if recoilx4 then
            repeat
                --Sleep(5)
                Sleep(9)
                MoveMouseRelative(0, 5)
            until not IsMouseButtonPressed(1)
        end
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 9) then
        recoilx9 = not recoilx9
        spot = not spot
    end
	if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoilx9) then
        if recoilx9 then
            repeat
                --Sleep(9)
                Sleep(9)
                MoveMouseRelative(0, 7)
            until not IsMouseButtonPressed(1)
        end
    end	
end