Hello, not long ago I created my own menu on my server. But I ran into an incomprehensible problem, my plugin is working (normal for 3 lines to check) and the menu UI does not appear on the screen
using Oxide.Game.Rust.Cui;
namespace Oxide.Plugins
{
[Info("Menu Start", "NiceGame", "0.0.1")]
class MenuStart : RustPlugin
{
void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
{
var player = info.InitiatorPlayer;
if (player && player.IsAlive())
{
NextTick(() =>
{
if (entity.IsAlive())
{
string json = CUI_MAIN;
CuiHelper.AddUi(player, json);
Puts("Работает!");
}
});
}
}
[ChatCommand("menu")]
void ChatCommandmenu (BasePlayer player)
{
string json = CUI_MAIN;
CuiHelper.AddUi(player, json);
Puts("Работает!");
}
const string CUI_MAIN = @"
{
""menu"": [
{
""name"": ""menu_bg"",
""parent"": ""Overlay"",
""components"": [
{
""type"": ""RectTransform"",
""anchormin"": ""0.06 0"",
""anchormax"": ""0.06 0"",
""offsetmin"": ""-43 43"",
""offsetmax"": ""86 70""
},
{
""type"": ""UnityEngine.UI.Image"",
""sprite"":""Assets/Icons/rust.png"",
""color"": ""0.5254902 0.5254902 0.5254902 0.2980392""
}
]
}
]
}
";
}
}