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 postWell, 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;
}
}
}