on *:join:#channel { dolimit }
on *:part:#channel { dolimit }
on *:quit:#channel { dolimit }
alias dolimit {
mode #channel +l $calc($nick(#channel,0) + 2)
}

that will set the limit of the room 2 more than how many people are there when they join/part/quit.. You can use a timer to make it delayed a bit too if you want.. And of course, you can do all sorts of things with $nick(#channel,0) and the $calc() function..