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

FREE AlwaysOnHotAirBalloon : 0.0.5 0.0.5

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

namespace Oxide.Plugins
{
    [Info("AlwaysOn HotAirBalloon", "bsdinis", "0.0.5")]
    [Description("Prevents Hot Air Balloons from turning themselves off if there are players inside.")]
    public class AlwaysOnHotAirBalloon : RustPlugin
    {
        List<HotAirBalloon> habs = new List<HotAirBalloon>();
        private void OnServerInitialized()
        {
            timer.Repeat(29f, 0, () =>
            {
                foreach (var hab in habs.ToList())
                {
                    if (hab == null || !hab.IsOn())
                    {
                        habs.Remove(hab);
                        continue;
                    }
                    if (hab.IsOn())
                    {
                        foreach (var player in hab.GetComponentsInChildren<BasePlayer>())
                        {
                            if (player == null || !player.IsConnected || player.IsSleeping()) continue;
                            if (hab.GetComponent<FacepunchBehaviour>().IsInvoking(hab.ScheduleOff)) hab.CancelInvoke(new Action(hab.ScheduleOff));
                            return;
                        }
                        if (!hab.GetComponent<FacepunchBehaviour>().IsInvoking(hab.ScheduleOff)) hab.Invoke(new Action(hab.ScheduleOff), 30f);
                    }
                }
            });
        }
        private void OnHotAirBalloonToggle(HotAirBalloon hab) => habs.Add(hab);
        private void OnEntityKill(HotAirBalloon hab) { if (habs.Contains(hab)) habs.Remove(hab); }
        private void Unload() { foreach (var hab in habs) { if (hab.IsOn() && !hab.GetComponent<FacepunchBehaviour>().IsInvoking(hab.ScheduleOff)) hab.Invoke(new Action(hab.ScheduleOff), 60f); } }
    }
}

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