0

I am attempting to program a defusable bomb for a csgo prop and was trying to make it as close as i can to the original thing. I have got everything working smoothly. An entry code and a Timer. The only thing I need to do is add a defusable section to it. Whilst the Bombs timer is running I would need to be able to cancel that action with an Input Code. Where, and what would I put?

I have tried doing a defuse = input("Defusal Code") if defuse == "7355608": break

import time


while True:
    uin = input("")
    try:
        when_to_stop = abs(int(uin))
    except KeyboardInterrupt:
            break
    except:
            print("NAN!")
    while when_to_stop > 0:
        s, ms = divmod(when_to_stop, 100)
        m, s = divmod(s, 60)
        time_left = str(m).zfill(2) + ":" + str(s).zfill(2) + ":" + str(ms).zfill(2)
        print(time_left, end="\r")
        time.sleep(0.01)
        when_to_stop -=1
    print()
    print("BOMB DETONATED")
Vuxx
  • 1
  • This question has been asked many times across the site. See https://stackoverflow.com/questions/2933399/how-to-set-time-limit-on-raw-input or many of the other questions linked there. You will need to use threading if you want code to execute while doing an input(). This can get quite complicated quite quickly. Make sure this is what you need want to do? Using a library like pygame might also simplify things for you. – blueenvelope Oct 09 '19 at 02:31
  • 2
    Possible duplicate of [How to set time limit on raw\_input](https://stackoverflow.com/questions/2933399/how-to-set-time-limit-on-raw-input) – blueenvelope Oct 09 '19 at 02:31

0 Answers0