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.

Can someone help me debug this logic?

Old posts that have not been replied to for several years.
Locked
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Can someone help me debug this logic?

Post by Weirdo »

Code: Select all

 This enables the !nuke command - Requested by Quista - Version 4
bind pub lomn !nuke pub:nuke
proc pub:nuke {nick uhost hand chan text} {
	global runchan defreason2
	set kicknick [lindex [split $text] 0]
	set reason [lrange [split $text] 1 end]
	if {$reason == "" } {set reason $defreason2} 
	if {[onchan $kicknick $chan] == 1 } {
		putcmdlog "!$hand! Nuked $kicknick in $chan"
		putserv "KICK $chan $kicknick :$reason" } {
		puthelp "Notice $nick :Unable to kick - Nickname does not correspond to channel user"
	}
} 
Doing an update to my nuke script by adding the checking for a nick on channel. Problem is, no matter if:

onchan $kicknick $chan ==1 or != 1 it has the same result. Is this a problem with my logic, or with the code itself?

Thanks
T
Thor

Post by Thor »

???

[onchan ...] returns 1 or 0.

u can replace

if {[onchan ...] == 1} by if [onchan ... ]
if {[onchan ...} == 0} by if ![onchan ...]
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

Post by Weirdo »

right, so the ==1 isnt needed at all then. Thank you :)
Locked