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

FREE FixActivePlayerList : 0.0.1 0.0.1

Нет прав для скачивания
C#:
using System.Linq;

namespace Oxide.Plugins
{
    [Info("FixActivePlayerList", "rostov114", "0.0.1")] //and fix error: global.playerlist (Facepunch.Raknet)
    class FixActivePlayerList : RustPlugin
    {
        void OnServerInitialized()
        {
            timer.Every(10f, () =>
            {
                BasePlayer errorPlayer = null;

                foreach (var activePlayer in BasePlayer.activePlayerList.ToList())
                {
                    if (!IsValid(activePlayer))
                    {
                        Puts("Kill: " + activePlayer);
                        activePlayer.Kill();
                    }

                    try
                    {
                        var ping = Network.Net.sv.GetAveragePing(activePlayer.net.connection);
                    }
                    catch
                    {
                        errorPlayer = activePlayer;
                    }
                }

                if (errorPlayer != null)
                {
                    Puts($"Removed: {errorPlayer.displayName} ({errorPlayer.userID})");
                    BasePlayer.activePlayerList.Remove(errorPlayer);
                }
            });
        }

        bool IsValid(BasePlayer player)
        {
            if (player is HTNPlayer || player is Scientist || player is NPCPlayer || player.userID < 76561197960265728L)
                return false;
            return true;
        }
    }
}

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

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

Сверху