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.

color kick - this tcl does not work someone helps me

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

color kick - this tcl does not work someone helps me

Post by Arnold_X-P »

interesting tcl but it does not work already.. it does not express any error in the partyline

Code: Select all

###
### ColorKick 1.1 - By Lucas Madar (darkrot@dal.net)
###
# 
# This script will do one of three things:
# 1) Nothing
# 2) Kick on the use of any mIRC colors in the channel
# 3) Kick on abuse of mIRC colors (3 or more) in the channel
#
# This can be changed by any op.
# It also warns users if the kick is on when they join the channel.
# /msg botnick colorkick 0 = off
# /msg botnick colorkick 1 = kick on
# /msg botnick colorkick 2 = abuse kick on
#
# Modify all you like, just remember to give the original author credit.
# (Lucas Madar)

set colornum 0

bind pubm - * color_check

proc color_check {nick userhost hand chan things} {
  global colornum
  if {$colornum == 0} {return 0}
  if {[matchattr $hand m] || [isop $nick $chan] || [matchattr $hand f]} {return 0}
  set colorchar \003
  if {$colornum == 1} {
    if {[string match "*$colorchar*" $things]} {
     putserv "KICK $chan $nick :Please do not use colors on this channel."
     return 0
    }
  } else {
    if {[string match "*$colorchar*$colorchar*$colorchar**$colorchar*$colorchar*$colorchar*" $things]} {
     putserv "KICK $chan $nick :Please limit the amount of colors you use."
     return 0
    }
  }
}

bind msg - colorkick colorkickset

proc colorkickset {nick uhost hand stuff} {
  global colornum botnick
  if {!([matchattr $hand o] || [matchattr $hand m])} {return 0}
  set cchoice [lindex $stuff 0]
  if {$cchoice == 0} {
   putserv "NOTICE $nick :Color Kick Set to 0 - off"
   set colornum 0
   return 0
  }
 if {$cchoice == 1} {
   putserv "NOTICE $nick :Color Kick Set to 1 - Kick on any use of colors"
   set colornum 1
   return 0
  }
 if {$cchoice == 2} {
   putserv "NOTICE $nick :Color Kick Set to 2 - Kick on abuse of colors (3 or more)"
   set colornum 2
   return 0
  }
 putserv "NOTICE $nick :Invalid color kick option - $cchoice"
 putserv "NOTICE $nick :Valid options are: /msg $botnick colorkick \[0,1,2\]"
 putserv "NOTICE $nick :0 = Off, 1 = Kick on any colors, 2 = kick on 3 or more colors" 
}

bind join - * color_warning

proc color_warning {nick uhost hand chan} {
 global colornum botnick
 if {$nick == $botnick} {return 0}
 if {$colornum == 0} {return 0}
 if {$colornum == 1} {
  putserv "NOTICE $nick :Warning: Color kick is on. The use of colors will result in a kick."
  if {[matchattr $hand o] || [matchattr $hand m]} {
   putserv "NOTICE $nick :You can change this. /msg $botnick colorkick help (The kick will also not affect you)"
  }
  return 0
 }
 if {$colornum == 2} {
  putserv "NOTICE $nick :Warning: Color abuse kick is on. The use of 3 or more colors will result in a kick."
  if {[matchattr $hand o] || [matchattr $hand m]} {
   putserv "NOTICE $nick :You can change this. /msg $botnick colorkick help (The kick will also not affect you)"
  }
  return 0
 }
}
he would be grateful very much for its help in this tcl
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Re: color kick - this tcl does not work someone helps me

Post by Arnold_X-P »

solve the tcl now it works very well... nocolors.tcl

Code: Select all

