maybe someone can help me with that
Getting an Item from a players input.
with this here the player has to put in the Shortname....
i dont get it how to change it that the player can input the Displayname "Metal Fragments"
Code:if (!TryConvert(args[1], out itemname)) { return; } if (displaynameToShortname.ContainsKey(itemname)) itemname = displaynameToShortname[itemname]; var definition = ItemManager.FindItemDefinition(itemname); if (definition == null) { SendChatMessage(player, "Item not found"); return; } var item = definition.displayName.english; var item1 = ItemManager.Create(definition, amounts, 0);
Converting item name to short name?
Discussion in 'Rust Development' started by Crushed, Oct 24, 2016.
-
Code:
item.info.shortname item.info.displayName
-
That does not rly help me.
-
Code:
[ChatCommand("test")] private void TestCommand(BasePlayer player, string command, string[] args) { string inputitem = string.Join(" ", args); ItemDefinition itemdef = ItemManager.FindItemDefinition(inputitem); if (itemdef != null) { SendReply(player, "Found item: " + itemdef.displayName.english, player); } else { SendReply(player, "Could not find: " + inputitem, player); } }