View Single Post
Old 26-02-2007, 10:50   #2 (permalink)
arcade
TCB & Ratings projects Member, #Mythic representative
 
arcade's Avatar
 
Join Date: Jun 2004
Location: In fatza calculatorului!!
Age: 19
Posts: 218
Rep Power: 37
arcade is on a distinguished road
Send a message via Yahoo to arcade
Default

ok deci hai sa il optimizam putin :P

in primul rand ceea ce ai pus tu nu poate fi folosit decat de pe canal. parerea mea e ca cel mai bine ar fi sa facem asa:
Code:
if {[string match [lindex $arg 0] "*#*"]} {
	set chan [lindex $arg 0]
	set opt1 [lindex $arg 1]
	set opt2 [lindex arg 2]
} else {
	set opt1 [lindex $arg 0]
	set opt2 [lindex $arg 1]
}
acum, sa vedem cum aranjam frumos setarile alea ale tale :P
Code:
if { (![regexp {^(enforcebans|dynamicbans|userbans|autoop|autohalfop|bitch|protectops|anticolour)$} $opt1] || ![regexp {^(on|off)$} $opt2]} { puthelp "PRIVMSG $chan :USAGE: !chansetup [#chan] <enforcebans|dynamicbans|userbans|autoop|autohalfop|bitch|protectops|anticolour> <on|off>" ; return}
switch $opt2 {
	on { channel set $chan +${opt1} } 
	off { channel set $chan -${opt1} } 
	}
puthelp "NOTICE $nick :SET $opt1 $opt2 on $chan"
}
eu zic ca e mult mai simplu decat ce aveai tu

si pt chanhelp:
Code:
if {[channel get $chan enforcebans]} {set en "ON"} else {set en "OFF"}
if {[channel get $chan dynamicbans]} {set dy "ON"} else {set dy "OFF"}
if {[channel get $chan userbans]} {set eb "ON"} else {set ub "OFF"}
if {[channel get $chan autoop]} {set ao "ON"} else {set ao "OFF"}
if {[channel get $chan autohalfop]} {set ah "ON"} else {set ah "OFF"}
if {[channel get $chan bitch]} {set bi "ON"} else {set bi "OFF"}
if {[channel get $chan protectops]} {set po "ON"} else {set po "OFF"}
if {[channel get $chan anticolour]} {set sl "ON"} else {set sl "OFF"}
puthelp "NOTICE $nick :Setarile pentru canal $chan: enforcebans:$en dynamicbans:$dy userbans:$ub autoop:$ao autohalfop:$ah bitch:$bi protectops:$po anticuloare:$sl"
}
deci in final va arata cam asa:
Code:
bind pub N !chansetup pub:chansetupp
bind pub N !chanhelp pub:chanhelp

proc pub:chansetupp {nick uhost hand chan arg} {

if {[string match [lindex $arg 0] "*#*"]} {
	set chan [lindex $arg 0]
	set opt1 [lindex $arg 1]
	set opt2 [lindex arg 2]
} else {
	set opt1 [lindex $arg 0]
	set opt2 [lindex $arg 1]
}

if { (![regexp {^(enforcebans|dynamicbans|userbans|autoop|autohalfop|bitch|protectops|anticolour)$} $opt1] || ![regexp {^(on|off)$} $opt2]} { puthelp "PRIVMSG $chan :USAGE: !chansetup [#chan] <enforcebans|dynamicbans|userbans|autoop|autohalfop|bitch|protectops|anticolour> <on|off>" ; return}
switch $opt2 {
	on { channel set $chan +${opt1} } 
	off { channel set $chan -${opt1} } 
	}
puthelp "NOTICE $nick :SET $opt1 $opt2 on $chan"
}

proc pub:chanhelp {nick uhost hand chan arg} {


if {[channel get $chan enforcebans]} {set en "ON"} else {set en "OFF"}
if {[channel get $chan dynamicbans]} {set dy "ON"} else {set dy "OFF"}
if {[channel get $chan userbans]} {set eb "ON"} else {set ub "OFF"}
if {[channel get $chan autoop]} {set ao "ON"} else {set ao "OFF"}
if {[channel get $chan autohalfop]} {set ah "ON"} else {set ah "OFF"}
if {[channel get $chan bitch]} {set bi "ON"} else {set bi "OFF"}
if {[channel get $chan protectops]} {set po "ON"} else {set po "OFF"}
if {[channel get $chan anticolour]} {set sl "ON"} else {set sl "OFF"}
puthelp "NOTICE $nick :Setarile pentru canal $chan: enforcebans:$en dynamicbans:$dy userbans:$ub autoop:$ao autohalfop:$ah bitch:$bi protectops:$po anticuloare:$sl"
}
sper ca nu am gresit nimic, si daca nu am gresit ar trebui sa mearga perfect, si arata mult mai bine, si e si mai citibil, chit ca nu prea imi place mie cum arata chanhelp, dar in fine l-am facut sa fie exact cum il aveai tu :P
__________________
Fuck oFF!
arcade is offline   Reply With Quote