C#:
using System;
using Oxide.Game.Rust.Cui;
using Oxide.Core;
using UnityEngine;
using Oxide.Core.Plugins;
namespace Oxide.Plugins {
[Info("help", "kurushimu", "1.0.0")]
public class helpp : RustPlugin {
[ChatCommand("help")]
void cmdChatPos(BasePlayer player) {
StatsUI(player);
}
void StatsUI(BasePlayer player, int page = 0) {
CuiHelper.DestroyUi(player, "MainStats");
var container = new CuiElementContainer();
container.Add(new CuiPanel {
CursorEnabled = true, RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
}
, Image = {
Color = "0 0 0 0"
}
}
, "Overlay", "MainStats");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0"
}
, Image = {
Color = "0 0 0 0.9", Material = "assets/icons/greyout.mat"
}
}
, "MainStats");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.31 0.2", AnchorMax = "0.69 0.8", OffsetMax = "0 0"
}
, Image = {
Color = "1 1 1 0"
}
}
, "MainStats", Layer);
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 0.23", AnchorMax = $"1 1", OffsetMax = "0 0"
}
, Image = {
Color = "0.36 0.34 0.32 0.75", Material = "assets/icons/greyout.mat"
}
}
, Layer, "Top");
/*container.Add(new CuiButton
{
RectTransform = { AnchorMin = $"0.003 0.94", AnchorMax = $"1 1", OffsetMax = "0 0" },
Button = { Color = "0.56 0.87 0.56 0" },
Text = { Text = $" # имя игрока награда очки", Color = "1 1 1 1", Align = TextAnchor.MiddleLeft, FontSize = 12, Font = "robotocondensed-regular.ttf" }
}, "Top");*/
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0.01 0.95", AnchorMax = $"1 1", OffsetMin = "2 1", OffsetMax = "-2 -1"
}
, Image = {
Color = "0.5 0.5 0.5 0"
}
}
, "Top", "TTT");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.0 -0.55", AnchorMax = $"0.07 1.215", OffsetMax = "0 0"
}
, Button = {
Color = "0.56 0.87 0.56 0"
}
, Text = {
Text = $"#", Color = "1 1 1 1", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "TTT");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.115 -0.55", AnchorMax = $"0.4 1.215", OffsetMax = "0 0"
}
, Button = {
Color = "0.56 0.87 0.56 0"
}
, Text = {
Text = $"ИМЯ ИГРОКА", Color = "1 1 1 1", Align = TextAnchor.MiddleLeft, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "TTT");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.4 -0.55", AnchorMax = $"0.565 1.215", OffsetMax = "0 0"
}
, Button = {
Color = "0.56 0.87 0.56 0"
}
, Text = {
Text = $"НАГРАДА", Color = "1 1 1 1", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "TTT");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.63 -0.55", AnchorMax = $"1.075 1.215", OffsetMax = "0 0"
}
, Button = {
Color = "0.56 0.87 0.56 0"
}
, Text = {
Text = $"ОЧКИ", Color = "1 1 1 1", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "TTT");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.8 0.02", AnchorMax = $"0.987 0.11", OffsetMax = "0 0"
}
, Button = {
Color = "0.46 0.44 0.42 1.00", Material = "assets/icons/greyout.mat", Close = "MainStats"
}
, Text = {
Text = $"ЗАКРЫТЬ", Color = "1 1 1 1", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "Top");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.38 0.02", AnchorMax = $"0.58 0.11", OffsetMax = "0 0"
}
, Button = {
Color = "0.38 0.71 0.12 0.7", Material = "assets/icons/greyout.mat", Command = $"stats profile {player.userID} 0"
}
, Text = {
Text = $"МОЙ ПРОФИЛЬ", Color = "1 1 1 1", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "Top");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.1525 0.02", AnchorMax = $"0.2225 0.11", OffsetMax = "0 0"
}
, Button = {
Color = "0.46 0.44 0.42 1.00", Material = "assets/icons/greyout.mat", Command = DB.Count() > (page + 1) * 10 ? $"stats skip {page + 1}" : ""
}
, Text = {
Text = $">", Color = DB.Count() > (page + 1) * 10 ? "1 1 1 1" : "1 1 1 0.5", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "Top");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.0825 0.02", AnchorMax = $"0.1525 0.11", OffsetMax = "0 0"
}
, Button = {
Color = "0.3294118 0.3294118 0.3294118 1", Material = "assets/icons/greyout.mat", Command = ""
}
, Text = {
Text = $"{page + 1}", Color = "1 1 1 1", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "Top");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0.0125 0.02", AnchorMax = $"0.0825 0.11", OffsetMax = "0 0"
}
, Button = {
Color = "0.46 0.44 0.42 0.77", Material = "assets/icons/greyout.mat", Command = page >= 1 ? $"stats skip {page - 1}" : ""
}
, Text = {
Text = $"<", Color = page >= 1 ? "1 1 1 1" : "1 1 1 0.5", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "Top");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = $"1 0.22", OffsetMax = "0 0"
}
, Image = {
Color = "0.36 0.34 0.32 0.75", Material = "assets/icons/greyout.mat",
}
}
, Layer, "InfoTop");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0.01 0.01", AnchorMax = $"0.99 0.99", OffsetMax = "0 0"
}
, Text = {
Text = "Очки даются:\nУбийство +1, добыча руды +7, разрушение бочки +2, сбитие вертолета +1500, уничтожение танка +750\nОчки отнимаются:\nСмерть и самоубийство -1\nНаграды выдаются после вайпа на сервере!", Color = "1 1 1 0.8", Align = TextAnchor.MiddleLeft, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "InfoTop");
float width1 = 0.785f, height1 = 0.063f, startxBox1 = 0.01f, startyBox1 = 0.95f - height1, xmin1 = startxBox1, ymin1 = startyBox1;
if (page == 0) {
for (int x = 0; x < DB.Take(10).Count();
x++) {
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = $"{xmin1} {ymin1}", AnchorMax = $"{xmin1 + width1} {ymin1 + height1 * 1}", OffsetMin = "2 1", OffsetMax = "-2 -1"
}
, Image = {
Color = "0 0 0 0"
}
}
, Layer, "PlayerTop");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = $"0.46 0", AnchorMax = $"0.75 1", OffsetMax = "0 0"
}
, Text = {
Text = $"{config.Bonus.ElementAt(x)}", Color = "1 1 1 0.8", Align = TextAnchor.MiddleCenter, FontSize = 14, Font = "robotocondensed-regular.ttf"
}
}
, "PlayerTop");
xmin1 += width1;
if (xmin1 + width1 >= 1) {
xmin1 = startxBox1;
ymin1 -= height1;
}
}
}
float width = 0.98f, height = 0.063f, startxBox = 0.01f, startyBox = 0.95f - height, xmin = startxBox, ymin = startyBox, z = 0;
var items = from item in DB orderby item.Value.Points descending select item;
foreach (var check in items.Skip(page * 10).Take(10)) {
z++;
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = $"{xmin} {ymin}", AnchorMax = $"{xmin + width} {ymin + height * 1}", OffsetMin = "2 1", OffsetMax = "-2 -1"
}
, Image = {
Color = "0 0 0 0"
}
}
, Layer, "PlayerTop");
container.Add(new CuiPanel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = $"1 1", OffsetMax = "0 0"
}
, Image = {
Color = "1 1 1 0.1"
}
}
, "PlayerTop");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = $"0 0", AnchorMax = $"0.08 1", OffsetMax = "0 0"
}
, Text = {
Text = $"{z + page * 10}", Color = "1 1 1 0.8", Align = TextAnchor.MiddleCenter, FontSize = 14, Font = "robotocondensed-regular.ttf"
}
}
, "PlayerTop");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = $"0.115 0", AnchorMax = $"0.425 1", OffsetMax = "0 0"
}
, Text = {
Text = $"{check.Value.DisplayName}", Color = "1 1 1 0.8", Align = TextAnchor.MiddleLeft, FontSize = 14, Font = "robotocondensed-regular.ttf"
}
}
, "PlayerTop");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = $"0.4 0", AnchorMax = $"0.575 1", OffsetMax = "0 0"
}
, Text = {
Text = $"", Color = "1 1 1 0.8", Align = TextAnchor.MiddleCenter, FontSize = 14, Font = "robotocondensed-regular.ttf"
}
}
, "PlayerTop");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = $"0.63 0", AnchorMax = $"1.1 1", OffsetMax = "0 0"
}
, Text = {
Text = $"{check.Value.Points}", Color = "1 1 1 0.8", Align = TextAnchor.MiddleCenter, FontSize = 14, Font = "robotocondensed-regular.ttf"
}
}
, "PlayerTop");
container.Add(new CuiButton {
RectTransform = {
AnchorMin = $"0 0", AnchorMax = $"1 1", OffsetMax = "0 0"
}
, Button = {
Color = "0 0 0 0", Command = $"stats profile {check.Key} {z + page * 10}"
}
, Text = {
Text = $"", Color = "1 1 1 1", Align = TextAnchor.MiddleCenter, FontSize = 12, Font = "robotocondensed-regular.ttf"
}
}
, "PlayerTop");
xmin += width;
if (xmin + width >= 1) {
xmin = startxBox;
ymin -= height;
}
}
CuiHelper.AddUi(player, container);
}
}