Button timing

1)I need a button to have timing effect, that is when a button is click, if it is not click again within 5 seconds, the button will lose its clicking function.

2)I need a button which After clicking 5 times, if it is not click anymore, the button will lose its clicking function.

Need help for these 2 questions.