GreenHell Modding
  • Welcome to the GreenHell Modding docs!
  • TUTORIALS
    • How to install GreenHellModLoader
      • Troubleshooting
    • How to install a mod
    • Mods in multiplayer
  • MODDING TUTORIALS
    • How to create a mod project
      • The modinfo.json file
    • How to create an AssetBundle
  • CLIENT - CODE EXAMPLES
    • Reading private variables
    • Modifying private variables
    • Accessing the player instance
    • Giving items to a player
    • Modifying the inventory max weight
    • Unlocking everything in the Notepad
    • Disabling player movement
    • Toggling the mouse/cursor
    • Printing to the console
  • WEBSITE
    • Slugs
Powered by GitBook
On this page

Was this helpful?

  1. CLIENT - CODE EXAMPLES

Giving items to a player

To give an item to a player you can use the AddItemToInventory method on the Player class.

Player.Get().AddItemToInventory("Meat_Cooked");
Player.Get().AddItemToInventory("Candy_bar_1");
Player.Get().AddItemToInventory("Mouse_Meat_Cooked");
Player.Get().AddItemToInventory("Bamboo_Spear"); 

You can find all in-game items in the ItemID enum. In 1.5.2 there is more than 700 items!

PreviousAccessing the player instanceNextModifying the inventory max weight

Last updated 5 years ago

Was this helpful?