Hello everyone! how to initialize the player to give him the recipe such as Kalashnikov? If for example the name of the player, "Dev", or ID 1111111
Code:void OnPlayerInit(BasePlayer player) {}
Give player BP item C#
Discussion in 'Rust Development' started by cyberhof, Jun 9, 2015.
-
Something like this:
Code:void OnPlayerInit(BasePlayer player) { var gameObjectArray = FileSystem.LoadAll<GameObject>("Assets/Items/"); var itemDefinitions = (gameObjectArray.Select(x => x.GetComponent<ItemDefinition>()).Where(x => x != null)).ToList(); player.blueprints.Learn(itemDefinitions.First(def => def.shortname == "shotgun_waterpipe")); player.blueprints.Learn(itemDefinitions.First(def => def.shortname == "lock.code")); } -
Thx! Where to see the names of items?
-
Wulf Community Admin
-
You can use .displayName for the long name, otherwise itemConfig mod exposes them or rusty has a list too.. Or just make a temp command in your mod to dump them.
-
Wulf Community Admin
Or use the existing documented lists.
-
Thanks for that, didn't even know that existed I was looking at the doc menu on here and never could find that list.
-
Wulf Community Admin
I added it last night actually, but originally Mughisi had a Google Sheet with it.
