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

FREE SafezoneWarning : 1.0.1 1.0.1

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

namespace Oxide.Plugins
{
    [Info("SafezoneWarning", "bojack", "1.0.1")]
    [Description("Sends a warning message whenever a player enters any safezone.")]
    public class SafezoneWarning : RustPlugin
    {
        private const string Message = "You have entered a <color=#7CFC00>safezone</color>! Please don't fall asleep here or you risk losing your loot!";

        private readonly HashSet<ulong> notified = new HashSet<ulong>();

        private void OnPlayerTick(BasePlayer player)
        {
            if (player == null || !player.IsConnected) return;

            bool inSafeZone = player.InSafeZone();

            if (inSafeZone && !notified.Contains(player.userID))
            {
                player.ChatMessage(Message);
                notified.Add(player.userID);
            }

            else if (!inSafeZone && notified.Contains(player.userID))
            {
                notified.Remove(player.userID);
            }
        }

        private void OnPlayerDisconnected(BasePlayer player, string reason)
        {
            if (player == null) return;
            notified.Remove(player.userID);
        }

        private void Unload()
        {
            notified.Clear();
        }
    }
}

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