There is no "better" way, nor is there an "absolute" one, you code, however YOU find it easiest, however, usually you will find people will 'add' the if statements together.
On *:OP:#:{
if ($chan != #test) && ($opnick == $me) {
msg # 9»8 Thanks for op 9«
}
}
Btw; from your samples above, 3 and 4 are the only ones that will work because, sample 1 has an if in the middle of an if statement, you probably wanted a &&, and similiarly 2 has the same but a | instead of a { as well.
Eamonn.