Hmmm, let's see...

Code:
var counter;
var spin = 1;

function handel_timer()
{
	if (spin) //if var spin = 1
	{
		player.tilt += 5*time_step; //rotate the entity
	}
	else
	{
		while(player.tilt > 0)
		{
			player.tilt -= 0.5*time_step;
			spin = 0;
			wait(1);
		}
	}
}

action hand_spin()
{
	player = my;
	while(1)
	{
		handel_timer();
		if(player.tilt > 360){player.tilt = 0; counter ++;} 
		if(key_space && spin) //if space pressed and spin = 1
		{
			spin = 0;
			while(key_space) wait(1); //wait until space is released
		}
		if(key_space && !spin) //if space pressed and spin = 0
		{
			spin = 1; //set spin = 1
			while(key_space) wait(1);
		}
		wait(1);
	}
}