Swear Protection — File Browser

SwearProtectionv1.0 / SwearProtectionv1.0 / sprot.mrc

sprot.mrc — 5.99 KB — Download this file

; Swear Protection
; by ch1zra
; ch1zra@gmail.com
; http://uptheirons.co.sr/
; #Scripters @ irc.krstarica.com
; Copyright © Up The Irons ! inc. Scripting Team
;
; <----------------------- $Comments ----------------------->
; I so rule :D
; this one uses hash tables, so it's megafast.
; and yes, it has a *wildcard* support.
; and once more yes, it works only if enabled, and if you're OP
; plus I added Identd scan on join... and that one also works
; only if enabled, and if you're OP :]
; ho ho ho.. /me so fokkin' mighty ;]
;
; PS (for anything else, refer to readme.txt)

; <----------------------- $Load / $UnLoad ----------------------->

on 1:load: {
  if ($version > 6.0) {
    echo  Swear Protection by ch1zra succesfully loaded 
    echo 4ch1zra@gmail.com 
    writeini $scriptdirsprto.ini main enabled 0
  }
  else { 
    echo  Version 6.0 or higher required, get a newer version of mirc at http://www.mirc.com  
    unload -rs $script 
  }
}

on *:unload: {
  if ($isfile($scriptdirsprot.ini)) .remove " $+ $scriptdirsprot.ini $+ "
  if ($isfile(sprot.hsh)) .remove sprot.hsh 
  echo -s Thank you for using my Swear Protection. 4ch1zra@gmail.com http://uptheirons.co.sr/
}

; <----------------------- $Start / $Close ----------------------->

on *:start: {
  if ($hget(sprot)) { hfree sprot }
  hmake sprot 100
  if ($isfile(sprot.hsh)) hload sprot sprot.hsh
}

on *:close: {
  hsave sprot sprot.hsh
} 

; <----------------------- $Aliases ----------------------->


alias sprot {
  if ($dialog(sprot)) {
    dialog -ve sprot sprot
  }
  else { dialog -mdo sprot sprot }
} 

alias -l sprot.about {
  if ($dialog(sprot)) dialog -i sprot
  if ($input(Swear Protection $crlf $crlf by ch1zra $crlf $crlf ch1zra@gmail.com $&
    $crlf http://uptheirons.co.sr/ $crlf #Scripters @ irc.krstarica.com $&
    ,oi,About Swear Protection))  {
    if ($dialog(sprot)) dialog -e sprot
  }
}

alias -l sprot.ref {
  did -r sprot 2
  var %spr $hget(sprot,0).item
  while (%spr) { 
    did -a sprot 2 $hget(sprot,%spr).item
    dec %spr
  }
}

; <----------------------- $Dialog ----------------------->

dialog sprot {
  title "Swear Protection by ch1zra"
  size -1 -1 115 100
  option dbu
  box "[ Swear Protection Settings ]", 1, 6 0 105 75
  list 2, 10 10 45 60, size
  check "Enable SProt", 3, 60 10 45 10
  check "Exclude OPs", 4, 60 20 45 10
  check "Exclude Voices", 5, 60 30 45 10
  edit "", 6, 60 45 45 10
  button "Add", 7, 85 60 20 8, flat
  button "Del", 8, 60 60 20 8, flat
  check "Use same words for Identd scan", 9, 5 76 95 10
  button "About", 10, 55 90 25 8, flat
  button "OK", 11, 85 90 25 8, flat ok
  text "UpTheIrons.Co.Sr", 12, 5 90 48 8, disable center
}

; ------------------------- $DEvents

