Иконка ресурса

FREE Statistics : 0.1.5 0.1.5

Нет прав для скачивания
C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Facepunch.Math;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using Rust;
using UnityEngine;
namespace Oxide.Plugins {
    [Info("Statistics", "oxide-russia.ru", "0.1.5")]
    [Description("Statistics")]
    public class Statistics : RustPlugin {
        [PluginReference]
        Plugin ImageLibrary;
        private StoredData DataBase = new StoredData();
        public ulong lastDamageName;
        public string GetImage(string shortname, ulong skin = 0) => (string)ImageLibrary?.Call("GetImage", shortname, skin);
#region Config
        private static ConfigFile config;
        public class ConfigFile {
            [JsonProperty(PropertyName = "StatsCmd")]
            public string StatsCmd {
                get;
                set;
            }
            = "stats";
            [JsonProperty(PropertyName = "ServerNAME")]
            public string ServerName {
                get;
                set;
            }
            = "YourServerName";
            [JsonProperty(PropertyName = "MainHeaderColor")]
            public string MainHeaderColor {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "MainHeaderButtonColor")]
            public string MainHeaderButtonColor {
                get;
                set;
            }
            = "#969696FF";
            [JsonProperty(PropertyName = "MainHeaderButtonEdgeColor")]
            public string MainHeaderButtonEdgeColor {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "MainHeaderButtonCloseColor")]
            public string MainHeaderButtonCloseColor {
                get;
                set;
            }
            = "#969696FF";
            [JsonProperty(PropertyName = "PlayerStatsHeaderColor1")]
            public string PlayerStatsHeaderColor1 {
                get;
                set;
            }
            = "#969696FF";
            [JsonProperty(PropertyName = "PlayerStatsHeaderColor2")]
            public string PlayerStatsHeaderColor2 {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "PlayerStatsBlocColor1")]
            public string PlayerStatsBlocColor1 {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "PlayerStatsBlocColor2")]
            public string PlayerStatsBlocColor2 {
                get;
                set;
            }
            = "#969696FF";
            [JsonProperty(PropertyName = "PlayerStatsProfileLineColor")]
            public string PlayerStatsProfileLineColor {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "PlayerStatsTextColor")]
            public string PlayerStatsTextColor {
                get;
                set;
            }
            = "#FFFFFFFF";
            [JsonProperty(PropertyName = "ServerStatsButtonsUpLine")]
            public string ServerStatsButtonsUpLine {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "ServerStatsButtonsDownLine")]
            public string ServerStatsButtonsDownLine {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "ServerStatsButtonsColor")]
            public string ServerStatsButtonsColor {
                get;
                set;
            }
            = "#969696FF";
            [JsonProperty(PropertyName = "ServerStatsButtonsEdgeColor")]
            public string ServerStatsButtonsEdge {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "ServerStatsTopColor1")]
            public string ServerStatsTopColor1 {
                get;
                set;
            }
            = "#C6C6C6FF";
            [JsonProperty(PropertyName = "ServerStatsTopColor2")]
            public string ServerStatsTopColor2 {
                get;
                set;
            }
            = "#969696FF";
            [JsonProperty(PropertyName = "ServerStatsTopEdgeColor")]
            public string ServerStatsTopEdgeColor {
                get;
                set;
            }
            = "#FFFFFFFF";
            [JsonProperty(PropertyName = "ServerStatsTextColor")]
            public string ServerStatsTextColor {
                get;
                set;
            }
            = "#FFFFFFFF";
            [JsonProperty(PropertyName = "ServerStatsTopTextColor1")]
            public string ServerStatsTopTextColor1 {
                get;
                set;
            }
            = "#FFFFFFFF";
            [JsonProperty(PropertyName = "ServerStatsTopTextColor2")]
            public string ServerStatsTopTextColor2 {
                get;
                set;
            }
            = "#FFFFFFFF";
        }
        protected override void SaveConfig() => Config.WriteObject(config);
        protected override void LoadConfig() {
            base.LoadConfig();
            try {
                config = Config.ReadObject<ConfigFile>();
                if (config == null) Regenerate();
            }
            catch {
                Regenerate();
            }
        }
        private void Regenerate() {
            LoadDefaultConfig();
        }
        protected override void LoadDefaultConfig() {
            var config = new ConfigFile();
            Config.WriteObject(config);
        }
