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

FREE ItemInfo : 1.0.1 1.0.1

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

namespace Oxide.Plugins
{
    [Info("ItemInfo", "DeutscherRitterPlatz", "1.0.1")]
    [Description("It provides a quick overview of various information about the item, such as itemName, itemShortName, itemSkinId, and itemId.")]
    class ItemInfo : RustPlugin
    {
        private const string ItemInfoMessage = "{0}: {1},\n{2}: {3},\n{4}: {5},\n{6}: {7}";

        private void Init()
        {
            permission.RegisterPermission("iteminfo.use", this);
        }

        [ChatCommand("iteminfo")]
        private void ItemInfoCommand(BasePlayer player, string command, string[] args)
        {
            if (!permission.UserHasPermission(player.UserIDString, "iteminfo.use"))
            {
                string PermMessage = $"{GetMsg("PluginPrefix", player.UserIDString)}\n{GetMsg("NoPermission", player.UserIDString)}";
                SendReply(player, PermMessage);
                return;
            }

            Item item = player.GetActiveItem();
            if (item != null)
            {
                string itemName = item.info.displayName.english;
                string itemShortName = item.info.shortname;
                ulong itemSkinId = item.skin;
                int itemId = item.info.itemid;

                string message = string.Format(ItemInfoMessage, 
                    "<color=#AE3624>ItemName</color>", itemName, 
                    "<color=#AE3624>ItemShortName</color>", itemShortName, 
                    "<color=#AE3624>ItemSkinId</color>", itemSkinId, 
                    "<color=#AE3624>ItemID</color>", itemId);
                
                PrintToChat(player, $"{GetMsg("PluginPrefix", player.UserIDString)}\n{message}");
            }
            else
            {
                string errorMessage = $"{GetMsg("PluginPrefix", player.UserIDString)}\n{GetMsg("NoItemEquipped", player.UserIDString)}";
                SendReply(player, errorMessage);
            }
        }

        private string GetMsg(string key, string userId) => lang.GetMessage(key, this, userId);

        protected override void LoadDefaultMessages()
        {
            lang.RegisterMessages(new Dictionary<string, string>
            {
                ["NoPermission"] = "You do not have permission to use this command!",
                ["NoItemEquipped"] = "You have not equipped any item.",
                ["PluginPrefix"] = "<size=16><color=#BF5E16>ITEM</color> <color=#697456>INFO</color></size>",
            }, this);

            lang.RegisterMessages(new Dictionary<string, string>
            {
                ["NoPermission"] = "Du hast keine Berechtigung, diesen Befehl zu verwenden!",
                ["NoItemEquipped"] = "Du hast kein Item ausgerüstet!",
                ["PluginPrefix"] = "<size=16><color=#BF5E16>ITEM</color> <color=#697456>INFO</color></size>",
            }, this, "de");
        }
    }
}

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