mIRC Home    About    Download    Register    News    Help

Print Thread
scanning text files #115804 30/03/05 10:57 AM
Joined: Jun 2003
Posts: 56
G
Gamersad Offline OP
Babel fish
OP Offline
Babel fish
G
Joined: Jun 2003
Posts: 56
Alright, i'm half asleep so bare with me here...

I want to make a script that kicks for a bad word, rather then having to script tons and TONS of stuff, i'd like to just make it so you could easily add the word into a text file or ini file, where it could then be read...

so say a user came into the channel and said 'bob' and 'bob' was a bad word, the user would be kicked for it, but, i dont know quite where to go with this, i tried making it work once before.. i think you could probably easily do it with ini files.. and writeini and readini i just dont know how to go about it. I'd rather use ini then a text file.. anyway... Any ideas? Maybe something i did wrong with readini?


- Andrew Berquist, Windfyre Network
Re: scanning text files #115805 30/03/05 12:54 PM
Joined: Mar 2004
Posts: 175
Relinsquish Offline
Vogon poet
Offline
Vogon poet
Joined: Mar 2004
Posts: 175
Code:
alias badword {
  if (!$1) {
    if ($group(#badword) == on) {
      .disable #badword
      echo -ac info * Bad word kicker has been disabled
    }
    else {
      .enable #badword
      echo -ac info * Bad word kicker has been enabled
    }
  }
  if ($1 == -a) {
    hadd -m badword $2 1
    echo -ac info * $2 has been added to the bad word list
  }
  if ($hget(badword,$2)) {
    if ($1 == -d) {
      hdel badword $2
      echo -ac info * $2 has been deleted from the bad word list
    }
    if ($1 == -r) {
      hfree badword
      echo -ac info * Bad word list has been cleared
    }
    if ($1 == -l) {
      echo -ac info * Bad words list:
      var %x = 1
      while ($hget(badword,%x).item) {
        echo -ac info $v1
        inc %x
      }
    }
  }
}
on *:START: {
  if ($hget(badword)) { hfree badword }
  hmake badword
  if ($isfile(badword.hsh)) { hload -b badword badword.hsh }
}
on *:UNLOAD: {
  if ($hget(badword)) {
    hsave -bo badword badword.hsh
    hfree badword
  }
}
on *:EXIT: {
  if ($hget(badword)) {
    hsave -bo badword badword.hsh
  }
}
#badword off
on @*:TEXT:*:#: {
  if ($hget(badword)) {
    while ($0) {
      if ($hget(badword,$1)) {
        kick # $nick Please do not say bad words in here.
        break
      }
      tokenize 32 $2-
    }
  }
}
on @*:ACTION:*:#: {
  if ($hget(badword)) {
    while ($0) {
      if ($hget(badword,$1)) {
        kick # $nick Please do not say bad words in here.
        break
      }
      tokenize 32 $2-
    }
  }
}
on @*:NOTICE:*:#: {
  if ($hget(badword)) {
    while ($0) {
      if ($hget(badword,$1)) {
        kick # $nick Please do not say bad words in here.
        break
      }
      tokenize 32 $2-
    }
  }
}
#badword end

Syntax: /badword [-adrl] <on|off|badword>

I think this will work. :tongue:


- Relinsquish
Re: scanning text files #115806 30/03/05 08:32 PM
Joined: Mar 2004
Posts: 175
Relinsquish Offline
Vogon poet
Offline
Vogon poet
Joined: Mar 2004
Posts: 175
Argh, there's no more edit time. I made a few minor errors in the alias.

Code:
alias badword {
  if (!$1) {
    echo -ac info * Bad word kicker is $group(#badword)
  }
  if ($1 == off) {
    .disable #badword
    echo -ac info * Bad word kicker has been disabled
  }
  if ($1 == on) {
    .enable #badword
    echo -ac info * Bad word kicker has been enabled
  }
  if ($1 == -a) {
    hadd -m badword $2 1
    echo -ac info * $2 has been added to the bad word list
  }
  if ($hget(badword,$2)) &amp;&amp; ($1 == -d) {
    hdel badword $2
    echo -ac info * $2 has been deleted from the bad word list
  }
  if ($hget(badword)) {
    if ($1 == -r) {
      hfree badword
      echo -ac info * Bad word list has been cleared
    }
    if ($1 == -l) {
      echo -ac info * Bad words list:
      var %x = 1
      while ($hget(badword,%x).item) {
        echo -ac info $v1
        inc %x
      }
    }
  }
}


- Relinsquish
Re: scanning text files #115807 31/03/05 04:26 AM
Joined: Jun 2003
Posts: 56
G
Gamersad Offline OP
Babel fish
OP Offline
Babel fish
G
Joined: Jun 2003
Posts: 56
Thanks smile


- Andrew Berquist, Windfyre Network