public ushort GetMagId(UnturnedPlayer player, ItemGunAsset gun, string[] command) { ushort magId = 0; if (command.Length == 2 || command.Length == 1) { if (command.Length == 1) { if (command[0].ToLower() == "c") { magId = player.Player.equipment.state[8]; } } else if (command.Length == 2) { if (command[1].ToLower() == "c") { magId = player.Player.equipment.state[8]; } } } if (magId == 0 || UnturnedItems.GetItemAssetById(magId).type != EItemType.MAGAZINE) { magId = gun.getMagazineID(); } return(magId); }