Hello. I want to make a plugin to display the location in XYZ in CUI, but I can't, because the text is not output. There are no errors in the console.
Here's the CODE.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Newtonsoft.Json;
using Oxide.Game.Rust.Cui;
using static Oxide.Game.Rust.Cui.CuiElement;
using Oxide.Game.Rust.Cui;
using Oxide.Core;
using Oxide.Core.Plugins;
using Oxide.Core.Libraries;
using Oxide.Game.Rust.Cui;
using UnityEngine;
using Oxide.Core.Libraries.Covalence;
namespace Oxide.Plugins
{
[Info("Position GUI", "popCat69", "0.1.0")]
[Description("Show you pos at XYZ.")]
public class PositionGUI : RustPlugin
{
private void Init()
{
Puts("Loaded.");
}
[ChatCommand("pos")]
void cmdChatpos(BasePlayer player)
{
player.ChatMessage($"Ваша позиция: {player.GetNetworkPosition()}");
}
[ChatCommand("poss")]
void cmdChatposs(BasePlayer player)
{
var elements = new CuiElementContainer();
var mainName = elements.Add(new CuiPanel
{
Image =
{
Color = "0.34 0.31 0.31 0.85"
},
RectTransform =
{
AnchorMin = "0.681 0.944",
AnchorMax = "0.889 0.991"
}
}, "Overall");
var closeButton = new CuiButton
{
Button =
{
Close = mainName,
Color = "1 0.29 0.29 0.80"
},
RectTransform =
{
AnchorMin = "0.895 0.18",
AnchorMax = "0.97 0.78"
},
Text =
{
Text = "X",
Font = "robotocondensed-bold.ttf",
FontSize = 22,
Align = TextAnchor.MiddleCenter
}
};
elements.Add(closeButton, mainName);
elements.Add(new CuiLabel
{
Text =
{
Text = "Position: " + player.GetNetworkPosition(),
Font = "robotocondensed-bold.ttf",
FontSize = 18,
Align = TextAnchor.MiddleCenter
},
RectTransform =
{
AnchorMin = "0.033 0.34",
AnchorMax = "0.41 0.78"
}
}, mainName);
Puts(elements.ToString());
CuiHelper.AddUi(player, elements);
}
}
}