#endregion
#region Lang
        private new void LoadDefaultMessages() {
            lang.RegisterMessages(new Dictionary<string, string>() {
                ["MyStatsButton"]
                = "Моя статистика", ["ServerStatsButton"] = "Обшая статистика", ["AnimalKillHeader"] = "Убийства животных", ["Bears"] = "Медведей", ["Horses"] = "Лошадей", ["Stug"] = "Оленей", ["Boar"] = "Кабанов", ["Chicken"] = "Куриц", ["Wolf"] = "Волков", ["KillsHeader"] = "Убийства", ["Kills"] = "Убийств", ["Deatchs"] = "Смертей", ["Animals"] = "Животных", ["Bradleys"] = "Танков", ["Helis"] = "Вертолётов", ["GatherHeader"] = "Добыто", ["Sulfur"] = "Сера", ["Stones"] = "Камни", ["Metal"] = "Железа", ["Wood"] = "Дерева", ["Profile"] = "Профиль", ["Time"] = "Время", ["TimeButton"] = "Время", ["KillsButton"] = "Убийств", ["DeatchsButton"] = "Смертей", ["AnimalsButton"] = "Животных", ["BradleysButton"] = "Танк", ["HelisButton"] = "Верт", ["SulfurButton"] = "Сера", ["StonesButton"] = "Камни", ["MetalButton"] = "Железа", ["WoodButton"] = "Дерева"
            }
            , this);
        }
#endregion
#region Data
        public class StoredData {
            public Dictionary<ulong, PlayerInfo> PlayerInfo = new Dictionary<ulong, PlayerInfo>();
        }
        public enum Animal {
            Bear, Boar, Chicken, Wolf, Horse, Stag
        }
        public class PlayerInfo {
            public string Name;
            public int kills;
            public int deaths;
            public int animalkills;
            public int bradleykills;
            public int helikills;
            public int wood;
            public int stones;
            public int irons;
            public int sulfur;
            public int time;
            public int Bear;
            public int Boar;
            public int Chicken;
            public int Wolf;
            public int Horse;
            public int Stag;
            public PlayerInfo() {
            }
        }
        private void SaveData() => Interface.Oxide.DataFileSystem.WriteObject(Name, DataBase);
        private void LoadData() {
            try {
                DataBase = Interface.GetMod().DataFileSystem.ReadObject<StoredData>(Name);
            }
            catch (Exception e) {
                DataBase = new StoredData();
            }
        }
        void AddPlayer(BasePlayer player) {
            var data = new PlayerInfo {
                Name = player.displayName, kills = 0, deaths = 0, animalkills = 0, bradleykills = 0, helikills = 0, wood = 0, stones = 0, irons = 0, sulfur = 0, time = 0, Bear = 0, Boar = 0, Chicken = 0, Wolf = 0, Horse = 0, Stag = 0
            }
            ;
            DataBase.PlayerInfo.Add(Convert.ToUInt64(player.userID), data);
            SaveData();
        }
#endregion
        //Desigh by Kira
