This plugin has been updated under a branch to work with uMod What is uMod?
BlueBeka
Automatically sets the code on code locks when placed

Supported Games
GameServerKingsGameServerKings
works with

AutoCode

Automatically sets the code on code locks when placed.Allow players to automatically try and unlock locked code locks with their code.

BSD 3 Clause licenseCommitizen friendlysemantic-release

Permissions

  • autocode.use - Allows use of this plugin.
  • autocode.try - Allows auto-trying of user auto-code on locked code locks.
  • autocode.admin - Allows use of admin commands.

Chat Commands

Core Commands

You refers to the player running the command.

  • code 1234 - Sets your auto-code to 1234.
  • code random - Sets your auto-code to a random code.
  • code remove - Removes your set auto-code (and guest auto-code).

The core commands are also available in a guest code version. e.g.

  • code guest 5678 - Sets your guest code to 5678.

Other Commands

  • code quiet - Toggle quiet mode. In this mode less messages will be displayed and your auto-code will be hidden.
  • code help - Shows a detailed help message.

Console Commands

Requires autocode.admin to use.

  • autocode.resetlockout * - Removes all lock outs for all players.
  • autocode.resetlockout playerSteamId_or_playerDisplayName - Removes lock out for the specified player.

Configuration

Default configuration:

{
  "Commands": {
    "Use": "code"
  },
  "Options": {
    "Display Permission Errors": true,
    "Spam Prevention": {
      "Attempts": 5,
      "Enable": true,
      "Exponential Lock Out Time": true,
      "Lock Out Reset Factor": 5.0,
      "Lock Out Time": 5.0,
      "Window Time": 30.0
    }
  }
}

Explained

  • Commands - Change the commands this plugin uses.
    • Use - Used to set the player's code.
  • Options
    • Display Permission Errors - If set to false, players won't be notified if they don't have the right permissions to use this plugin.
    • Spam Prevention - Prevent players from changing their code too often to prevent abuse.
      • Enable - Whether spam protection is enabled or not.
      • Attempts - The number of code changes the player can make with in Window Time before being marked as spamming.
      • Window Time - The time frame (in seconds) to count the number of code changes the player has made.
      • Lock Out Time - How long (in seconds) a player will be locked out for. This number should be low if using exponential lock out times.
      • Exponential Lock Out Time - If true, each time the player is locked out, they will be locked out for double the amount of time they were previously locked out for.
      • Lock Out Reset Factor - Determines how long (as a multiples of lock out time) before the player is forgive for all previous lockout offenses (should be greater than 1 - has no effect if not using exponential lock out time).

API

string GetCode(BasePlayer player, bool guest = false);
void SetCode(BasePlayer player, string code, bool guest = false);
void RemoveCode(BasePlayer player, bool guest = false);
bool IsValidCode(string codeString);
string GenerateRandomCode();
void OpenCodeLockUI(BasePlayer player, bool guest = false);
void ResetAllLockOuts();
void ResetLockOut(BasePlayer player);

Development

Bug Report or Feature Request

Open an issue on GitHub.

Want to contribute

Fork and clone the GitHub repository. Send me a PR :)

BSD 3-Clause License


Copyright (c) 2021, Rebecca Stevens
All rights reserved.


Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:




  1. Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.




  2. Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.




  3. Neither the name of the copyright holder nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.




THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.