triple jump?

how can i make my character only jump 3 times (and only 2 times in the air) Then have jump disabled? 

// create actor event
int can_jump = 3; // 3 for three jumps in the air
// pressing the jump button
if(can_jump!=0)
{
yvelocity = -10; // let the Actor jump
can_jump -= 1;
}