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

FREE XNickController : 1.0.0 1.0.0

Нет прав для скачивания
C#:
using Oxide.Game.Rust.Cui;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using System;
using Oxide.Core.Plugins;
using System.Linq;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("XNickController", "TopPlugin.ru", "1.0.0")]
    public class XNickController : RustPlugin
    {
		#region Configuration

        private NickConfig config;

        private class NickConfig
        {		
			internal class SymbolSetting
            {
                [JsonProperty("?_?")]
                public List<string> SymbolList = new List<string>();           				
            }			
            
			[JsonProperty("Список символов/слов которые нужно удалять из ника")]
            public SymbolSetting Symbol = new SymbolSetting();										
			
			public static NickConfig GetNewConfiguration()
            {
                return new NickConfig
                {
					Symbol = new SymbolSetting
					{
						SymbolList = new List<string>
						{
							"#XRUST",
							"#LALARUST",
							"#XRUST RUST",
							".ua",
							".ru",
							".com"
						}
					},
				};
			}
        }

        protected override void LoadDefaultConfig()
        {
            config = NickConfig.GetNewConfiguration();

            PrintWarning("Создание начальной конфигурации плагина!!!");
        }
        protected override void LoadConfig()
        {
            base.LoadConfig();

            config = Config.ReadObject<NickConfig>();
        }
        protected override void SaveConfig()
        {
            Config.WriteObject(config);
        }

        #endregion
		
		#region Hooks
		
		private void OnServerInitialized()
		{
			
			foreach (BasePlayer player in BasePlayer.activePlayerList)
            {
				foreach (var symbol in config.Symbol.SymbolList)
			    {
				    if (player.displayName.Contains(symbol))
				    {
					    player.displayName = player.displayName.Replace(symbol, "");
				    }
			    }
            }
		}
		
		void OnPlayerConnected(BasePlayer player)
		{
			if (player.IsReceivingSnapshot)
            {
                NextTick(() => OnPlayerConnected(player));
                return;
            }
			
			foreach (var symbol in config.Symbol.SymbolList)
			{
				if (player.displayName.Contains(symbol))
				{
					player.displayName = player.displayName.Replace(symbol, "");
				}
			}
		}
		
		#endregion
	}
}

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

Другие ресурсы пользователя 15FPS

Сверху