using Oxide.Core; using System.Collections.Generic; using Oxide.Core.Plugins; using UnityEngine; namespace Oxide.Plugins { [Info("ItemInfo", "DeutscherRitterPlatz", "1.0.0")] [Description("It provides a quick overview of various information about the item, such as itemName, itemShortName, itemSkinId, and itemId.")] class ItemInfo : RustPlugin { private string PluginPrefix; 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, "ItemName", itemName, "ItemShortName", itemShortName, "ItemSkinId", itemSkinId, "ItemID", 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 { ["NoPermission"] = "You do not have permission to use this command!", ["NoItemEquipped"] = "You have not equipped any item.", ["PluginPrefix"] = "ITEM INFO", }, this); lang.RegisterMessages(new Dictionary { ["NoPermission"] = "Du hast keine Berechtigung, diesen Befehl zu verwenden!", ["NoItemEquipped"] = "Du hast kein Item ausgerüstet!", ["PluginPrefix"] = "ITEM INFO", }, this, "de"); } } }