Code: Select all
bind pub vgmn|vgmn .up pub:voice
bind pub vgmn|vgmn .down pub:voice
proc pub:voice {nick host hand chan text} {
switch -- $::lastbind {
".up" { set voice "+" }
".down" { set voice "-" }
}
if {[info exists voice]} {
set target $nick
if {[matchattr $hand mn|mn $chan]} {
if {[string length [lindex [split $text] 0]]} {
set target [lindex [split $text] 0]
}
}
pushmode $chan ${voice}v $target
}
}
You should allow either +v or +g flags , this allows both the voice mechanisms eggdrop uses. This also expands the idea to allow master/owners (+m/+n) to move users up or down.
<nick> .up
* bot sets mode: +v nick
<+nick> it works :)
<@owner> .down nick
* bot sets mode: -v nick
<nick> :(
<nick> .down owner
<nick> won't work for me :(((
<@owner> .up nick
* bot sets mode: +v nick
<@owner> .up
* bot sets mode: +v owner
<+@owner> only for me :P
Also, a final note: Ditch the "return 1" it has no purpose. All it does is cause users to wonder, "Why doesn't my eggdrop log things???!" or the better one, "Why can't I stack pubms to everything said (*)???!!!" .. The answers to both of those is somewhere some script is returning 1 to a bind...
"return 1" is the retarded cousin of "args". I imagine more than likely that, "return 1" and "args" are also inbred incestual cousins...
But being serious now, both of these "special" parameters are barely documented leading to confusion over the cause and cure. Which in turn makes a small problem larger, and hair pulling more frequent. To avoid these headaches (visible bracings and console/log/pubm/msgm problems) proactively limit your use of "return 1" or "args" to exceptional cases that require it, not just for purposelessness.
# now talking in eggdrop
<args> let's have sex
<return_1> okay
<speechles> lol