#region PlayerStatsGui
        public void PlayerStatGuiCreate(BasePlayer player) {
            if(player == null) return;
            string AvatarImage = GetImage(player.UserIDString, 0);
            var Data = DataBase.PlayerInfo[player.userID];
            CuiHelper.DestroyUi(player, "PlayerStats");
            var PlayerStatsGui = new CuiElementContainer();
            var PlStatsGui = PlayerStatsGui.Add(new CuiPanel {
                Image = {
                    Color = "0 0 0 0"
                }
                , RectTransform = {
                    AnchorMax = "1 1", AnchorMin = "0 0"
                }
            }
            , "Hud", "PlayerStats");
            PlayerStatsGui.Add(new CuiButton {
                Button = {
                    Close = "PlayerStats", Color = "0 0 0 0",
                }
                , RectTransform = {
                    AnchorMax = "1 1", AnchorMin = "0 0"
                }
                , Text = {
                    Text = "", Color = "0 0 0 0"
                }
            }
            , PlStatsGui);
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats", Name = "PlayerStats"+ "BackGround", Components = {
                    new CuiRawImageComponent() {
                        Color = "0 0 0 0.50", Sprite = "assets/content/ui/ui.spashscreen.psd", Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2202381 0.361979", AnchorMax = "0.770864 0.8125"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.MainHeaderColor)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0 0.896152", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiTextComponent() {
                        Text = config.ServerName, FontSize = 28, Align = TextAnchor.MiddleCenter
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2690016 0.8855821", AnchorMax = "0.9349946 1.016647"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = "0 0 0 0.5"
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.8401511 0.7185797", AnchorMax = "0.9945088 0.8945763"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsProfileLineColor)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.8412383 0.8017578", AnchorMax = "0.9966829 0.8123275"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsProfileLineColor)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.994765 0.3296121", AnchorMax = "1.0002 0.9088357"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Profile", this), FontSize = 18, Align = TextAnchor.MiddleCenter
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.8368888 0.8158216", AnchorMax = "0.9955958 0.896152"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "PlayerImg", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiRawImageComponent() {
                        Color = "1 1 1 1", Png = AvatarImage
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.8401511 0.4078285", AnchorMax = "0.9934217 0.7249228"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "PlayerImg", Components = {
                    new CuiTextComponent() {
                        Text = player.displayName, Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 14, Align = TextAnchor.MiddleCenter
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0 1", AnchorMax = "1 1.246667"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsProfileLineColor)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.8401511 0.3296115", AnchorMax = "0.9944085 0.4079273"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Time", this)+" "+GetPlaytimeClock(Data.time), Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 15, Align = TextAnchor.MiddleCenter
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.8401511 0.3296115", AnchorMax = "0.9944085 0.4079273"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "GatherHeader", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.5626061 0.8033028", AnchorMax = "0.8289275 0.8794051"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "GatherHeader", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0 -0.155246", AnchorMax = "1 0"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "GatherHeader", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.979881 -0.155246", AnchorMax = "1 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "GatherHeader", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("GatherHeader", this), Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 20, Align = TextAnchor.MiddleCenter
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Sulfur", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.5626054 0.7081748", AnchorMax = "0.8017511 0.7779353"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Sulfur", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.97"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Sulfur", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Sulfur", this)+": "+Data.sulfur+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Stones", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.56260444 0.6278445", AnchorMax = "0.80175 0.697605"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Stones", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Stones", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Stones", this)+": "+Data.stones+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Metal", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.5626044 0.5475143", AnchorMax = "0.80175 0.6172748"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Metal", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Metal", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Metal", this)+": "+Data.irons+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Wood", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.5626044 0.467184", AnchorMax = "0.80175 0.5369444"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Wood", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Wood", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Wood", this)+": "+Data.wood+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "KillsHeader", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2807915 0.8033028", AnchorMax = "0.5471129 0.8794051"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "KillsHeader", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0 -0.155246", AnchorMax = "1 0"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "KillsHeader", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.979881 -0.155246", AnchorMax = "1 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "KillsHeader", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("KillsHeader", this), Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.MiddleCenter
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.016042 0.038466", AnchorMax = "0.962574 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Players", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2807903 0.7081748", AnchorMax = "0.519936 0.7779353"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Players", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.97"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Players", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Kills", this)+": "+Data.kills+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Death", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2807903 0.6278445", AnchorMax = "0.519936 0.697605"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Death", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Death", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Deatchs", this)+": "+Data.deaths+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Animals", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2807903 0.5475143", AnchorMax = "0.519936 0.6172737"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Animals", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Animals", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Animals", this)+": "+Data.animalkills+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Bradley", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2807903 0.467184", AnchorMax = "0.519936 0.5369449"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Bradley", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Bradley", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Bradleys", this)+": "+Data.bradleykills+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Heli", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2807903 0.3868537", AnchorMax = "0.519936 0.4566151"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Heli", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Heli", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Helis", this)+": "+Data.helikills+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "AnimalsKillHeader", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.002174052 0.8033028", AnchorMax = "0.2684954 0.8794054"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "AnimalsKillHeader", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0 -0.155247", AnchorMax = "1 0"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "AnimalsKillHeader", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsHeaderColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.979881 -0.155246", AnchorMax = "1 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "AnimalsKillHeader", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("AnimalKillHeader", this), FontSize = 17, Align = TextAnchor.MiddleCenter
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.016042 0.038466", AnchorMax = "0.962574 1.03847"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Bears", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.002174052 0.7081748", AnchorMax = "0.2413198 0.7779353"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Bears", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.97"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Bears", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Bears", this)+": "+Data.Bear+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 0.97"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Horse", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.002174052 0.6278445", AnchorMax = "0.2413224 0.697605"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Horse", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Horse", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Horses", this)+": "+Data.Horse+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Deer", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.002174052 0.5475143", AnchorMax = "0.2413224 0.6172748"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Deer", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Deer", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Stug", this)+": "+Data.Stag+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Boar", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.002174052 0.467184", AnchorMax = "0.2413224 0.536945"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Boar", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Boar", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Boar", this)+": "+Data.Boar+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Chicken", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.002174052 0.3868537", AnchorMax = "0.2413224 0.4566142"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Chicken", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.95"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Chicken", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Chicken", this)+": "+Data.Chicken+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Name = "PlayerStats" + "Wolf", Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor1)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.002174052 0.3065234", AnchorMax = "0.2413224 0.3762839"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Wolf", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.PlayerStatsBlocColor2)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "1 0", AnchorMax = "1.027175 0.97"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "Wolf", Components = {
                    new CuiTextComponent() {
                        Text = lang.GetMessage("Wolf", this)+": "+Data.Wolf+"", Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 18, Align = TextAnchor.UpperLeft
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.033148 0", AnchorMax = "1 1"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiElement {
                Parent = "PlayerStats" + "BackGround", Components = {
                    new CuiImageComponent() {
                        Color = HexToRustFormat(config.MainHeaderButtonEdgeColor)
                    }
                    , new CuiRectTransformComponent() {
                        AnchorMin = "0.2492921 0.896152", AnchorMax = "0.2542441 0.9997358"
                    }
                }
            }
            );
            PlayerStatsGui.Add(new CuiButton {
                Button = {
                    Color = HexToRustFormat(config.MainHeaderButtonColor), Command = "serverstats_gui"
                }
                , RectTransform = {
                    AnchorMax = "0.248104 1", AnchorMin = "0 0.896152"
                }
                , Text = {
                    Text = lang.GetMessage("ServerStatsButton", this), Color = HexToRustFormat(config.PlayerStatsTextColor), FontSize = 16, Align = TextAnchor.MiddleCenter
                }
            }
            , "PlayerStats"+ "BackGround");
            PlayerStatsGui.Add(new CuiButton {
                Button = {
                    Color = HexToRustFormat(config.MainHeaderButtonCloseColor), Close = "PlayerStats"
                }
                , RectTransform = {
                    AnchorMax = "1 1", AnchorMin = "0.9499407 0.9257474"
                }
                , Text = {
                    Text = "X", FontSize = 20, Align = TextAnchor.MiddleCenter
                }
            }
            , "PlayerStats"+ "BackGround");
            CuiHelper.AddUi(player, PlayerStatsGui);
        }
#endregion
        //Desigh by Kira
#region ServerTopGui
        public void ServerStatGuiCreate(BasePlayer player) {
            if (player == null) return;
            CuiHelper.DestroyUi(player, "ServerStats");
            var ServerStatsGui = new CuiElementContainer();
            var SrvStatsGui = ServerStatsGui.Add(new CuiPanel {
                Image = {
                    Color = "0 0 0 0"
                }
                , RectTransform = {
                    AnchorMax = "1 1", AnchorMin = "0 0"
                }
            }
            , "Hud", "ServerStats");
            ServerStatsGui.Add(new CuiButton {
                Button = {
                    Close = "ServerStats", Color = "0 0 0 0"
                }
                , RectTransform = {
                    AnchorMax = "1 1", AnchorMin = "0 0"
                }
            }
            , SrvStatsGui);
            ServerStatsGui.Add(new CuiElement {
                Parent = "ServerStats", Name = "ServerStatsBackGround", Components = {
                    new C
// ... [Code preview truncated due to length. Full source in attached file] ...

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху