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

FREE Feedback : 1.0.0 1.0.0

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

namespace Oxide.Plugins
{
    [Info("Feedback", "Ridamees", "1.0.0")]
    [Description("Allows players to send feedback with /feedback, which is saved to a log file.")]
    class Feedback : CovalencePlugin
    {
        private const string PERMISSION_USE_FEEDBACK = "feedback.use";

        private PluginConfig config;

        class PluginConfig
        {
            public string LogFileName { get; set; }
        }

        protected override void LoadDefaultConfig()
        {
            Config.WriteObject(new PluginConfig
            {
                LogFileName = "feedback"
            }, true);
        }

        private void Init()
        {
            permission.RegisterPermission(PERMISSION_USE_FEEDBACK, this);
            config = Config.ReadObject<PluginConfig>();
        }

        [Command("feedback")]
        private void FeedbackCommand(IPlayer player, string command, string[] args)
        {
            if (!permission.UserHasPermission(player.Id, PERMISSION_USE_FEEDBACK))
            {
                player.Reply("You do not have permission to use this command.");
                return;
            }

            if (args.Length < 1)
            {
                player.Reply("You must include a message in your feedback.");
                return;
            }

            var message = string.Join(" ", args);
            var logMessage = $"[{player.Id}] [{player.Name}] {message}";

            LogToFile(config.LogFileName, logMessage, this);

            player.Reply("Thank you for your feedback!");
        }
    }
}

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