mIRC Advertisement Kicker Tutorial
Written by n0kturnal (#Scripting @ DALnet)

This is a really handy script to have, I will also show you some ways of implementing a channel kicker for spam, and also a private spam kicker. Below that is also a personal Invite kicker that can also be handy.

First of the channel spam kicker;

on *:TEXT:*:#:{
  ;Looks for text in all channels you are currently residing in
  if ($nick isreg #) {
    ;Checks if the user is a non op or voice, don't want to be kicking them.
    var %spam = $strip($1-,burc)
    ;Strips the whole line from bold, underline, reverse, and colour codes
    if (*#* iswm %spam) || (*http://* iswm %spam) || (*www.* iswm %spam) {
       ;Checks the stripped line for a #, http:// or www.
       ban -u30 $chan $nick 13 | kick $chan $nick Do not Spam in here, 30 second ban. You said $ifmatch $+ !
       ;Bans and kicks the user, telling them what they said
    }
  }
}

One option that you should put into your script is the ability not to kick the user if they say the current channels name you will not kick them. Many bots have the channel name in their scripts, as well as many others. To do this just use the below option instead. 

on *:TEXT:*:#:{
   ;Looks for text in channels
   if ($nick isreg #) {
      ;Again sees if the user is a regular in the channel
      var %spam = $strip($1-,burc),%temp = 0
      ;Strip those control codes and sets a variable for the next step
      ;Okay all the below will just scan though each word separately, checking if it is the current channel name or not.
      while ($gettok(%spam,%temp,32) { inc %temp | var %spamword = $gettok(%spam,%temp,32)
         if (*#* iswm %spamword) || (*http://* iswm %spamword) || (*www.* iswm %spamword) {
             if (%spamword != $chan) {
                 ban -u30 $chan $nick 13 | kick $chan $nick Do not Spam in here, 30 second ban. You said $ifmatch $+ !
                 ;Bans and kicks the user, telling them what they said
               }
            }
        }
    }
}

You don't actually need to understand the full workings of the above script, but check out the tokens tutorial for information about $gettok.

Now for the personal spam protection.

on *:TEXT:*:?:{
   ;Scans for text in a private message
   var %spam = $strip($1-,burc),%temp = 0
   ;Strips the message from any control codes and sets a variable for the next step
   ;The next step just loops through all the channels you and the nick are in, and checks if they are a non op/voice and then    follows the next procedures
   while ($comchan($nick,%temp)) { inc %temp
      if (*#* iswm %spam) || (*http://* iswm %spam) || (*www.* iswm %spam) { set %spamword $ifmatch
         if ($me isop $comchan($nick,%temp)) || ($nick isreg $comchan($nick,%temp)) {
            ban -u30 $comchan($nick,%temp) $nick 13
            kick $comchan($nick,%temp) $nick Do not spam in private messages, 30 second ban. You said %spamword $+ !
         }
      }
   }
}


Now for the invite kicker I promised. Here it is below, it follows the same steps as the above one by simply looping through all channels you and the nickname are in

on *:INVITE:#:{
   var %temp = 0
   while ($comchan($nick,%temp)) { inc %temp
      if ($me isop $comchan($nick,%temp)) && ($nick isreg $comchan($nick,%temp)) {
        ban -u30 $comchan($nick,%temp) $nick 13
        kick $comchan($nick,%temp) $nick Do not try to invite me again, 30 second ban.
      }
   }
}

If you have any queries about anything in this tutorial, then don't hesitate to ask.