how to control iputs/outputs?

What you are asking to do is very trivial. However you seem to just want to find someone who has done this for you.
Look at the button examples, try and learn what each statement does.
You will need to use the if statement with two tests joined with a logic AND that is the && operator.
Read the referance section.