why this code didn't work?
Code:[ChatCommand("locker")] private void lockerCommand(BasePlayer player, string command, string[] args) { if (!player.inventory.AllItems().ToList().Contains(ItemManager.CreateByName("rifle.ak"))) { Item AK = ItemManager.CreateByName("rifle.ak", 1); AK.MoveToContainer(player.inventory.containerBelt); } else { SendReply(player, "You already have an AK in your inventory!"); } }
Checking if player has item in inventory?
Discussion in 'Rust Development' started by Novaa, Apr 26, 2018.
-
Code:
if (player.inventory.GetAmount(123456) > 0) { // Player has item } else { // Player does not have item }
-
ty dude