I think your problems all result from incorrect placement of brackets {}. Brackets are used to tell mIRC what part goes with what part. If you have an IF or ELSE statement, then anything between the following {}'s goes with that. A new line doesn't make a different command.
Example:
if (%var == 1) { echo -a 1
echo -a 2
echo -a 3
}
This will echo 1, 2, and 3 if %var == 1 because they are all between the brackets even though they are on separate lines.
if (%var == 1) { echo -a 1 }
echo -a 2
echo -a 3
This will only echo 1 if %var == 1 and then will echo 2 and 3 no matter what because they are not within the {}'s of the IF.
The same goes with using ELSE. Anything within the {}'s following the ELSE will be part of the ELSE and will trigger if the ELSE is triggered. Anything outside of the {}'s will trigger no matter what. So in your code:
if ( $2 == $null ) { msg $chan 4/5/6ERROR5\4\3Usage: !amute NAME
else msg #K-Bot @down $2
/mode #K-Bot +mi
}
The else is IN the IF statement, which wouldn't work. You need a closing } after the IF commands are done. Then, you aren't using {}'s on the ELSE line. That's fine if you only want what is on the line to be part of the ELSE. But what you have here is a problem. If you close the IF like you should with a }, then the mode command isn't part of the IF or the ELSE and will always trigger even if the IF gets triggered saying that the format is wrong. It should be part of your ELSE, so you'd want {}'s around everything relating to the ELSE statement.
Think of {}'s as a way to enclose what you want done in a statement when you want multiple lines to be part of the statement.
Pseudo code:
IF (this) { do this
and this
and this
}
ELSE { do this
and this
and this
}
*Note that the first "do this" on each of those can be on a separate line instead of on the same line as the IF and ELSE if you prefer, but it doesn't really matter other than preference or readability.