how to disable specific axis in input manager thru the script

Hello everyone! how to disable specific axis in input manager thru the script (please C# ). Trying to disable some movement on the character in the specific state.

something like this may work for you, just enable/disable the booleans

bool horizontalEnable = true;
bool verticalEnable = true;

float horizontalMove;
float verticalMove;
float moveSpeed = 0.1f;

void Update()
{
if(horizontalEnable)
{
horizontalMove = Input.GetAxis("Horizontal") * moveSpeed;
}

if(verticalEnable)
{
verticalMove = Input.GetAxis("Vertical") * moveSpeed;
}

transform.position += new Vector3(horizontalMove,verticalMove,0);
verticalMove = 0;
horizontalMove = 0;
}