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

FREE RaidBaseFireDamage : 1.1.0 1.1.0

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


namespace Oxide.Plugins
{
    [Info("RaidBaseFireDamage", "TuNombre", "1.1.0")]
    [Description("Aplica daño de fuego cada segundo a jugadores dentro de Raid Bases, y fuerza visión nocturna.")]

    public class RaidBaseFireDamage : RustPlugin
    {
        private Dictionary<ulong, Timer> activeTimers = new Dictionary<ulong, Timer>();
        private Dictionary<ulong, bool> nightVisionWasActive = new Dictionary<ulong, bool>();
        private Dictionary<ulong, bool> nightVisionHadPermission = new Dictionary<ulong, bool>();

        private const float DAMAGE_PER_SECOND = 5f;
        private const float TICK_INTERVAL = 1f;

        [PluginReference] private Plugin NightVision;

        void OnPlayerEnteredRaidableBase(BasePlayer player, Vector3 raidPos, bool allowPVP)
        {
            if (activeTimers.ContainsKey(player.userID)) return;

            // 🔦 Activar visión nocturna a la fuerza
            NightVision?.CallHook("LockPlayerTime", player, 7.3f);

            // 🔥 Activar daño periódico
            Timer newTimer = timer.Every(TICK_INTERVAL, () =>
            {
                if (player == null || !player.IsConnected) return;
                player.Hurt(DAMAGE_PER_SECOND, DamageType.Heat, null, true);
                Effect.server.Run("assets/bundled/prefabs/fx/impacts/additive/fire.prefab", player.transform.position);
            });

            activeTimers[player.userID] = newTimer;
        }

        void OnPlayerExitedRaidableBase(BasePlayer player, Vector3 raidPos, bool allowPVP)
        {
            if (activeTimers.TryGetValue(player.userID, out Timer t))
            {
                t.Destroy();
                activeTimers.Remove(player.userID);
            }

            // 🔦 Restaurar visión nocturna solo si no la tenía antes
            if (NightVision != null)
            {
                NightVision?.CallHook("UnlockPlayerTime", player);
            }
        }


    }
}

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