Make stamina value only drain when sprint button is held and player is moving?

My method is in Spanish, sorry. But the method has worked perfectly for me, when I shift, the resistance no longer drops without moving, it only wears out when I move and shift.