Yes the script is almost correct, but it will only work up to mIRC 5.0, after which the order of parameter of $opnick() changed, which is why the channel name is the second parameter here.
Using $chan instead of $$1 or $1 is not correct as $chan refer to the current channel, while $1 is the first parameter passed to the alias/function, so allowing it to work on any channel.
4 // %deop is correct, checks if %deop is a multiple of 4.
Why would 3 be better than 4 deop at the same time?
The only thing that would make it not correct is the { bracket of the if statement not being on the same line as the if statement, as far as I know mIRC has never supported this.
And the usage of $chan in /mode instead of using $1 or $$1.
But the script would only break when testing with a number of opped nickname that is not a multiple of 4 or when the current channel is not the channel you want to deop on.
Here is a rewrite for current mIRC:
madeop {
var %nicks,%a 1
while ($opnick($$1,%a)) {
if ($v1 != $me) {
%nicks = %nicks $v1
if ($numtok(%nicks,32) == $modespl) {
mode $1 - $+ $str(o,$v1) %nicks
%nicks =
}
}
inc %a
}
if ($numtok(%nicks,32) > 0) mode $1 - $+ $str(o,$v1) %nicks
}
It would deop $modespl nicks at a time, which is the maximum number of modes you can do at the same time for any server.