mIRC Homepage
Posted By: HeRiNo url warning script - 04/11/12 09:36 PM
Hi,

I have this litle script dat warns, kicks, bans on swearing. No I edited it to make it act on emails, website url's. Now the problem. It responds on .com .net and stuff but not on websitename.com same for www. works fine but www.websitename does not work. Is it possible with a small fix to make it do what I like it to do?

The script:

Code:
; Copy the following code into your remotes (Alt+R)
; Tye @ Undernet #Test-IRC
on @*:TEXT:*:#: {
  ; The list of Urls/emails. Items should be separated by commas
  var %swears = www,www.,http,http:,https,https:,https://,http://,.com,.nl,nl,com,.com,.net,.tk,eu,@hotmail,@live
  ; Number of times to warn before banning
  var %warns = 2
  var %x = $numtok(%swears,44)
  tokenize 32 $strip($1-)
  while (%x) && ($regex($nick($chan,$nick).pnick, /[~|@].*/) != 1) {
    if ($istok($1-,$gettok(%swears,%x,44),32)) {
      inc $+(%,swear.,$wildsite)
      var %n = $($+(%,swear.,$wildsite),2)
      if (%n <= %warns) {
        .msg $chan 4 $nick $+ , 14dit is waarschuwing nr:4 $(%n) 14om geen website URL's/Emailadressen in de room te typen, na4 3 x14 volgt er een ban.) 3@ 12Room-Bot 3@
      }
      elseif (%n > %warns) {
        ban -ku300 $chan $nick 2 14Je was gewaarschuwd4 $nick . 14Geen Website's/Emailadressen plaatsen in de room. 3@ 12Room-Bot 3@
        unset $+(%,swear.,$wildsite)
      }
    }
    dec %x
  }
}
; Reset all of the swear data on mIRC start
on *:START: { unset %swear.* }



;$nick($chan, $nick).pnick
;($nick isreg $chan  || $nick isvo $chan)


I hope some one can help me.

Regards, Herman.
Posted By: Deega Re: url warning script - 07/11/12 05:24 PM
Code:
on @*:TEXT:*:#: {
  ; The list of Urls/emails. Items should be separated by commas
  var %swears = www.,http:,https:,.com,.nl,.net,.tk,.eu,@hotmail,@live
  ; Number of times to warn before banning
  var %warns = 2

  ; The spacing is important in the following line
  if (!$regex($nick(#,$nick).pnick,/[~@]/) && $count($strip($1-), [ %swears ] )) {
    inc $+(%,swear.,$wildsite)
    var %n = $($+(%,swear.,$wildsite),2)
    if (%n <= %warns) {
      .msg $chan 4 $nick $+ , 14dit is waarschuwing nr:4 $(%n) 14om geen website URL's/Emailadressen in de room te typen, na4 3 x14 volgt er een ban.) 3@ 12Room-Bot 3@
    }
    else {
      ban -ku300 $chan $nick 2 14Je was gewaarschuwd4 $nick . 14Geen Website's/Emailadressen plaatsen in de room. 3@ 12Room-Bot 3@
      unset $+(%,swear.,$wildsite)
    }
  }
}

Note the comment about spacing
Posted By: HeRiNo Re: url warning script - 07/11/12 08:49 PM
Hi Deega,

do you mean I have to remove . : and so? so no .net just net?

Regards, Herman.
Posted By: Loki12583 Re: url warning script - 07/11/12 09:30 PM
That's not what he means at all, and I don't know where you could have gotten that idea from. The problem was that you were using $istok which required the strings to be delimited by spaces. ".net" is not separated by a space in "domain.net" so there was no match. Deega is using $count, which counts the number of matches of the substrings and doesn't rely on a delimiter.
Posted By: HeRiNo Re: url warning script - 08/11/12 01:35 PM
Hi Deega,

thank you verry much, its working great now! wink

Regards Herman.
© mIRC Discussion Forums