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.

Help with this clone script

Old posts that have not been replied to for several years.
Locked
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Help with this clone script

Post by CoMMy »

Can anyone help with this ?
It bans every person it joins unless its a member of course.
What i want it to do is see if the person's host matches one of another person in the chan and ban both..

Here is the code.

Code: Select all

bind join - * joiner
proc joiner {nick host handle chan} {
global botnick ban_type
if {[ischanset $chan noclones]} {
if {![matchattr $handle &o $chan] || ![matchattr $handle o]} {
foreach user [chanlist $chan] {
set what "$user![getchanhost $user $chan]"
if {[string match -nocase "*$host*" "$what"]} {
newchanban $chan [hostmasktype $nickshost $ban_type] $botnick "Clones In $chan" "15" sticky
putquick "KICK $chan $user Clones Are Not Allowed" -next }}}
putquick "KICK $chan $nick Clones Are Not Allowed" -next }
Thanks
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: Help with this clone script

Post by user »

CoMMy wrote:

Code: Select all

bind join - * joiner
proc joiner {nick host handle chan} {
	global botnick ban_type
	if {[ischanset $chan noclones]} {
		if {![matchattr $handle &o $chan] || ![matchattr $handle o]} {
			foreach user [chanlist $chan] {
				set what "$user![getchanhost $user $chan]"
				if {[string match -nocase "*$host*" "$what"]} {
					newchanban $chan [hostmasktype $nickshost $ban_type] $botnick "Clones In $chan" "15" sticky
					putquick "KICK $chan $user Clones Are Not Allowed" -next
				}
			}
		}
		putquick "KICK $chan $nick Clones Are Not Allowed" -next 
	}
You're missing a } there...and you seem to be kicking anyone joining the +noclones channel...a bit weird :P Try something like this:

Code: Select all

bind join - * joiner
proc joiner {n u h c} {
	if {![ischanset $c noclones]||[matchattr $h o|o $c]} return
	foreach x [chanlist $c] {
		if {[string equal -nocase $n $x]} continue
		if {[string equal -nocase $u [getchanhost $x $c]]} {
			# same user@host... kick $x and $n then return or break
		}
	}
}
Have you ever read "The Manual"?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

user wrote: if {![ischanset $c noclones]||[matchattr $h o|o $c]} return
and you haven't missed some } and { too? :mrgreen:

Ps: Use the default "channel get" instead of the "ischanset" proc. :P
Once the game is over, the king and the pawn go back in the same box.
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

I'll try your advice user and check to see if it works.

Basically my proc kick+banned everyone who joined that chan regarding if the host matched !!!!

Anyway. I'll try it :P
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

caesar wrote:
user wrote: if {![ischanset $c noclones]||[matchattr $h o|o $c]} return
and you haven't missed some } and { too? :mrgreen:

Ps: Use the default "channel get" instead of the "ischanset" proc. :P
There are no missing {}'s. :mrgreen: (strings with no whitespace/special chars don't need escaping/quoting) Calling a proc instead of using the recently added "channel get" makes sense if you want your script to work on older eggdrop models AND i stole that part from his example, so I assume he's got a proc doing the right thing.
Have you ever read "The Manual"?
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

Well this is the ischanset proc

Code: Select all

proc ischanset {chan setting} {
set setting "+[string tolower $setting]"
foreach item [string tolower [channel info $chan]] {
if {$item == $setting} { return 1 }}
return 0 }
This uses the old method of getting a channel flag. Can you update the proc to use "channel get" please? I need to change this because i have a lot of procs using ischanset.

Thanks :D
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

@ CoMMy : replace your "ischanset" with "channel get" and voila! :mrgreen: also, next time don't be lazy and consult the tcl-commands.doc file. :P

@ user : Thanks for sharing that info :)
Once the game is over, the king and the pawn go back in the same box.
Locked