Request: un-hardcode backpack chat command

I'm trying to set up Backpack as a bank storage that's only accessible through NPCs.

If I can change the command to something random that players won't be able to type, then it would only be accessible when an NPC runs the command for the player.

P.S. I know there are other "bank" plugins, but nothing comes close to the awesomeness and utility of this plugin.

 

Thank you for your time and effort, regardless if you chose to implement this or not. 

That's a bizarre way to achieve that goal. Alternatively, I would recommend you write a simple plugin (probably with AI if you aren't a coder) which uses the OnBackpackOpen hook to prevent players from accessing the backpack if they are not within a particular radius of the bank NPC.

I'll try the AI approach. 🤞 Thank you for the advice.

And again, thank you for your time and effort. I really appreciate all the work you've done for the community. You're the best!



Merged post

Well, I came up with a different solution. I went with blocking the original command and only allowing it when the user types a custom command. (Or at least that was my prompt for the AI, not sure what it did there.)

Here is the code if anyone needs it. I'm sure it will break your server, so it's better not to use it.

using Oxide.Core.Libraries.Covalence;

namespace Oxide.Plugins
{
    [Info("BackpackAlias", "ChatGPT", "1.0.0")]
    public class BackpackAlias : CovalencePlugin
    {
        private const string BackpackCommand = "backpack";
        private const string AliasCommand = "yourcustomcommandhere";

        private void Init()
        {
            // override alias command
            AddCovalenceCommand(AliasCommand, nameof(OnAliasCommand));
        }

        private void OnAliasCommand(IPlayer player, string command, string[] args)
        {
            var basePlayer = player.Object as BasePlayer;
            if (basePlayer == null) return;

            // execute real backpack command directly
            basePlayer.SendConsoleCommand(BackpackCommand);
        }

        private object OnPlayerCommand(BasePlayer player, string command, string[] args)
        {
            if (command.Equals(BackpackCommand))
            {
                // hard block original command path
                return false;
            }

            return null;
        }
    }
}