I'm just curious about the complex construction in those two codes for checking if %count already exist.

on *:KICK:#: inc %count

will works just as well, since if %count does not exist yet, mIRC will create it and initialize it at the value 1.