Sound Effects

I have a sound effect for when Mario jumps, but the sound effect can be triggered whenever the jump buttun is pressed, even in the air. How do I make it so the jump sound only plays when mario actually jumps?
in_air=0;
createtimer("Jump", 100);//make it only repeat one time
in_air=1;
if(in_air==1)
{
playsound2("/data/Mario_jump.wav" 0, 0, 1);
}
on timer "Jump"