mIRC Home    About    Download    Register    News    Help

Print Thread
url warning script #239519 04/11/12 09:36 PM
Joined: Oct 2012
Posts: 28
H
HeRiNo Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Oct 2012
Posts: 28
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.

Re: url warning script [Re: HeRiNo] #239557 07/11/12 05:24 PM
Joined: Oct 2012
Posts: 164
D
Deega Offline
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
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

Re: url warning script [Re: Deega] #239561 07/11/12 08:49 PM
Joined: Oct 2012
Posts: 28
H
HeRiNo Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Oct 2012
Posts: 28
Hi Deega,

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

Regards, Herman.

Re: url warning script [Re: HeRiNo] #239562 07/11/12 09:30 PM
Joined: Jan 2004
Posts: 1,282
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,282
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.

Re: url warning script [Re: Deega] #239573 08/11/12 01:35 PM
Joined: Oct 2012
Posts: 28
H
HeRiNo Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Oct 2012
Posts: 28
Hi Deega,

thank you verry much, its working great now! wink

Regards Herman.