If it is important not to freeze the main loop that contains the code ( while(mouse_right){wait(1);} ), this is the simpliest way I know. It uses the 3dgs key events.

Code:
#include <acknex.h>
#define MC_DOUBLECLICKTIME		4
var nMouseLeft = 0;

void on_mouse_left_event ()
{
	nMouseLeft = 1;
}

function main ()
{
	mouse_mode = 4;
	
	wait(1);
	
	var nMouseClock = 0;
	
	while ( 1 )
	{
		if ( nMouseClock )
		{
			if ( nMouseLeft )
			{
				nMouseClock = 0;
				nMouseLeft = 0;
				error ( "Double click" );
			}
			else
			{
				nMouseClock = maxv ( nMouseClock - time_step, 0 );
				if ( nMouseClock == 0 )
				{
					error ( "Single click" );
				}
			}
		}
		else if ( nMouseLeft )
		{
			nMouseClock = MC_DOUBLECLICKTIME;
			nMouseLeft = 0;
		}
		
		wait(1);
	}
}