1. 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!");
                }
            }
     
  2. Code:
                            if (player.inventory.GetAmount(123456) > 0)
                            {
                                // Player has item
                            } else
                            {
                                // Player does not have item
                            }
    
    This should fit your needs. Although I assume your code didn't work because a freshly created AK might not match an AK within the players inventory.
     
  3. ty dude :)