If you put this code in the correct place in register.php it will work:
PHP Code:
$usercount = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "user WHERE usergroupid='2'");
if ($usercount['count'] >= 2000)
die ("Registration is closed");
I'm surprised there's not a mod to do this already actually, might see if I can code up a clean solution this evening