###
### ColorKick 1.1 - By Lucas Madar (darkrot@dal.net)
### Updated by Arnold_X-P & sedition irc.dal.net (urquizoandrade@gmail.com)
#
# This script will do one of three things:
# 1) Nothing
# 2) Kick on the use of any mIRC colors in the channel
# 3) Kick on abuse of mIRC colors (3 or more) in the channel
#
# This can be changed by any op.
# It also warns users if the kick is on when they join the channel.
# /msg botnick colorkick 0 = off
# /msg botnick colorkick 1 = kick on
# /msg botnick colorkick 2 = abuse kick on / kick on 3 or more colors
#
# Modify all you like, just remember to give the original author credit.
# (Lucas Madar)

set colornum 0

bind ctcp - ACTION ctcp_nocolors
proc ctcp_nocolors {nick uhost hand chan keyword arg} {
 color_check $nick $uhost $hand $chan $arg
}

bind pubm - * color_check

proc color_check {nick userhost hand chan arg} {
  global colornum
  if {$colornum == 0} {return 0}
  if {[matchattr $hand m] || [isop $nick $chan] || [matchattr $hand f]} {return 0}
  set colorchar \003
  if {$colornum == 1} {
	 if { [string match "*$colorchar*" $arg] } {
     putserv "KICK $chan $nick :Please do not use colors on this channel."
     return 0
    }
  } else {
    if {[string match "*$colorchar*$colorchar*$colorchar**$colorchar*$colorchar*$colorchar*" $arg]} {
     putserv "KICK $chan $nick :Please limit the amount of colors you use."
     return 0
    }
  }
}

bind msg - colorkick colorkickset

proc colorkickset {nick uhost hand stuff} {
  global colornum botnick
  if {!([matchattr $hand o] || [matchattr $hand m])} {return 0}
  set cchoice [lindex $stuff 0]
  if {$cchoice == 0} {
   putserv "NOTICE $nick :Color Kick Set to 0 - off"
   set colornum 0
   return 0
  }
 if {$cchoice == 1} {
   putserv "NOTICE $nick :Color Kick Set to 1 - Kick on any use of colors"
   set colornum 1
   return 0
  }
 if {$cchoice == 2} {
   putserv "NOTICE $nick :Color Kick Set to 2 - Kick on abuse of colors (3 or more)"
   set colornum 2
   return 0
  }
 putserv "NOTICE $nick :Invalid color kick option - $cchoice"
 putserv "NOTICE $nick :Valid options are: /msg $botnick colorkick \[0,1,2\]"
 putserv "NOTICE $nick :0 = Off, 1 = Kick on any colors, 2 = kick on 3 or more colors"
}

bind join - * color_warning

proc color_warning {nick uhost hand chan} {
 global colornum botnick
 if {$nick == $botnick} {return 0}
 if {$colornum == 0} {return 0}
 if {$colornum == 1} {
  putserv "NOTICE $nick :Warning: Color kick is on. The use of colors will result in a kick."
  if {[matchattr $hand o] || [matchattr $hand m]} {
   putserv "NOTICE $nick :You can change this. /msg $botnick colorkick help (The kick will also not affect you)"
  }
  return 0
 }
 if {$colornum == 2} {
  putserv "NOTICE $nick :Warning: Color abuse kick is on. The use of 3 or more colors will result in a kick."
  if {[matchattr $hand o] || [matchattr $hand m]} {
   putserv "NOTICE $nick :You can change this. /msg $botnick colorkick help (The kick will also not affect you)"
  }
  return 0
 }
}
Last edited by Arnold_X-P on Mon Mar 04, 2019 10:36 pm, edited 2 times in total.
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

There are redundancies in your code.

Code: Select all

if {[matchattr $hand o] || [matchattr $hand m]} {
If you check for matchattr $hand o it will match any flag above, which means it will work for m without the need to declare.

This has been done in the colorkickset and color_warning procedures.

The same is true for

Code: Select all

if {$nick == $botnick} {return 0}
The proper method would be

Code: Select all

if {[isbotnick $nick]} {return}
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

ok Get_A_Fix thanks :)

Code: Select all

if {[matchattr $hand om]} {     <<< is correct 
&
if {[isbotnick $nick]} {return}
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
Post Reply