Button Commands

Button Commands 2.2.0

Sign in to download
Run commands when an electric button is pressed
This Rust plugin turns electric buttons into command triggers, allowing you to execute commands when pressed.






Permissions

  • buttoncommands.admin - Grant this to admins who should manage buttons in-game.

Commands

  • bc.add - Registers the button you're currently looking at.
  • bc.remove - Unregisters the button you're looking at and deletes its stored settings.
  • bc.list [page]- Lists all registered buttons in pages.
    • page - (Optional) The page number to view (default is 1).
  • bc.show - Displays all settings and assigned commands for the button you're looking at.
  • bc.set <field> <value>- Changes one setting on the button you're looking at.
    • field - One of: requirepower, disableoutput, runrandom, cooldown.
    • value - Use on/off for toggles, or a number for cooldown (in seconds).
  • bc.addcmd <type> <command>- Adds a new command to the button you're looking at.
    • type - One of: Chat, Server, or Client.
    • command - The command text to run.
  • bc.delcmd <index>- Removes a command from the button by its index.
    • index - The number shown in bc.show (starting from 1).
  • bc.clearcmds - Deletes all commands from the button you're looking at.
  • bc.help - Displays a full list of all available admin commands.

Stored Data

JSON:
{
    "Press Buttons": {
        "123456789": {
            "Require Button Powered": true,
            "Disable Power Output On Press": true,
            "Run Random Command": false,
            "Cooldown Seconds": 60.0,
            "Commands": [
                {
                    "Type": "Chat",
                    "Command": "Hello, {PlayerName}!"
                },
                {
                    "Type": "Server",
                    "Command": "inventory.giveto {PlayerId} scrap 50"
                },
                {
                    "Type": "Client",
                    "Command": "heli.calltome"
                }
            ]
        }
    }
}
  • Press Buttons - A list of all registered buttons, each one stored by its net id (this is automatic, you don't need to manage these ids yourself).
  • Require Button Powered - If set to true, the button only works when it has power (like electricity from a wire or battery).
  • Disable Power Output On Press - If set to true, the button won't send out electricity when pressed, useful if you only want it to run commands without powering anything.
  • Run Random Command - If set to true, only one random command from the list will run when the button is pressed. If false, all commands will run.
  • Cooldown Seconds - How many seconds a player must wait before pressing the same button again.
  • Commands- The list of commands that will run when the button is pressed.
    • Type - Tells the plugin how to run the command: Server (runs in console), Client (runs on the player's game), or Chat (as if the player typed it in chat).
    • Command - The actual command that runs. You can use special placeholders like {PlayerId}, {PlayerName}, or {Grid} to insert info about the player who pressed the button.

Localization

JSON:
{
  "Error.NoPermission": "You do not have permission to use this command.",
  "Error.AlreadyRegistered": "This button already has commands assigned.",
  "Error.NotRegistered": "This button hasn’t been registered yet. Use 'bc.add' to register it.",
  "Error.NoButtonInSight": "You must be looking directly at a button to register it.",
  "Error.NoButtonInRange": "You are too far away from the button to register it.",
  "Error.CooldownActive": "You must wait {0} before using this button again.",
  "Error.InvalidBool": "Invalid boolean value for '{0}'. Use true/false, on/off, or 1/0.",
  "Error.InvalidNumber": "Invalid number entered for '{0}'. Please enter a valid positive number.",
  "Error.InvalidCommandType": "Unknown command type. Use Chat, Server, or Client.",
  "Error.InvalidIndex": "Invalid index. Please enter a valid number matching the command list.",
  "Error.UnknownField": "Unknown field '{0}'. Supported fields: requirepower, disableoutput, runrandom, cooldown.",
  "Error.MissingArgs.Set": "Missing arguments. Usage: bc.set <requirepower|disableoutput|runrandom|cooldown> <value>",
  "Error.MissingArgs.AddCmd": "Missing arguments. Usage: bc.addcmd <Chat|Server|Client> <command text...>",
  "Error.MissingArgs.DelCmd": "Missing argument. Usage: bc.delcmd <index> (use 'bc.show' to see indexes)",
  "Error.NoButtonsDefined": "There are no buttons currently registered.",
  "Info.ButtonRegistered": "Button registered successfully. It will now run the assigned commands.",
  "Info.Removed": "Button has been unregistered and its data removed.",
  "Info.SetBool": "{0} has been set to {1}.",
  "Info.SetCooldown": "Cooldown updated to {0} seconds.",
  "Info.AddedCommand": "Command #{0} added: {1} {2}",
  "Info.RemovedCommand": "Command #{0} removed from the button.",
  "Info.ClearedCommands": "All {0} commands cleared from this button.",
  "Info.ListHeader": "Showing {0} registered buttons (Page {1} of {2}):",
  "Info.ListEntry": "• ID {0} ({1}) | PowerRequired={2}, DisableOutput={3}, RunMode={4}, Cooldown={5}s, Commands={6}",
  "Info.ShowHeader": "Button Settings — PowerRequired={0}, DisableOutput={1}, RunMode={2}, Cooldown={3}s, Commands={4}",
  "Info.ShowCommandEntry": "#{0}: {1} \"{2}\"",
  "Info.Help.Header": "Admin Button Commands — Usage and Descriptions",
  "Info.Help.Line": "• {0} — {1}",
  "Info.Help.Add.Usage": "bc.add",
  "Info.Help.Add.Desc": "Register the button you're currently looking at.",
  "Info.Help.Remove.Usage": "bc.remove",
  "Info.Help.Remove.Desc": "Unregister the button you’re looking at and delete its settings.",
  "Info.Help.List.Usage": "bc.list [page]",
  "Info.Help.List.Desc": "List all registered buttons with their current settings.",
  "Info.Help.Show.Usage": "bc.show",
  "Info.Help.Show.Desc": "Show settings and commands for the button you're looking at.",
  "Info.Help.Set.Usage": "bc.set <requirepower|disableoutput|runrandom|cooldown> <value>",
  "Info.Help.Set.Desc": "Change a specific setting on the looked-at button.",
  "Info.Help.AddCmd.Usage": "bc.addcmd <Chat|Server|Client> <command text...>",
  "Info.Help.AddCmd.Desc": "Add a new command to run when the button is pressed.",
  "Info.Help.DelCmd.Usage": "bc.delcmd <index>",
  "Info.Help.DelCmd.Desc": "Remove a specific command from the button by its list index.",
  "Info.Help.ClearCmds.Usage": "bc.clearcmds",
  "Info.Help.ClearCmds.Desc": "Remove all commands assigned to the button."
}
Author
VisEntities
Downloads
52
First release
Last update

Ratings

0.00 star(s) 0 reviews

Also by VisEntities

Latest updates

  1. 2.2.0

    Fixed commands not executing when Require Button Powered is enabled; now correctly detects...
  2. 2.1.0

    Added a cooldown so players can't spam button commands; set the delay with Cooldown Seconds...
  3. 2.0.0

    Completely revamped the command handling. Instead of one global setup for every button, you now...
Back
Top
Chat commands start with a /, while console commands can be entered directly in the F1 console or server console. Use find <keyword> in console to search for available commands related to the plugin. Parameters in < > are required, while [ ] are optional.
This plugin uses Oxide's permission system. Grant or revoke permissions using oxide.grant and oxide.revoke. You can assign them to individual players or groups using their Steam id or group name.
Settings are stored in the config file found under the config/ directory. You can edit this file manually, then reload the plugin to apply your changes.
Persistent data is saved in the data/ directory. This includes things like saved settings, usage stats, or player progress depending on the plugin. Deleting a data file will reset stored progress or customizations.
Language files are located in the lang/ folder. To translate messages, copy the en.json file into your target language folder (e.g. fr, de) and edit the values. Reload the plugin after changes to apply new messages.
This section lists public methods exposed by the plugin for use in other plugins. You can call these via the CallHook method. Ensure the plugin is loaded before calling its API to avoid null reference errors.
These are custom hooks that other plugins can listen for. Simply define a method with the same name and expected parameters in your plugin to handle the event. Hooks are triggered at key moments and are useful for extending or reacting to plugin behavior.
These hooks are injected into the game's code using Harmony. They let the plugin run code at key points in the game's internal logic. You can return values to block or modify behavior. Use with caution — these are powerful and can affect core mechanics.
Cart