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.

need a help please, don't ignore please

Old posts that have not been replied to for several years.
Locked
A
AW

Post by AW »

hi, i need ur kind help, i am working on this kik command for dcc n for pub, but took me long time to figure out how to set a date n hanlde in a kik msg, like Z was kicked by eggdrop(Apr 23 AW:msg) , but some how i am getting an error about date, please help me this time, thanks u, here are the codes.

for pub:
proc kick_command {nick host handle channel args1} {
set args [split $args1 " "]
set knick [lindex $args 0]
set currdate [date]
set day [lindex $currdate 0]
set amonth [lindex $currdate 1]
set ayear [lindex $currdate 2]
switch $amonth {
Jan {set month "1"}
Feb {set month "2"}
Mar {set month "3"}
Apr {set month "4"}
May {set month "5"}
Jun {set month "6"}
Jul {set month "7"}
Aug {set month "8"}
Sep {set month "9"}
Oct {set month "10"}
Nov {set month "11"}
Dec {set month "12"}

}
set year [string range $ayear 2 3]
set kickdate "$amonth $day"


if {[test_real $nick]} {
return 0
}
if {$knick==""} { return 0 }
set reason [lrange $args 1 end]
if {$reason==""} {
set reason "..go and play outside!"
}
set kickstring "KICK $channel $knick :$kickdate $nick :$reason"
if {[matchattr [nick2hand $knick $channel] o]==0} {
putserv "$kickstring"
} else {
if {[matchattr $handle m]==1} {
putserv "$kickstring"
} else {
set kickstring "KICK $channel $nick :Wow! Lamerrr! Ain't it amazin? (Kick attempt on +o $knick)"
putserv "$kickstring"
}
}
return 1
}

For Dcc:
proc dcc_k_command {handle idx arg} {
set channel [lindex [console $idx] 0]
set nick [hand2nick $handle]
set host [getchanhost $nick]
return [kick_command $nick $host $handle $channel $arg]
}
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

firstly, why you using that bigass switch statement to set the variable $month and then proceding to not actually use it?
secondly you've got some list commands on strings (which is bad). thirdly, you may wanna look at the tcl command 'clock' combined with the eggdrop tcl command 'unixtime'
A
AW

Post by AW »

Thanks petersen! i am new, and trying to learn, can u plz fix these codes this time, so i can use this as an example to work on kb, etc..commands, pleaseeeeeeee
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

To figure out the date string, why don't you use the [clock] tcl command? It can make a date string in any format. Check the manual.
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

didnt i already say that?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Oh, I guess you did heh. Carry on.
Locked