In future, please use the Code Tags button (looks like a # character) around code.
I would recommend you change the second * in the ON TEXT event to a # character.
The reason for this, is that with the * a person could pm/query the client with the !count command, but the client wouldn't know what information to relay, as $chan (as required for the %chanmax<channel> variable) will return $null, therefore making the accessed variable read as %chanmax. rather than %chanmax.help (as an example).
By using the # character, mIRC will not recognize the !count command unless it comes from within the channel.