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

FREE OneTimeRewards : 1.0.1 1.0.1

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

//  ____  _       _ _       
// / ___|(_) __ _(_) | ___  
// \___ \| |/ _` | | |/ _ \ 
//  ___) | | (_| | | | (_) |
// |____/|_|\__, |_|_|\___/ 
//          |___/             
// ☽✧✵✧✵✧✵✧✵✧✵✧✵✧☾
// ✦    RUST PLUGINS   ✦
// ✦     Sigilo.dev    ✦
// ☽✧✵✧✵✧✵✧✵✧✵✧✵✧☾

namespace Oxide.Plugins
{
    [Info("OneTimeRewards", "Sigilo", "1.0.1")]
    class OneTimeRewards : RustPlugin
    {
        private string groupName;
        private string itemName;
        private int itemAmount;
        private string commandName;
        private string successMessage;
        private string failureMessage;
        private ulong skinId;

        protected override void LoadDefaultConfig()
        {
            Config["GroupName"] = "rewardgroup";
            Config["ItemName"] = "rock";
            Config["ItemAmount"] = 1;
            Config["CommandName"] = "reward";
            Config["SuccessMessage"] = "You have been given {1} {2}(s).";
            Config["FailureMessage"] = "You are not eligible for the reward.";
            Config["SkinId"] = 0ul;
        }

        void Init()
        {
            groupName = Config["GroupName"].ToString();
            itemName = Config["ItemName"].ToString();
            itemAmount = Convert.ToInt32(Config["ItemAmount"]);
            commandName = Config["CommandName"].ToString();
            successMessage = Config["SuccessMessage"].ToString();
            failureMessage = Config["FailureMessage"].ToString();
            skinId = Convert.ToUInt64(Config["SkinId"]);

            if (!permission.GroupExists(groupName))
            {
                permission.CreateGroup(groupName, "OneTimeRewards", 0);
            }

            string permName = $"{Title}.{commandName}";
            if (!permission.GroupHasPermission(groupName, permName))
            {
                permission.GrantGroupPermission(groupName, permName, this);
            }

            cmd.AddChatCommand(commandName, this, "RewardCommand");
        }

        void RewardCommand(BasePlayer player, string command, string[] args)
        {
            if (permission.UserHasGroup(player.UserIDString, groupName))
            {
                player.inventory.GiveItem(ItemManager.CreateByName(itemName, itemAmount, skinId));

                permission.RemoveUserGroup(player.UserIDString, groupName);

                player.ChatMessage(string.Format(successMessage, groupName, itemAmount, itemName));
            }
            else
            {
                player.ChatMessage(string.Format(failureMessage, groupName));
            }
        }
    }
}

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