on *:dialog:sprot:init:*: {
  sprot.ref
  if ($group(#BadWords).status == off)  {
    did -b $dname 2,4,5,6,7,8,9
  }
  else did -c $dname 3
  if ($readini($scriptdirsprot.ini,main,ExcludeOP) == 1) did -c $dname 4
  if ($readini($scriptdirsprot.ini,main,ExcludeVoice) == 1) did -c $dname 5
  if ($readini($scriptdirsprot.ini,main,Identd) == 1) did -c $dname 9
}

on *:dialog:sprot:sclick:*: {
  if ($did == 2) {
    if ($did(2).seltext != $null) {
      did -ra $dname 6 $did(2).seltext
    }
  }
  if ($did == 3) {
    if ($did(3).state == 1) {
      .enable #BadWords 
      did -e $dname 2,4,5,6,7,8,9
    }
    else {
      .disable #BadWords 
      did -b $dname 2,4,5,6,7,8,9
    }
  }
  if ($did == 4) {
    if ($did(4).state == 1) {
      writeini $scriptdirsprot.ini main ExcludeOP 1
    }
    else {
      writeini $scriptdirsprot.ini main ExcludeOP 0
    }
  }
  if ($did == 5) {
    if ($did(5).state == 1) {
      writeini $scriptdirsprot.ini main ExcludeVoice 1
    }
    else {
      writeini $scriptdirsprot.ini main ExcludeVoice 0
    }
  }
  if ($did == 7) && ($did(6) != $null) {
    hadd sprot $did(6) 1
    did -r $dname 6
    sprot.ref
    hsave sprot sprot.hsh
  }
  if ($did == 8) && ($did(2).seltext != $null) {
    hdel sprot $did(2).seltext
    did -r $dname 6
    sprot.ref
    hsave sprot sprot.hsh
  }
  if ($did == 9) {
    if ($did(9).state == 1) {
      writeini $scriptdirsprot.ini main Identd 1
    }
    else {
      writeini $scriptdirsprot.ini main Identd 0
    }
  }
  if ($did == 10) {
    sprot.about
  }
  if ($did == 11) {
    hsave sprot sprot.hsh
  }
}

; <----------------------- $Events ----------------------->

#BadWords on
on @*:text:*:#: {
  if ($readini($scriptdirsprot.ini,main,ExcludeOP) == 1) && ($nick isop $chan) { return }
  if ($readini($scriptdirsprot.ini,main,ExcludeVoice) == 1) && ($nick isvoice $chan) { return }
  var %spr $hget(sprot,0).item
  while (%spr) { 
    if ($hget(sprot,%spr).item iswm $1-) {
      ban -ku60 $chan $nick BadWord :3 $v1 (60 sec cooldown)
    }
    dec %spr
  }
}

on @*:action:*:#: { 
  if ($readini($scriptdirsprot.ini,main,ExcludeOP) == 1) && ($nick isop $chan) { return }
  if ($readini($scriptdirsprot.ini,main,ExcludeVoice) == 1) && ($nick isvoice $chan) { return }
  var %spr $hget(sprot,0).item
  while (%spr) { 
    if ($hget(sprot,%spr).item iswm $1-) {
      ban -ku60 $chan $nick BadWord :3 $v1 (60 sec cooldown)
    }
    dec %spr
  }
}

on @*:join:*: {
  if ($readini($scriptdirsprot.ini,main,Identd) == 1) {
    var %identd $hget(sprot,0).item
    while (%identd) { 
      if ($hget(sprot,%identd).item iswm $gettok($right($address($nick,3),-3),1,64)) {
        ban -k $chan $nick Bad Identd detected:3 $v1 (change your Identd and then return. [perm ban])
      }
      dec %identd
    }
  }
}
#BadWords End

; <----------------------- $Menus ----------------------->

menu channel,status { 
  Swear Protection:sprot
}

menu menubar {
  Swear Protection
  .About:sprot.about
  .Unload
  ..Yes:.unload -rs $script
}

; Swear Protection
; by ch1zra
; ch1zra@gmail.com
; http://uptheirons.co.sr/
; #Scripters @ irc.krstarica.com
; Copyright © Up The Irons ! inc. Scripting Team