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

FREE LootBlocker : 0.0.1 0.0.1

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

namespace Oxide.Plugins
{
    [Info("LootBlocker", "NoPay", "0.0.1")]
    class LootBlocker : RustPlugin
    {
        private Dictionary<ulong, float> lootCooldowns = new Dictionary<ulong, float>();
        private const float CooldownTime = 5f;

        private void OnLootEntity(BasePlayer player, BaseEntity entity)
        {
            if (entity is LootContainer)
            {
                if (lootCooldowns.TryGetValue(player.userID, out float lastLootTime))
                {
                    if (Time.realtimeSinceStartup - lastLootTime < CooldownTime)
                    {
                        player.ChatMessage("Пожалуйста, подождите некоторое время перед выбросом лута.");
                        entity.Kill();
                        return;
                    }
                    lootCooldowns[player.userID] = Time.realtimeSinceStartup;
                }
                else
                {
                    lootCooldowns.Add(player.userID, Time.realtimeSinceStartup);
                }
            }
        }

        private void Unload()
        {
            Interface.Oxide.DataFileSystem.WriteObject("LootBlocker", lootCooldowns);
        }

        private void Loaded()
        {
            lootCooldowns = Interface.Oxide.DataFileSystem.ReadObject<Dictionary<ulong, float>>("LootBlocker");
        }
    }
}

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