void GUI(BasePlayer player, string msg)
{
CuiHelper.DestroyUi(player, "PlayerID");
var elements = new CuiElementContainer();
var GUI = elements.Add(new CuiPanel
{
Image =
{
Color = "0 0 0 0.3"
},
RectTransform =
{
AnchorMin = "0.66, 0.957",
AnchorMax = "0.802, 1"
},
CursorEnabled = false
}, "Overlay", "PlayerID");
elements.Add(new CuiElement
{
Parent = "PlayerID",
Components =
{
new CuiTextComponent
{
Text = $"{player.userID}",
Color = "",
FontSize = 14,
Align = TextAnchor.MiddleCenter
},
new CuiRectTransformComponent
{
AnchorMin = "0 0",
AnchorMax = "1 1"
}
}
});
elements.Add(new CuiLabel
{
Text =
{
Text = "Test",
FontSize = 12,
Align = TextAnchor.MiddleCenter
},
RectTransform =
{
AnchorMin = "0.175 0",
AnchorMax = "1 1"
}
}, GUI);
CuiHelper.AddUi(player, elements);
}
void OnPlayerInit(BasePlayer player)
{
GUI(player, player.UserIDString);
}
[ChatCommand("t")]
void TestCommands(BasePlayer player, string cmd, string[] args)
{
GUI(player, player.UserIDString);
} RPC Error in AddUI: Input string was not in a correct formatSolved
Kick Reason: RPC Error in AddUI: Input string was not in a correct format.
I suppose text color should be set but it's not. Just don't set it and leave the default value :)
Locked automatically