Hello everyone! I'm pretty new at modding for Rust, I'm trying to do something kinda simple, creating a container when I type /stash and inmediately open it, I have this code
The problem is that right after that RPC, the containers UI gets deleted and suddenly shows normal quick craft menu
As you can see in this video (NSFW)
Anyone knows what's going on? It's such a small script that's giving me too many headaches!
namespace Oxide.Plugins
{
[Info("StackBag", "Gonzo", "1.0")]
public class StackBag : RustPlugin
{
[ChatCommand("stash")]
private void StashCommand(BasePlayer player, string command, string[] args)
{
ItemContainer loot = new ItemContainer
{
capacity = 3,
isServer = true,
entityOwner = player,
allowedContents = ItemContainer.ContentsType.Generic
};
loot.ServerInitialize(null, 3);
loot.GiveUID();
loot.MarkDirty();
timer.Once(.25f, () =>
{
player.inventory.loot.Clear();
player.inventory.loot.PositionChecks = false;
player.inventory.loot.entitySource = loot.entityOwner ?? player;
player.inventory.loot.itemSource = null;
player.inventory.loot.MarkDirty();
player.inventory.loot.AddContainer(loot);
player.inventory.loot.SendImmediate();
player.ClientRPCPlayer(null, player, "RPC_OpenLootPanel", "genericlarge");
});
}
}
}
The problem is that right after that RPC, the containers UI gets deleted and suddenly shows normal quick craft menu
As you can see in this video (NSFW)
Anyone knows what's going on? It's such a small script that's giving me too many headaches!