How do you limit the distance at which an OnMouseDown works?

Hey guys Im brand new to scripting anything at all, made my first script earlier, its just to mute/unmute a collider with an audiosource. That works fine but I cant find a way to limit the distance it which it works. Heres the script as it is now. Id also like to be able to adjust the distance it works at in the inspector.

using UnityEngine;
using System.Collections;

public class muteaudioclick : MonoBehaviour
{
	
		
	void OnMouseDown()
	{
		if(audio.mute == false)
		{
			audio.mute = true;
			Debug.Log ("Sound Off");
		}
		else
		{
			audio.mute = false;
			Debug.Log ("Sound On");
		}
				
	}
}

Got some progress, now I need a way to set the default “publick Transform player;” to a player object automatically.

using UnityEngine;
using System.Collections;

public class muteaudioclick : MonoBehaviour
{
	public int triggdist = 3;
	public Transform player;
	
	private int distance;
	
	void OnMouseDown()
	{
		float distance = Vector3.Distance(player.position, transform.position);
		if(distance < triggdist)
		{
			if(audio.mute == false)
				{
					audio.mute = true;
					Debug.Log ("Sound Off");
				}
				else
				{
					audio.mute = false;
					Debug.Log ("Sound On");
				}
		}		
	}
}