# SetInventory

TIP

  • setInventory(<player>, <content>)
  • Sets a player inventory, <content> must be an array with the format of:
[<slot> => [
  "custom_name" => <custom_name>  (Optional)
  "id"          => <id>
  "meta"        => <meta>         (Optional)
  "amount"      => <amount>       (Optional)
  "nbt"         => <nbt>          (Optional)
  ],
. . .
]

# Parameters

  • <player> The player to set their inventory as string

# Example

1: $item$["custom_name"] = "Custom Item"
2: $item$["id"] = 5
3: $item$["meta"] = 2
4: $inventory$ = getInventory($player$)
5: $inventory$[4] = $item$
6: setInventory($player$, $inventory$)

# Output

The above example will change the 5th slot of the player's inventory to an item with the name "Custom Item", and with the ID of 5 and a meta of 2.

ON THIS PAGE