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 and else.

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

need and else.

Post by Nor7on »

Code: Select all

setudef flag lockunban

proc blacklist:userdel {nickname hostname handle text} { 
	global unbanc botnick blacklist BLNicks lockblack bchanwork
if {[lsearch -exact [channel info $bchanwork] "+lockblack"]} {
	  puthelp "privmsg $nickname :sorry can't use this command."
	  puthelp "privmsg $nickname :pls contact with a OP."
	} else {
rest of script...
is little code is, if my chan have flag +lockunban put the puthelps, else the rest of my code.

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

Post by nml375 »

First off, you never defined the lockblack channel setting, so I'm assuming you actually intended to use the lockunban.
Secondly, there's a much better way of checking whether the setting is set or not, using channel get.

Finally, your post really does not say much as to what your script should do, should the channel setting not be set. The vast list of global variables also makes no sense..

I'm posting the fix regarding channel setting, but you really need to specify what it is you are asking for...

Code: Select all

setudef flag lockunban

proc blacklist:userdel {nickname hostname handle text} {
 global unbanc botnick blacklist BLNicks lockblack bchanwork
 if {[channel get $bchanwork lockunban]} {
  puthelp "privmsg $nickname :sorry can't use this command."
  puthelp "privmsg $nickname :pls contact with a OP."
 } else {
#Rest goes here
 }
}
NML_375
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

Code: Select all

setudef flag lockunban 

proc blacklist:userdel {nickname hostname handle text} { 
 global unbanc botnick blacklist BLNicks lockblack bchanwork 
 if {[channel get $bchanwork lockunban]} { 
  puthelp "privmsg $nickname :sorry can't use this command." 
  puthelp "privmsg $nickname :pls contact with a OP." 
 } else { 
 set cmd [lindex [split $text] 0]
 set hostmask [string tolower $nickname!$hostname] 
 foreach blnick $BLNicks {
if {[string match -nocase [set ban [lindex [split $blnick] 0]] $nickname!$hostname]} {
bla bla bla put ban, kick, etc.
    }
   }
  }
}
but it don't work, when have +lockunban send the puthelp, and the same when have -lockunban.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Well, then the error really is not with your script, but with how you try to alter the lockunban flag for the specific channel.
NML_375
Post Reply