How to change value in a sequence ??

I have a c# script like this

void AddWeaponRock () {
	if (currentWeapon4 == "") {
		currentWeapon4 = "Rock";		
	}
	if (currentWeapon4 != "" && currentWeapon5 == "") {
		currentWeapon5 = "Rock";		
	}
	if (currentWeapon4 != "" && currentWeapon5 != "" && currentWeapon6 == "") {
		currentWeapon6 = "Rock";		
	}

I want to change my weapon in sequence.
Example if I already have weapon in slot currentWeapon5 I want to add it to 6. But if i dont have weapon in currentWeapon4 I want to add in currentWeapon4.

The problem is all of currentWeapon4 - 6 change their value to “Rock”

How to solve this ??


Thanks

Your problem is that u don’t use "else if " all you if things gives back true change it like this :

void AddWeaponRock () {
     if (currentWeapon4 == "") {
         currentWeapon4 = "Rock";        
     }
    else if (currentWeapon4 != "" && currentWeapon5 == "") {
         currentWeapon5 = "Rock";        
     }
    else if (currentWeapon4 != "" && currentWeapon5 != "" && currentWeapon6 == "") {
         currentWeapon6 = "Rock";        
     }