'Password' System
This code is over 6 months old. The code may have expired and might no longer function.
What is this??
This is a snippet that you can paste into your workshop game that allows you to set a custom sequence of inputs to use as a 'password' to allow other players in the game to access your custom debug tools, cheats, or other fun stuff.
It is recommended to simply paste the code snippet.
Suggestions for improvement or cleanup welcome.
How to Use
Set the global Password variable to an array that represents the sequence you want to use. You can use an array of any size, though I haven't tested excessively short or long passwords.
In the default example, the sequence is Ability 2 π’ Ability 2 π’ Ability 2 π’ Crouch π’ Crouch π’ Crouch π’ Ability 2 π’ Ability 2 π’ Ability 2. With default keybinds, this represents the following button presses: E π’ E π’ E π’ Ctrl π’ Ctrl π’ Ctrl π’ E π’ E π’ E.
Once the player enters buttons in the same sequence as the password, it sets the player var Authorized to true. You can use this as a flag for your other rules. If the player enters the sequence again, it sets Authorized to false again.
Use this table as a reference for creating your password. Since I could not use the actual button objects, the password system works with strings.
String (use this to set PW) | Actual Name of Button | Default Keybind |
---|---|---|
primary | Primary Fire | Mouse 1 |
secondary | Secondary Fire | Mouse 2 |
ability1 | Ability 1 | Shift |
ability2 | Ability 2 | E |
ultimate | Ultimate | Q |
interact | Interact | F |
jump | Jump | Space |
crouch | Crouch | Ctrl |
melee | Melee | V |
reload | Reload | R |
NOTES
- This system tracks only the most recent N button presses, where N is the length of the password. If you planned on extending this to add custom functionality to different passwords, you will have to change this behavior.
- The player's input buffer is cleared when there is a code match.
Snippet
Loading...