This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Any way to lower the CPU usage on this script

Old posts that have not been replied to for several years.
Locked
d
daspoo

Any way to lower the CPU usage on this script

Post by daspoo »

Is there any way to lower the CPU usage on this script at all
the bind pubm has 149 entries on it and I did not post it because of the content of the text contained.

Code: Select all

## start

## ================================= ##
#  Curse List                         #
## ================================= ##
 bind pubm - there are 149 entries here I did not post them because of the content 
 
 
set Rules "Take another look at our RULES at http://www.chatfamily.com/rules.html"
set staff "#staff"
set bword "badword1"
 
set flag1 A
set flag2 B
set flag3 C
 
## ------========================------##
#  swearkick                            #
## ------========================------##
proc swearkick {nick host hand chan rest } {
    global staff Rules behave botnick banmask bword
 
    if {![string match [string tolower $chan] $staff]} {
        set uhost "[maskhost $host ]"
        set banmask "[lindex [split $uhost !] 1]"
set behave {
 
     "your behavior is not within ChatFamily standards. Allow me to show you the door!"
     "thank you for pointing out the fact that you are an ignoramous."
     "I am guessing that you are not the sharpest tool in the shed."
     "OK you win, you are stupider than I gave you credit for."
     "you ARE the weakest link! GOODBYE..."
     "were your parents related before the wedding?"
     "the village called they want their IDIOT back."
     "homie don't play dat!"  
     "NOW I have to lay da schmizack down."
     "take a few days off to reflect on what you did to anger me."
     "you kiss your mother with that mouth?"
     "now I am going to knock out a few chicklets!"
    "DON'T mess with the hair punk!"
     "don't make me have to use my good foot"
     "better clean this mess up before somebody sees it."
     "if you were trying to get my attention YOU HAVE IT!"
     "you ain't gotta go home, but you have to get the hell out of here!"
     "I want you to know; I still love you."
     "You are frightening our customers, we must ask you to leave."
     "Violence is never a solution, but sometimes it just feels good."
     "P.S. This doesn't mean we can't be friends"
     "My foot itches... ahh... much better..."
     "This relationship just isn't going to work out"
     "POP goes the weasel..." 
 
 
 
 
      }
 
       if {([matchattr $hand C])} {
          setuser $nick COMMENT "AKILL for NO less than 30 days"
          set printochan [lindex $behave [rand [llength $behave]]]
          set time [strftime %H:%M] 
          putserv "PRIVMSG $chan :$nick, $printochan"
          putserv "PRIVMSG OPERSERV :AKILL ADD +30d $banmask SwearKick - \002$nick\002 was banned in $chan the time was $time"
          putserv "PRIVMSG $staff :I banned $nick \002\($banmask\)\002 from the server for cussing in $chan"
        return 1
        } elseif {([matchattr $hand B])} {
          chattr $nick +C-B
          set printochan [lindex $behave [rand [llength $behave]]]
          set time [strftime %H:%M]
          putserv "PRIVMSG $chan :$nick, $printochan"
          putserv "PRIVMSG OPERSERV :AKILL ADD +14d $banmask SwearKick - \002$nick\002 was banned in $chan the time was $time"
          putserv "PRIVMSG $staff :I banned $nick \002\($banmask\)\002 from the server for cussing in $chan"
          setuser $nick COMMENT "3 Offense Swearing"
          return 1
        } elseif {([matchattr $hand A])} {
          chattr $nick +B-A
          set printochan [lindex $behave [rand [llength $behave]]]
          set time [strftime %H:%M]
          putserv "PRIVMSG $chan :$nick, $printochan"
          putserv "PRIVMSG OPERSERV :AKILL ADD +2d $banmask SwearKick - \002$nick\002 was banned in $chan the time was $time"
          putserv "PRIVMSG $staff :I banned $nick \002\($banmask\)\002 from the server for cussing in $chan"
          setuser $nick COMMENT "2nd Offense Swearing"
          return 1
        }
          adduser $nick [maskhost [getchanhost $nick $chan]]
          set printochan [lindex $behave [rand [llength $behave]]]
          set time [strftime %H:%M]
          putserv "PRIVMSG $chan :$nick, $printochan"
          putserv "PRIVMSG OPERSERV :AKILL ADD +1d $banmask SwearKick - \002$nick\002 was banned in $chan the time was $time"
          putserv "PRIVMSG $staff :I banned $nick \002\($banmask\)\002 from the server for cussing in $chan"
          chattr $nick +A
          setuser $nick PASS $bword
          setuser $nick COMMENT "1st Offense Swearing"
          return 0
     
     
    }
}
##------===================------##
# initialization stuffz           #
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Instead of creating 149 pubm binds why don't you create just one and do a *search* to see if a word from that certain list can be found in the line said by the users in the channel.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Dedan
Master
Posts: 260
Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis

Post by Dedan »

use some of this code from my script
to help you in this endevor

Code: Select all

set bad_words {
  "lagged"
  "microsoft"
  "netsplit"
}


set kick_msg { 
  "your behavior is not within ChatFamily standards. Allow me to show you the door!" 
  "thank you for pointing out the fact that you are an ignoramous." 
  "I am guessing that you are not the sharpest tool in the shed."
}


bind pubm -|- * protect:channel

proc protect:channel {nick uhost handle channel text} {
  global bad_words

  foreach bw $bad_words {
    if {[string match -nocase "$bw" "$text"]} {

      set your ban here

      if {[onchan $nick $chan]} {
      set temp_msg $::kick_msg
      set temp_msg [lindex $temp_msg [rand [llength $temp_msg]]]
      putquick "KICK $chan $nick :$temp_msg"}
      return 0
    }
  }
}

8)
I once was an intelligent young man, now i am old and i can not remember who i was.
Locked