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

FREE NoGibs : 0.0.6 0.0.6

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

namespace Oxide.Plugins
{
    [Info("No Gibs", "bsdinis", "0.0.6")]
    [Description("Instantly kills gibs from Patrol, Bradley APC, CH47 or Scrap Helicopter.")]
    class NoGibs : RustPlugin
    {
        void Init()
        {
            try
            {
                config = Config.ReadObject<ConfigData>();
                if (config == null)
                {
                    throw new Exception();
                }
                else
                {
                    SaveConfig();
                }
            }
            catch
            {
                PrintError("CONFIG FILE IS INVALID!\nCheck config file and reload NoGibs.");
                Interface.Oxide.UnloadPlugin(Name);
                return;
            }
        }

        void OnServerInitialized()
        {
            foreach (BaseNetworkable entity in BaseNetworkable.serverEntities)
            {
                OnEntitySpawned(entity);
            }
        }

        protected override void LoadDefaultConfig()
        {
            config = new ConfigData()
            {
                disablePatrolGibs = false,
                disableAPCgibs = false,
                disableCH47gibs = false,
                disableCH47fireball = false,
                disableScrapHelicopterGibs = true,
                disableScrapHelicopterFireball = true,
                disableMinicopterFireball = true
            };
        }

        ConfigData config;
        class ConfigData
        {
            [JsonProperty(PropertyName = "Disable Patrol Helicopter gibs")]
            public bool disablePatrolGibs;
            [JsonProperty(PropertyName = "Disable Bradley APC gibs")]
            public bool disableAPCgibs;
            [JsonProperty(PropertyName = "Disable CH47 gibs")]
            public bool disableCH47gibs;
            [JsonProperty(PropertyName = "Disable CH47 fireball")]
            public bool disableCH47fireball;
            [JsonProperty(PropertyName = "Disable Scrap Helicopter gibs")]
            public bool disableScrapHelicopterGibs;
            [JsonProperty(PropertyName = "Disable Scrap Helicopter fireball")]
            public bool disableScrapHelicopterFireball;
            [JsonProperty(PropertyName = "Disable Minicopter fireball")]
            public bool disableMinicopterFireball;
        }

        protected override void SaveConfig() => Config.WriteObject(config);

        void OnEntitySpawned(BaseNetworkable entity)
        {
            NextTick(
                () =>
                {
                    if (!entity.IsValid() || entity.IsDestroyed)
                    {
                        return;
                    }

                    if (entity.ShortPrefabName.StartsWith("servergibs_"))
                    {
                        if (entity.ShortPrefabName == "servergibs_patrolhelicopter")
                        {
                            if (config.disablePatrolGibs)
                            {
                                entity.Kill();
                            }
                        }
                        else if (entity.ShortPrefabName == "servergibs_bradley")
                        {
                            if (config.disableAPCgibs)
                            {
                                entity.Kill();
                            }
                        }
                        else if (entity.ShortPrefabName == "servergibs_ch47")
                        {
                            if (config.disableCH47gibs)
                            {
                                entity.Kill();
                            }
                        }
                        else if (entity.ShortPrefabName == "servergibs_scraptransport")
                        {
                            if (config.disableScrapHelicopterGibs)
                            {
                                entity.Kill();
                            }
                        }
                        return;
                    }

                    if (config.disableCH47fireball)
                    {
                        CH47Helicopter ch47 = entity as CH47Helicopter;
                        if (ch47 != null)
                        {
                            ch47.fireBall.guid = null;
                            return;
                        }
                    }

                    PlayerHelicopter heli = entity as PlayerHelicopter;
                    if (heli != null)
                    {
                        if (heli.ShortPrefabName == "scraptransporthelicopter")
                        {
                            if (config.disableScrapHelicopterFireball)
                            {
                                heli.fireBall.guid = null;
                            }
                        }
                        else if (heli.ShortPrefabName == "minicopter.entity")
                        {
                            if (config.disableMinicopterFireball)
                            {
                                heli.fireBall.guid = null;
                            }
                        }
                    }
                }
            );
        }
    }
}

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