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

Author
Message
Vrakyas
9
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-12-22 04:53:45
Your offset time is: 2024-12-22 04:53:45