DezLife
Toggle on/off staff mode

Supported Games
GameServerKingsGameServerKings

Staffmode is a plugin that allows the toggling from one group (or set) to another group (set). This plugin is intended for staff groups, but it can be used to toggle other groups.

Note, the command used below is the default command. If you changed the command in the config, use that one instead of "/staffmode"

Features

  • Toggles to/from multiple different oxide permission groups
  • Logging on toggle
  • Toggles in/out of set auth level/admin status
  • Customizable permissions
  • Customizable command
  • Ingame group editor
  • Prevent staff from damaging, hurting, and/or looting while in staff mode

So, what's the purpose of this plugin?
This plugin's soul purpose is to provide time frames in which playing staff members could potentially abuse. By using an OffDutyGroup, a staff member's permissions could be limited until they toggle into their OnDutyGroup. This can drastically reduce the time it takes to investigate potential abusive staff.

For example:
Off Duty Group Permissions - mute, kick, ban
On Duty Group Permissions - noclip, vanish, remove, unlock chests, force tp, ect.

Commands

  • /staffmode - Toggles staff status if granted permission(s) - command interchangeable.
  • /staffmode group create [groupname] - Creates a group in the "Staffmode_Groups" data file
  • /staffmode group remove [groupname] - Removes a group from the "Staffmode_Groups" data file
  • /staffmode group edit [groupname] - Adds a group to the editor

Console Commands

  • checkgroups - Runs data check

Editing values:

  • /staffmode edit [value] [setting]
  • offdutygroup -- Must be an existing oxide permission group
  • ondutygroup -- Must be an existing oxide permission group
  • authlevel -- Must be 0, 1 or 2
  • permission -- Can be a duplicate permission, but warning will be given

Configuration

{
  "ConfigVersion": "1.2.0",
  "Debug": {
    "CheckGroupDataOnLoad": false,
    "Dev": false
  },
  "GameplaySettings": {
    "CanAttack": true,
    "CanBeTargetedByHeliAndTurrets": true,
    "CanLootPlayer": true,
    "ShowMessages": true
  },
  "Settings": {
    "AnnounceOnToggle": true,
    "Command": "staffmode",
    "DisconnectOnToggle": true,
    "EditPermission": "staffmode.canedit",
    "EnableGroupToggle": true,
    "LogOnToggle": true,
    "PluginPrefix": "<color=orange>[StaffMode]</color>"
  }
}
  • PluginPrefix - Determines the prefix of the plugin when sending messages. If you want to disable the prefix, remove the prefix but leave the quotes.

  • EditPermission - Customizable permission node that is required to use the "/staffmode group" or "/staffmode edit" command. This permission is not required to use "/staffmode"

  • AnnounceOnToggle - If true, a message will broadcast to the rest of the server when a person uses /toggle.

  • LogOnToggle - If true, a message will be logged to console when a person uses /staffmode.

  • DisconnectOnToggle - If true, the person who toggles is forced to disconnect (see note below about Auth Level)

  • EnableGroupToggle - If true, the plugin will change the groups of a player when they /staffmode, and check for null group settings.

  • CheckGroupDataOnLoad - Runs data check when the plugin is loaded.

  • Dev - Disables disconnecting after toggle but leaves messages in place. Not meant for non-testing uses.

  • ConfigVersion - Version number that can trigger a config update message (if one is needed).

  • CanAttack - Determines if the player (in staffmode) can attack/gather/shoot/etc. anything, nullifies damage if set to false.

  • CanBeTargetedByHeliAndTurrets - Determines if the player (in staffmode) can be targeted by the helicopter or turrets.

  • CanLootPlayer - Determines if the player (in staffmode) can loot other players' bodies. Does not block looting chests.

  • ShowMessages (modifiers only) - Determines if messages "OnAttack" and "OnLootPlayer" are shown.

Localization

