Try this:
on @*:JOIN:#yourchan:{
.enable #whoisscan
whois $nick
}
#whoisscan off
raw 319:*:if (($2 ison #yourchan) && (#badchan isin $3-)) ban -ku300 #yourchan $2 1 You are banned
raw 311:*:haltdef
raw 307:*:haltdef
raw 312:*:haltdef
raw 313:*:haltdef
raw 310:*:haltdef
raw 320:*:haltdef
raw 318:*:{ .disable #whoisscan | haltdef }
#whoisscan end
Change all instances of #yourchan to the name of your channel, and change #badchan to the channel that the person isn't allowed to be on.
If a person is on #badchan and they join #yourchan, they will be kickbanned for 5 mins. You/your bot must be op'd on #yourchan for this to work.
-genius_at_work