Write a pin high for a period pf time but not any longer

So guys i need help with this code, i want to turn high one pin for 10 seconds but not any longer.
That is easy just if statement and delay time, but i want it to be controled with a button, and if that button is writing high the output pin is also high but if its been past 10 seconds and again the button is high the pin will be too and there is my problem i dont know how to set it low after 10 seconds if button is still high.
I hope you understood what i mean im from eastern europe and this is hard for me to explain.

If you look at the examples in the IDE, timing, switch monitoring etc. are all covered.

Rather than jumping immediately into a project put some time into learning the basics, doesn’t take that much time.

Use CTRL T to format your code.
Attach your sketch between code tags
[code]Paste your sketch here[/code]

Always show us a good schematic & image of your circuit wiring.
Posting images:

Arduino links of interest.

How to use this forum:
https://forum.arduino.cc/index.php?topic=149014.0

Listing of downloadable 'Arduino PDFs' :
Either Google >>>- - - - > arduino filetype: pdf
Or
https://www.google.ca/search?q=arduino+filetype%3A+pdf&rlz=1C9BKJA_enCA739CA739&oq=arduino+filetype%3A+pdf&aqs=chrome..69i57j69i65.1385j0j7&hl=en-US&sourceid=chrome-mobile&ie=UTF-8

Listing of downloadable 'C++ PDFs' :
Either Google >>>- - - - > C++ filetype: pdf
Or
https://www.google.ca/search?q=c%2B%2B+filetype%3A+pdf&rlz=1C9BKJA_enCA739CA739&oq=c%2B%2B+filetype%3A+pdf&aqs=chrome..69i57.22790j0j7&hl=en-US&sourceid=chrome-mobile&ie=UTF-8

Arduino cheat sheet:

Troubleshooting common errors:

Watch these:
Arduino programming syntax:
https://m.youtube.com/watch?v=CbJHL_P5RJ8

Arduino arithmetic operators:

Arduino control flow:

Arduino data types:
https://m.youtube.com/watch?v=xmZXWMEltEc

Why MOSFET gate resistors:

Some things to read

Reading a schematic:
https://learn.sparkfun.com/tutorials/how-to-read-a-schematic

Language Reference:
https://www.arduino.cc/en/Reference/HomePage

Foundations:

How and Why to avoid delay():
http://playground.arduino.cc/Code/AvoidDelay

Demonstration code for several things at the same time.
http://forum.arduino.cc/index.php?topic=223286.0

Multitasking:
Part 1:

Part 2:

Part 3:

Micro Controllers:

Useful links:

Arduino programming traps, tips and style guide:
http://www.gammon.com.au/forum/?id=12153

Call for useful programming discussions

Jeremy Blume:

Arduino products:
https://www.arduino.cc/en/Main/Products

Motors/MOSFETs
http://www.gammon.com.au/motors

Switches:
http://www.gammon.com.au/forum/?id=11955

Share tips you have come across, 500+ posts:

Images from above:
https://www.google.com/search?q=“Share+tips+you+have”+larryD+site:https://forum.arduino.cc&prmd=nmvi&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiJw-zu68ncAhXPGTQIHWCDCNwQ_AUIFCgE&biw=1024&bih=653

Debug discussion:

.

Mupe:
So guys i need help with this code, i want to turn high one pin for 10 seconds but not any longer.
That is easy just if statement and delay time, but i want it to be controled with a button, and if that button is writing high the output pin is also high but if its been past 10 seconds and again the button is high the pin will be too and there is my problem i dont know how to set it low after 10 seconds if button is still high.
I hope you understood what i mean im from eastern europe and this is hard for me to explain.

a) You want to be able to detect when the button has changed “state” and more specifically, when it is pressed. So on pass N you read, say, HIGH on the pin. If, on the next pass, you see LOW you know that the pin has changed state. So you aren’t as interested in the level of the pin as you are in the change of level.

Each time you read the switch you need to save the value read; next time through when you read the switch you compare it to the last read value and look for a difference.

b) When you detect the pin changing from a level indicating not-pressed to a level indicating pressed, then you do something. In your case, you set a pin high. You don’t want to use delay() for this; it’s gauche and ugly, hugely wasteful of processor resources and generally frowned-upon. You want your controller to be able to do lots of other stuff while this pin is high for 10-seconds.

So when you set the pin high, take note of the system millis() count. You can then do other stuff and come back and check millis() count now versus what it was when the pin was set high. When ten-thousand milliseconds have gone by, you can set the pin low.

Does this give you any ideas as to how you might code this?