Scripts / code snippet: toggle something on/off by pressing a single key

Author
Message
Vrakyas
8
Years of Service
User Offline
Joined: 27th Aug 2015
Location:
Posted: 4th Sep 2015 16:45
Often I read some code snippets to toggle something on/off by pressing one key to toggle it off, and the capital letter to toggle it on.
This is done, because the g_InKey is triggered too often.

I found a solution/workaround to only use one key/letter.
The following code snippet is for testing if key "o" or "O" is pressed:



With this code it doesn't matter if you press "o" or "O" and you don't need to press "o" to activate and "O" to deactivate your thing.

I hope this is helpful.

regards
Vrakyas
PM

Login to post a reply

Server time is: 2024-05-05 05:43:03
Your offset time is: 2024-05-05 05:43:03