Lock rotation of tank barrel

I have created a working prototype for a tank game. The final thing that I cannot get right is stoping the angle of the barrel at a set angle to stop it going stright up looking unrealistic or digging into the ground. My current script is

using UnityEngine;
using System.Collections;

public class TurrentMouseVert : MonoBehaviour {

	public float horizontalSpeed = 2.0F;
	public float verticalSpeed = 2.0F;


		
	
	
	
	void Update() 
		
	{
		float h = horizontalSpeed * Input.GetAxis("Mouse X");
		float v = verticalSpeed * Input.GetAxis ("Mouse Y");
		transform.Rotate (v, 0, 0);

	
		
		//Debug.Log(transform.eulerAngles.x);
		Debug.Log(transform.eulerAngles.y);
		//Debug.Log(transform.eulerAngles.z);
	}


}

I have removed my test part that included mathf.clamp to avoid confusion, please help

You need to use transform.eulerAngles.y as you have in the debug in an if statement to check that the rotation of the tank barrel is within certain bounds, and if not set the rotation of the barrel to be within the bounds using transform.rotation.

Hope this helps!

Thanks for the responses guys but im still none the wiser. Is it possible to respond with part of the script written, thanks very much