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.

Whats wrong?

Old posts that have not been replied to for several years.
Locked
c
cYclone

Whats wrong?

Post by cYclone »

Code: Select all

setudef flag adrevenge 
bind pubm - "*#*" ad:rvng 
set adfloodprot 1 
proc ad:rvng {n u h c a} { 
    global adfloodprot 
    if {$adfloodprot} { 
        if {[lsearch [channel info $c] +adrevenge]} { 
            set chan [lindex $a [lsearch $a #*]] 
            if {[lsearch [channels] $chan]==-1} { 
                if {![string match -nocase #help*] && ![string match -nocase #feds]} { 
                    channel add $chan 
                    set adrvng [list putserv "PRIVMSG $chan :Visit: $c \037(\037\002Advertise Revenge\002 from $n\037)\037"]  
	  set adfloodprot 0 
	  set partchan [list putserv "PART $chan \00314::\0037 $c \00314::\003"; channel remove $chan; set adfloodprot 1]
	  utimer 5 $adrvng 
	  utimer 10 $partchan 
                }     
            } 
        } 
    }
}
putlog "\00303Advertise Revenge Loaded!"
Whats wrong? :)
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Looks like some problems with lsearch and string match.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Lists have indexes that start at, and include 0.

The IF command, treats <> 0 as true, and only 0 as false.

Because list indexes starts at 0, a not found index, can't be 0, thus it uses "-1" as not found.

"-1" follows the <>0 system, thus is TRUE in the eyes of IF.
Locked