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.

add set channel

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
k
krieg
Voice
Posts: 13
Joined: Tue Nov 20, 2007 11:11 am

Post by krieg »

iamdeath wrote:
krieg wrote:for example:

!kick nick reason
!kick Slay You have bad nickname, change it! Try again to join.

*** Slay was kicked by Botnick (You have bad nickname, change it! Try again to join.)
Find this code:

Code: Select all

proc proc_kick { nick uhost hand chan text } { 
  if {[onchan $text]} { 
    putquick "KICK $chan $text :Requested" 
  } else { putserv "PRIVMSG $chan :\002$text\002 Not In Channel: \002$chan\002" } 
} 
Replace with this:

Code: Select all

proc proc_kick { nick uhost hand chan text } { 
set reason1 [lrange $text 1 end]
  if {[onchan $text]} { 
    putquick "KICK $chan $text :$reason1" 
  } else { putserv "PRIVMSG $chan :\002$text\002 Not In Channel: \002$chan\002" } 
} 
It should kick with a reason now.
it is not working..
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

krieg: You need to be more specific with the "it is not working.." statement.

For any assistance to be given an error message (if any) needs to be posted and/or exactly what is (or not) happening.

Posting the result of ".set errorInfo" would be especially helpful. ;)
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

iamdeath wrote:Find this code:

Code: Select all

proc proc_kick { nick uhost hand chan text } { 
  if {[onchan $text]} { 
    putquick "KICK $chan $text :Requested" 
  } else { putserv "PRIVMSG $chan :\002$text\002 Not In Channel: \002$chan\002" } 
} 
Replace with this:

Code: Select all

proc proc_kick { nick uhost hand chan text } { 
set reason1 [lrange $text 1 end]
  if {[onchan $text]} { 
    putquick "KICK $chan $text :$reason1" 
  } else { putserv "PRIVMSG $chan :\002$text\002 Not In Channel: \002$chan\002" } 
} 
It should kick with a reason now.
A few issues here, you use $text both as a string and as a list at the same time. Decide to use one form, clearly indicating which.
As for the syntax of "KICK", it's "KICK <channel> <nickname> :<reason>". In your case, if "text" holds both the nickname and reason as a list, you'd be supplying too many arguments to the kick-command (in effect, the kick-reason would be the second word in "text", dropping anything beyond it).

Also, if you do not specify which channel to test (when using the onchan command), it'll see if the nickname is on any channel the eggdrop is monitoring rather than any speciffic.

Now, since you use pub-trigger, having "text" as a list is not an option, as users generally can't be trusted to provide valid list-structures. Hence, don't use lindex/lrange directly on it.

Somewhat fixed, no support or warranties of any kind provided. Still relies on the binding to determine access to the command (binding not included).

Code: Select all

proc proc_kick [list nick host hand chan text] {
  set target [lindex [split $text] 0]
  set reason [lindex [split $text] 1 end]
  if {[onchan $target $chan]} {
    putserv "KICK $chan $target :$reason"
  } else {
    puthelp "PRIVMSG $chan :$target not in channel"
  }
}
NML_375
Post Reply