for A column:
function onEdit(event){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getSheets()[0]; // 0 == first sheet.
var ee = SpreadsheetApp.getActiveSpreadsheet().getActiveRange().getA1Notation();
if (ee == "A3") { // Check if edited cell is the one we're watching.
if (SpreadsheetApp.value == "1""true"){ // If the value == "1""true", do stuff.
var protections = sh.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (var i = 0; i < protections.length; i++) {
if (protections[i].getDescription() == 'Test1') { // If protect. descript. == "Test1"
protections[i].remove(); // then remove protection.
}
}
}
}
}
function setProtected(){
// Sets the desired range to protected with "Test1" description for demonstration.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getSheets()[0];
var protectedRows = sh.getRange("A4:A50");
protectedRows.protect().setDescription("Test1");
}