egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

color kick - this tcl does not work someone helps me

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 144
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Tue Jan 24, 2017 9:44 pm    Post subject: color kick - this tcl does not work someone helps me Reply with quote

interesting tcl but it does not work already.. it does not express any error in the partyline
Code:
###
### 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
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 144
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Wed Jan 25, 2017 12:36 am    Post subject: Re: color kick - this tcl does not work someone helps me Reply with quote

solve the tcl now it works very well... nocolors.tcl
Code:
###
### ColorKick 1.1 - By Lucas Madar (darkrot@dal.net)
### updated for Arnold_X-P (urquizoandrade@hotmail.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
 }
}

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Wed Jan 25, 2017 1:16 am    Post subject: Reply with quote

There are redundancies in your code.

Code:

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:

if {$nick == $botnick} {return 0}


The proper method would be
Code:
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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 144
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Wed Jan 25, 2017 10:33 pm    Post subject: Reply with quote

ok Get_A_Fix thanks Smile
Code:

if {[matchattr $hand om]} {     <<< is correct
&
if {[isbotnick $nick]} {return}

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber