Picking up and Dropping Weapons

The base of my game is from the FPS tutorial, and so were many parts of this script. Its a game were theres a console on screen, and after you unlock a weapon, you can type the weapons name into the console to equip it. But I dont want to be able to get it through the console unless you found it.

//These are what you collide with to get permision to get weapon from console

var MG : Transform;
var RL : Transform;
var PG : Transform;

//These functions were supposed to allow acces to the weapon you unlocked when they were called... Mega fail
var MGselect = function() {
if (Weapon Console == "MG") {
SelectWeapon(1)
}
}
var RLselect = function() {
if (WeaponConsole == "RL") {
SelectWeapon(2)
}
}
var PGselect = function() {
if (WeaponConsole == "PG") {
SelectWeapon(3)
}
var WeaponConsole : String = "Weapon Choice";

function OnGUI () {
    //The console you type into to accses the weapon you got
    WeaponConsole = GUI.TextField (Rect (10, 10, 200, 20), Weapon Console, 25);
}

function Start () {
	//Default Weapon
	SelectWeapon(0);
	
}

function Update () {
	// Did the user press fire?
	if (Input.GetButton ("Fire3"))
		BroadcastMessage("Fire");
	
	
	if ( Vector3.Distance(MG.position, transform.position ) < 2) {
		SelectWeapon(1);
		MGselect();
		//calling the functions
	}	
	if ( Vector3.Distance(RL.position, transform.position ) < 2) {
		SelectWeapon(2);
		RLselect();
	}	
	else if ( Vector3.Distance(PG.position, transform.position ) < 2) {
		SelectWeapon(3);
		PGselect()
	}	
}

function SelectWeapon (index : int) {
	for (var i=0;i < transform.childCount;i++)	{
		// Activate the selected weapon
		if (i == index)
			transform.GetChild(i).gameObject.SetActiveRecursively(true);
		// Deactivate all other weapons
		else
			transform.GetChild(i).gameObject.SetActiveRecursively(false);
	}
}

In my game I have all available weapons in an array in a script attached to the player. To switch weapons I just have to increase/decrease the variable that determines which element of the array should be used. A second variable determines how high this first variable can go. You can always check the player’s input against the second variable and if he wants a ‘higher’ weapon than the variable, the game will not give him the weapon. But this obviously only works when you know exactly in which order the player will find the weapons.