weapon pickup and equiping it to FPS player

I know this has been asked but I can't find an answer that suits what I'm trying to do.

I have a setup where my FPS player starts off in a house with no weapon selected.

He finds on on the wall and picks it up. I'm using this as my pickup for the weapon:

var gotShotgun : boolean = false;

var gunPickupSound : AudioClip;

function Start (){
    //playerWeapons is the players selectable weapons
    playerWeapons = this.GetComponent("PlayerWeapons");
}

function OnTriggerStay (){

    if (Input.GetButtonDown("Pickup")){
        gotShotgun = true;
        Destroy(gameObject);

    //Play Gun Pickup Sound
    if (gunPickupSound)
    AudioSource.PlayClipAtPoint(gunPickupSound, transform.position);

    print("You Picked Up The Double Barel Shotgun");
    }
}

The gun dissapears from the wall and it prints out that you have "You Picked Up The Double Barel Shotgun"

So far so good.

What I can't figure out is how to get it to activate and load up the shotgun from my PlayerWeapons script

var weapons : GameObject[];
var selectedWeapon : int;

function Awake () {
    // Select the first weapon
    SelectWeapon(0);
}

function Update () {
    // Did the user press fire?
    if (Input.GetButton ("Fire1"))
        BroadcastMessage("Fire");

if (Input.GetKeyDown("1") && weapons.length >= 1) {
        if(!weapons[0].gameObject.GetComponent("weaponLockout").isLocked){
            SelectWeapon(0);
            selectedWeapon = 0;
        }
    } else if (Input.GetKeyDown("2") && weapons.length >= 2) {
        if(!weapons[1].gameObject.GetComponent("weaponLockout").isLocked){
            SelectWeapon(1);
            selectedWeapon = 1;
        }
    } else if (Input.GetKeyDown("3") && weapons.length >= 3) {
        if(!weapons[2].gameObject.GetComponent("weaponLockout").isLocked){
            SelectWeapon(2);
            selectedWeapon = 2;
        }
    } else if (Input.GetKeyDown("4") && weapons.length >= 4) {
        if(!weapons[3].gameObject.GetComponent("weaponLockout").isLocked){
            SelectWeapon(3);
            selectedWeapon = 3;
        }
    } else if (Input.GetKeyDown("5") && weapons.length >= 5) {
        if(!weapons[4].gameObject.GetComponent("weaponLockout").isLocked){
            SelectWeapon(4);
            selectedWeapon = 4;
        }

    }
}

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);
    }
}

3 months of trying to learn this code stuff and a lot of it still makes my brain hurt lol. Anyone know how I can make this work?

First of all. This code:

 if(!weapons[0].gameObject.GetComponent("weaponLockout").isLocked){
            SelectWeapon(0);
            selectedWeapon = 0;
        }

Is a good candidate for a function:

function selectWeaponByIndex(var i:int):void
{
    if(!weapons*.gameObject.GetComponent("weaponLockout").isLocked) {*
 *SelectWeapon(i);*
 *selectedWeapon = i;*
 *}*
*}*
*```*
*<p>So when you want weapon "1" you can just call selectWeaponByIndex(1).</p>*
*<p>Now.. when you pick-up the shotgun you should broadcast a message that you did. Have your PlayerWeapons script respond to this by selecting the shotgun.</p>*

Try this.

var shotGun = Transform;
private var shotGun : machineGun;

function OnTriggerEnter ()
{
    Destroy (gameObject);
    if ( machineGun )
    {
        machineGun.enabled = true;
    }
}

All you have to do now is to make the mesh activate. More detail needed, let me know.