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

FREE WelcomeConsole : 0.2.2 0.2.2

Нет прав для скачивания
C#:
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Libraries.Covalence;
using Oxide.Plugins;
using System;
using UnityEngine;
using CompanionServer;
namespace Oxide.Plugins // Here it begins
{
    [Info("WelcomeConsole", "Disguise", "0.2.2")]
    [Description("Give a warm welcome to your players in a fancy way.")]
    class WelcomeConsole : RustPlugin {
#region Config
        private static ConfigData configData;
        private class ConfigData {
            [JsonProperty(PropertyName = "Texts")]
            public Text text {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Text Colors")]
            public TextColor textcolor {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Text Sizes")]
            public TextSize textsize {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Chat")]
            public Chat chat {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Admin")]
            public Admin admin {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Version")]
            public VersionNumber version {
                get;
                set;
            }
        }
        private class Text {
            [JsonProperty(PropertyName = "Welcome")]
            public string welcome {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Server Name")]
            public string servername {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Server Description")]
            public string serverdescription {
                get;
                set;
            }
            [JsonProperty(PropertyName = "GLHF / Endline")]
            public string glhf {
                get;
                set;
            }
        }
        private class TextColor {
            [JsonProperty(PropertyName = "Welcome HEX")]
            public string welcomehex {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Server Name HEX")]
            public string servernamehex {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Server Description HEX")]
            public string serverdescriptionhex {
                get;
                set;
            }
            [JsonProperty(PropertyName = "GLHF / Endline HEX")]
            public string glhfhex {
                get;
                set;
            }
        }
        private class TextSize {
            [JsonProperty(PropertyName = "Welcome & Server Name size")]
            public int welcomesize {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Server Description size")]
            public int descriptionsize {
                get;
                set;
            }
            [JsonProperty(PropertyName = "GLHF / Endline size")]
            public int glhfsize {
                get;
                set;
            }
        }
        private class Chat {
            [JsonProperty(PropertyName = "Enable Welcome Message")]
            public bool prnt_to_chat {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Chat Message (When Player Connects)")]
            public string chat_msg {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Enable Welcome Broadcast")]
            public bool enable_bc_c {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Broadcast Message (When Player Connects)")]
            public string chat_bc_c {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Enable Farewell Broadcast")]
            public bool enable_bc_dc {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Broadcast Message (When Player Disconnects)")]
            public string chat_bc_dc {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Chat Icon (Steam64ID, use 0 to set as default)")]
            public ulong chat_icon {
                get;
                set;
            }
        }
        private class Admin {
            [JsonProperty(PropertyName = "Enable Greet Admins")]
            public bool greet_admins {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Chat Message")]
            public string chat_msg_admin {
                get;
                set;
            }
        }
        private ConfigData GetBaseConfig() {
            return new ConfigData {
                text = new Text {
                    welcome = "Welcome to", servername = "My Server Name", serverdescription = "This is the server description.\n- 2x gather rate\n- custom monuments\n- For more info, go to: discord.gg/mylink", glhf = "Good Luck & Have Fun!"
                }
                , textcolor = new TextColor {
                    welcomehex = "#ffff00", servernamehex = "#00ffa2", serverdescriptionhex = "#ffffff", glhfhex = "#ffffaa"
                }
                , textsize = new TextSize {
                    welcomesize = 30, descriptionsize = 12, glhfsize = 10
                }
                , chat = new Chat {
                    prnt_to_chat = true, chat_msg = "Press <color=orange>F1</color> to view the information about the server.", enable_bc_c = true, chat_bc_c = "is connected", enable_bc_dc = false, chat_bc_dc = "is disconnected", chat_icon = 76561199163635223
                }
                , admin = new Admin {
                    greet_admins = true, chat_msg_admin = "is here to give you anxiety."
                }
                , version = Version
            }
            ;
        }
        protected override void LoadConfig() {
            base.LoadConfig();
            configData = Config.ReadObject<ConfigData>();
            if (configData.version < Version) UpdateConfigValues();
            Config.WriteObject(configData, true);
        }
        protected override void LoadDefaultConfig() => configData = GetBaseConfig();
        protected override void SaveConfig() => Config.WriteObject(configData, true);
        private void UpdateConfigValues() {
            PrintWarning("Config File Update Detected! Updating config file...");
            ConfigData baseConfig = GetBaseConfig();
            configData.version = Version;
            PrintWarning("Config File Update Completed! You can continue...");
        }
#endregion
#region Actions
        private void OnPlayerConnected(BasePlayer player, string message) {
            if (configData.chat.enable_bc_c) {
                string msg = $"<color=orange>{player.displayName}</color> {configData.chat.chat_bc_c}";
                Server.Broadcast(msg, configData.chat.chat_icon);
            }
        }
        private void OnPlayerDisconnected(BasePlayer player, string message) {
            if (configData.chat.enable_bc_dc) {
                string msg = $"<color=orange>{player.displayName}</color> {configData.chat.chat_bc_dc}";
                Server.Broadcast(msg, configData.chat.chat_icon);
            }
        }
        private void OnPlayerSleepEnded(BasePlayer player, string message) {
            if (configData.chat.prnt_to_chat) {
                string msg = $"{configData.chat.chat_msg}";
                SendReply(player, msg, configData.chat.chat_icon);
            }
            if (configData.admin.greet_admins && player.IsAdmin) {
                string msg = $"<color=green>{player.displayName}</color> {configData.admin.chat_msg_admin}";
                Server.Broadcast(msg, configData.chat.chat_icon);
            }
            PrintToConsole(player, $"<size={configData.textsize.welcomesize}><color={configData.textcolor.welcomehex}>{configData.text.welcome}</color> <color={configData.textcolor.servernamehex}>{configData.text.servername}</color></size>\n\n<size={configData.textsize.descriptionsize}><color={configData.textcolor.serverdescriptionhex}>{configData.text.serverdescription}</color></size>\n\n<size={configData.textsize.glhfsize}><color={configData.textcolor.glhfhex}>{configData.text.glhf}</color></size>");
        }
#endregion
    }
}

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