{
  "ToggleOnAnnounce": "{player.name} has switched to staff mode. They can now use staff commands.",
  "ToggleOffAnnounce": "{player.name} has switched to player mode. They can no longer use staff commands.",
  "ToggleOn": "You have switched to staff mode!",
  "ToggleOff": "You have switched to player mode!",
  "Disconnect": "You will be disconnected in {seconds}, please reconnect to update your auth level.",
  "ToggleOnLog": "{player.name} is now in staff mode.",
  "ToggleOffLog": "{player.name} is now out of staff mode.",
  "NoPermission": "You do not have permission to use this command.",
  "Reconnect": "You will be kicked in 5 seconds to update your status. Please reconnect!",
  "Corrupt": "A group you tried to toggle into is corrupt, please check console for more information.",
  "Usage": "Usage: /{0} {1} {2} {3}",
  "AlreadyExists": "This group already exists.",
  "DoesNotExist": "This group doesn't exists.",
  "RemovedGroup": "Removed group '{group}' successfully",
  "CreatedGroup": "Created group '{group}' successfully.",
  "NoGroups": "No groups have been configured properly. Check console for data check.",
  "EditingGroup": "Now editing group '{group}.'",
  "NotEditingGroup": "You are not editing a group.",
  "UpdatedValue": "Updated '{0}' to '{1}' for group '{2}.'",
  "OnAttack": "You cannot attack while in staff mode.",
  "OnLootPlayer": "You cannot loot another player while in staff mode."
}

Example Group Data File

{
  "Groups": {
    "Mod": {
      "GroupName": "Mod",
      "AuthLevel": 1,
      "OffDutyGroup": "Modoffduty",
      "OnDutyGroup": "Mod",
      "PermissionNode": "staffmode.mod"
    },
    "Admin": {
      "GroupName": "Admin",
      "AuthLevel": 1,
      "OffDutyGroup": "Adminoffduty",
      "OnDutyGroup": "Admin",
      "PermissionNode": "staffmode.admin"
    },
    "Headadmin": {
      "GroupName": "Headadmin",
      "AuthLevel": 2,
      "OffDutyGroup": "Hadminoffduty",
      "OnDutyGroup": "Headadmin",
      "PermissionNode": "staffmode.headadmin"
    },
    "Owner": {
      "GroupName": "Owner",
      "AuthLevel": 2,
      "OffDutyGroup": "Owneroffduty",
      "OnDutyGroup": "Owner",
      "PermissionNode": "staffmode.owner"
    }
  }
}
  • GroupName - Name of the group, does not have any plugin use until the group is corrupted.
  • AuthLevel - 1 and 2 both have admin privileges. Any value other than 1, 2 or 0 will give an error message in console on toggle. Below is some more information about AuthLevel.
  • OffDutyGroup - Off duty player group (below is some more details about this setting). Requires an oxide permission group if EnableGroupToggle is true.
  • OnDutyGroup - On duty player group (below is some more details about this setting). Requires an oxide permission group if EnableGroupToggle is true.
  • PermissionNode - Permission registered and used to check for permission. See Using Oxide's permission system | Oxide

If DisconnectOnToggle is true,

If given permission for two groups with two different Auth levels, the highest on this list will take priority. For example, if I gave myself permission for "Mod" and "Headadmin," I would get Auth level 1 instead of 2. If I wanted Auth level 2, I would put "Admin" above "Mod" in the list.

Auth level (if set to 1 or 2) will also be assigned to the player, using these console commands:

moderatorid "exampleid"  --- Level 1
ownerid "exampleid"   --- Level 2

Re logging will allow the use of Auth level to the fullest extent, unlike the "IsAdmin" flag.

The commands will not run if the "AuthLevel" setting is 0.

If DisconnectOnToggle is false,

If the AuthLevel value is set to 1 or 2, the player will be given the "IsAdmin" flag, which does not give access to all available Rust console commands (i.e status, any "ent" command, ect). There is no better way to do this without requiring a disconnect.

The flag will not be set if the "AuthLevel" setting is 0.

Off and On Duty Groups
See Using Oxide's permission system | Oxide to learn how to create Oxide permission groups and how to grant permissions.

If you have any questions, post in the support forum and I'll get back to you as soon as possible.

MIT License


Copyright (c) 2019 CanopySheep


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.