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.

Need help - Script will not work

Help for those learning Tcl or writing their own scripts.
Post Reply
h
hazzlah
Voice
Posts: 4
Joined: Fri May 13, 2011 9:54 pm

Need help - Script will not work

Post by hazzlah »

Hi @all

have a prob with the Script.
First Line works fine $killnick has passed the authorized Connection.

But when a nick connect with Nick who not stand in the reqexp Line he do nothing.

I dont find the error hope somebody can help me.

Thx

Code: Select all

bind pubm -|- "*SIGNON*user:*" connect:chk


#killproc
proc connect:chk {nick uhost handle chan arg} {

set killnick [lindex $arg 2]

 if { [regexp -nocase {SomeNick} $killnick] || [regexp -nocase {otherNiCk} $killnick] || [regexp -nocase {TheGuy} $killnick] || [regexp -nocase {On3Nick} $killnick] } { 
 putnow "PRIVMSG #chan : $killnick has passed the authorized Connection"

 } else {

  putserv "KILL $killnick : You are not authorized to connect to this server"

   }
}
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I assume you've arranged for your eggdrop to have Irc Op Privileges on the server, and that your eggdrop indeed attains these privileges (using hte OPER command)?

For starters, do you see any errors on your partyline console or logfiles?

Next, don't use list commands (such as lindex) on strings. In this case, use the split command to break the string into a proper list.

Code: Select all

set killnick [lindex [split $arg] 2]
Also, I probably wouldn't use multiple regular expressions in this case, as you aren't really using any patterns or such. A list of approved nicks and an lsearch would be faster, and alot easier to maintain... (although I have to use string tolower to make the matching case-insensitive). This is not related to your problem though.

Code: Select all

set approved [list \
  "somenick" \
  "othersick" \
  "theguy" \
  "on3nick" \
]

proc connect:chk {nick host handle channel text} {
  set killnick [lindex [split $text] 2]
  if {[lsearch -exact $::approved [string tolower $killnick]] >= 0} {
    puthelp "PRIVMSG #chan :$killnick has passed the authorized Connection"
  } else {
    putserv "KILL $killnick :You are not authorized to connect to this server"
  }
}
NML_375
Post Reply