Rotate charcter with camera?

How do i make a script something like the one below but that will make the character rotate with the camera on x axis so it's like a first-person shooter.

var speed = 6.0;
var jumpSpeed = 8.0;
var gravity = 20.0;
var camera : GameObject;

private var moveDirection = Vector3.zero;
private var grounded : boolean = false;

function FixedUpdate() {
    if (grounded) {
        // We are grounded, so recalculate movedirection directly from axes
        moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        moveDirection = transform.TransformDirection(moveDirection);
        moveDirection *= speed;
        transform.Rotate(Vector3.right * camera);

        if (Input.GetButton ("Jump")) {
            moveDirection.y = jumpSpeed;
        }
    }

    // Apply gravity
    moveDirection.y -= gravity * Time.deltaTime;

    // Move the controller
    var controller : CharacterController = GetComponent(CharacterController);
    var flags = controller.Move(moveDirection * Time.deltaTime);
    grounded = (flags & CollisionFlags.CollidedBelow) != 0;
}

It's better to do it as a separate component, instead of modifying the movement code. The MouseLook component should do it.