I have this code, it suspend when a Op kicked other Op via X.
So i want add when is first kick, suspend only 3Days. if kick again, suspend for 5 days, and if continue one kick more, my eggdrop run this comand:
.-user $kicker(user)
.msg x remuser #mychan username of kicker.
but the code only put chattr +Y, if continue, don't put -Y+E
bind kick - * xstuff:kick
proc xstuff:kick {nick host hand chan target reason} {
if {[matchattr [nick2hand $target $chan] b|b $chan] || [matchattr [nick2hand $target $chan] o|o $chan]} {
set kicker [string trim [lindex [split $reason] 0] {()}]
if {[string match -nocase "\*" [lindex [split $hand] 0] } {
set hand [nick2hand $kicker]
}
if {[matchattr $hand E]} {
deluser $hand
putserv "PRIVMSG X :REMUSER $chan $kicker"
return 1
} elseif {[matchattr $hand Y]} {
chattr $hand -Y+E
putserv "PRIVMSG X :SUSPEND $chan $kicker 3d"
return 1
} else {
chattr $hand +Y
putserv "PRIVMSG X :SUSPEND $chan $kicker 2d"
putlog "Suspendiendo el username $kicker y cambiando flag a $hand"
return 1
}
} else {
return 0
}
}
putlog "Suspend and remuser"
You misplaced a curly brace, and forgot to construct your if statements in the correct conditional order. You realize, since everything is handled within the procedure (invoked by a public kick bind), using 'return' statements isn't really necessary at all, right?
Edit: try again.. works
Last edited by speechles on Mon Jun 16, 2008 5:52 pm, edited 6 times in total.
variable adminlist "nick1 nick2 nick3"
bind kick - * xstuff:kick
proc xstuff:kick {nick host hand chan target reason} {
if {[matchattr [nick2hand $target $chan] b|b $chan] || [matchattr [nick2hand $target $chan] o|o $chan]} {
set kicker [string trim [lindex [split $reason] 0] {()}]
set hand [nick2hand $kicker $chan]
if {[string match -nocase "\*" [lindex [split $hand] 0]] } {
xstuff:admin "X ha utilizado para patada $target. No puedo suspender $kicker. Este usuario no tiene asa."
return 0
} elseif {[lindex [split $hand] 0] == ""} {
xstuff:admin "X ha utilizado para patada $target. No puedo suspender $kicker. No se puede encontrar este apodo en irc por más tiempo.."
return 0
}
if {[matchattr $hand E]} {
deluser $hand
putserv "PRIVMSG X :REMUSER $chan $kicker"
return 1
} elseif {[matchattr $hand Y]} {
chattr $hand -Y+E
putserv "PRIVMSG X :SUSPEND $chan $kicker 3d"
return 1
} else {
chattr $hand +Y
putserv "PRIVMSG X :SUSPEND $chan $kicker 2d"
putlog "Suspendiendo el username $kicker y cambiando flag a $hand"
return 1
}
} else {
return 0
}
}
proc xstuff:admin {text} {
foreach admin $::adminlist {
putserv "privmsg $admin :$text"
}
}
putlog "Suspend and remuser"
There are two instances where admins will be needed. Fill the admin list at top with a list of nicks you want alerted when the suspend script cannot: a) find the nickname on irc b) cannot find the handle record for nick
Edit: corrected missing bracket according to post below, all is well now.
Last edited by speechles on Sat Jun 28, 2008 11:45 am, edited 2 times in total.
I fixed it, see the code above where I originally posted it with adminlist config setting. There was indeed a missing closing bracket on the string match that has since been addressed. It will now work as intended for you, and when it doesn't will message one of your admin's why it isn't doing what is expected.
^Modo^ is nor7on@Colmillo.users.undernet.org
Nombre : Visita: ------------
Canales : @#chan1 @#chan2 @#chan3
Servidor : *.undernet.org - The Undernet Underworld
Modo is Logged how: Colmillo
<Nor7on^> .whois Modo
<Chasse> HANDLE PASS NOTES FLAGS LAST
<Chasse> Modo no 0 bflo 17:28 (#Madrid)
<Chasse> HOSTS: *!*@Colmillo.users.undernet.org
<Chasse> ADDRESS: xx.xxx.xxx.x
<Chasse> users: xxxx, bots: xxxx
when ^Modo^(Colmillo) kick via X to me, Chasse can't change flag to Colmillo or ^Modo^.'cause don't find Colmillo or ^Modo^ in userlist.
so there is some way to instert a database for:
$username = $hand
example:
Colmillo = Modo
Alask = Alaska
Ligre = Felino
if it finds "Colmillo" in the kick message, it read the database for change flag to Modo.
if it finds "Ligre" in the kick message, it read the database for change flag to Felino.
etc...