C#:
using Oxide.Core;
using Oxide.Core.Plugins;
using Rust;
using UnityEngine;
using Oxide.Game.Rust.Cui;
namespace Oxide.Plugins
{
[Info("HellButtonCUI", "TuNombre", "1.3.0")]
[Description("Crea un botón CUI pequeño que llama al comando /rbe y cierra el panel al presionar")]
public class HellButtonCUI : RustPlugin
{
private void OnPlayerInit(BasePlayer player)
{
CreateButton(player);
}
private void CreateButton(BasePlayer player)
{
CuiHelper.DestroyUi(player, "HellButtonPanel");
var cui = new CuiElementContainer();
// Panel base gris oscuro más opaco
cui.Add(new CuiPanel
{
Image = { Color = "0.1 0.1 0.1 0.9" }, // más opaco
RectTransform = { AnchorMin = "0.43 0.1", AnchorMax = "0.57 0.25" }, // altura ~20 px, ancho reducido
CursorEnabled = true
}, "Overlay", "HellButtonPanel");
// Botón naranja que cierra el panel al presionar
cui.Add(new CuiButton
{
Button =
{
Color = "1 0.5 0 1",
Command = "rbe",
Close = "HellButtonPanel"
},
RectTransform = { AnchorMin = "0.1 0.1", AnchorMax = "0.9 0.25" },
Text =
{
Text = "HELL",
FontSize = 16, // más pequeño
Align = TextAnchor.MiddleCenter,
Color = "1 1 1 1"
}
}, "HellButtonPanel");
CuiHelper.AddUi(player, cui);
}
[ChatCommand("hellcui")]
private void CmdHellCui(BasePlayer player, string command, string[] args)
{
CreateButton(player);
}
}
}