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.

i need basic script: !kill, !kline

Old posts that have not been replied to for several years.
d
deepforest

i need basic script: !kill, !kline

Post by deepforest »

i need basic script.
my eggdrop is admin.
i want to !kill Nick !kline nick scripts.


thanks for replies.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

ok ill give you a syntax its all the same but there are some scripts like that out there. check the tcl archive

!kill

Code: Select all

bind pub n !kill kill:pub

proc kill:pub {nick uhost hand chan arg} {
  set user [lindex $arg 0]
  set reason [lindex $arg 1]
  putserv "KILL $user $reason"
}
do the same for the rest :p well thats basicly it you can also add other stuff like if "" ..

Code: Select all

bind pub n !kill kill:pub

proc kill:pub {nick uhost hand chan arg} {
  set user [lindex $arg 0]
  set reason [lindex $arg 1]
  if {[string match -nocase "" $user] || [string match -nocase "" $reason] == 1} {
    putserv "NOTICE $nick :Usage: !kill <nick> <reason>"
  } else {
    putserv "KILL $user $reason"
    putserv "NOTICE $nick :$user has been killed from irc."
  }
}
ok then it will probaly look more like this
XplaiN but think of me as stupid
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Why do you use the "string match" in:

Code: Select all

if {[string match -nocase "" $user] || [string match -nocase "" $reason] == 1} {
instead of:

Code: Select all

if {user == "" || $reason == ""} {
Any reason to do so? Also, you can do this "check" by doing something like:

Code: Select all

if {[llength $arg] != 2} {
Last edited by caesar on Mon Sep 08, 2003 10:32 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

...also, SPLITTING THE STRING BEFORE YOU USE LIST COMMANDS ON IT might be a good idea. :wink:
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Damn! I've forgot again to mention that.. :)
Once the game is over, the king and the pawn go back in the same box.
d
deepforest

private message !kill command

Post by deepforest »

ok thanks. it's working but i don't want to command in channel.
i want to script working in private message .

example: /msg Botnick !kill nick reason

thanks..
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Read the tcl-commands.doc file for the bind msg and start doing yourself the code. Don't be lazy. :P
Once the game is over, the king and the pawn go back in the same box.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

Why do you use the "string match"
well you can do it either way i know there beter ways but haven't figured out witch one is best under what circomstances sorry hehe and also .. you could like use 1 and 0 return .. if you know what i mean so you could easely set it to 0 .. it was just an general example .. to use under any circomstances ..
XplaiN but think of me as stupid
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

I think checking $arg as the first thing inside the proc would make the most sense. Then you would avoid all that work for nothing. No need to split an empty string just to find out it's empty :)
The best way to check if a variable is empty (imo) is

Code: Select all

if {[string length $arg]} {not empty} {empty}
d
deepforest

i did it but doesn't work

Post by deepforest »

i trying this code but command doesn't working.

bind msg !kill kill:msg

proc kill:msg {nick uhost hand chan arg} {
set user [lindex $arg 0]
set reason [lindex $arg 1]
if {[string match -nocase "" $user] || [string match -nocase "" $reason] == 1} {
putserv "NOTICE $nick :Usage: !kill <nick> <reason>"
} else {
putserv "KILL $user $reason"
putserv "NOTICE $nick :$user has been killed from irc."
}
}
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: i did it but doesn't work

Post by user »

deepforest wrote:i trying this code but command doesn't working.
Try using the correct syntax when creating the bind
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

[from tcl-commands.doc]
(1) MSG
bind msg <flags> <command> <proc>
procname <nick> <user@host> <handle> <text>

Description: used for /msg commands. The first word of the user's
msg is the command, and everything else becomes the text argument.
Module: server
also don't forget what User said: set arg [split $arg]
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Actualy user was talking about the bind wich is incorrect. Also, please do follow the sugestions you've recived for the public bind.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

user wrote:...also, SPLITTING THE STRING BEFORE YOU USE LIST COMMANDS ON IT might be a good idea. :wink:
caesar, I was talking abou this post. wasn't he talking about the [aplit $arg] ? :P
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Actualy is split not aplit :) Also he sugested a better way to get the length of the line using the string length .. pay attention. :P
Once the game is over, the king and the pawn go back in the same box.
Locked