Imi cer scuze ca intreb despre mai multe problme intr-un singur thread !
Pentru inceput as vrea sa ma ajutati sa fac un TCL , cand iese o persoara de pe un canal sa ii dea PRIVAT si sa ii spuna "Te mai asteptam pe la noi !" sau ceva in genu.O sa postez mai jos un TCL care da PRIVAT cand intri pe canal , am incercat sa imi modific acesta dar nu am reusit si as vrea sa il fac in genul la cel cu JOIN deoarece imi place modul cum se seteaza mesajul "!welcome set <msg>" as vrea sa fac la cel cu PART "!leave set <msg>"
Code:
if {![info exists welcomefile]} {
set welcomefile "welcomefile"
set welcomesetfile "welcomeset"
}
bind pub - !welcome pub_welcome
bind join - *!*@* set_welcome
bind msg - welcome msg_welcome
bind dcc - welcome dcc_welcome
proc set_welcome {nick uhost hand chan} {
global random_welcome setwelcome botnick
if {$botnick != $nick} {
if {[info exists setwelcome([string tolower $chan])] && [lindex $setwelcome([string tolower $chan]) 0] != ""} {
set i $setwelcome([string tolower $chan])
puthelp "PRIVMSG $nick :$i"
} {
foreach i [array names random_welcome] {
if {[lsearch -exact [string tolower [channels]] [string tolower $i]] != -1} {
if {[lindex $random_welcome([string tolower $i]) 0] != ""} {
set welcome [lindex $random_welcome($i) [rand [llength $random_welcome($i)]]]
if {$chan == $i} {
puthelp "PRIVMSG $nick :$welcome"
}
}
} {
unset random_welcome($i)
}
}
}
}
}
proc welcome_show_pub {nick uhost hand channel arg} {
global random_welcome setwelcome botnick
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
putserv "PRIVMSG $nick :welcomes for \002$channel\002:"
if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
set i $setwelcome([string tolower $channel])
putserv "PRIVMSG $nick :\002welcome Set to:\002 $i"
putserv "PRIVMSG $nick :Use welcome SET $channel OFF if you want to turn it off."
putserv "PRIVMSG $nick :\002Random welcomes:\002"
}
set ctr 0
if {[info exists random_welcome([string tolower $channel])] && [lindex $random_welcome([string tolower $channel]) 0] != ""} {
foreach i $random_welcome([string tolower $channel]) {
incr ctr 1
putserv "PRIVMSG $nick :\002${ctr}.\002 $i"
}
} {
putserv "PRIVMSG $nick :No welcomes set."
}
putserv "PRIVMSG $nick :---- \002end\002 ----"
putserv "PRIVMSG $nick :Type \002/msg $botnick welcome HELP\002 for help."
return 1
}
proc welcome_show {nick uhost hand arg} {
global random_welcome setwelcome botnick
set channel [lindex $arg 0]
if {$channel == ""} {
putserv "PRIVMSG $nick :Usage: welcome <channel>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putserv "PRIVMSG $nick :I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
putserv "PRIVMSG $nick :welcomes for \002$channel\002:"
if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
set i $setwelcome([string tolower $channel])
putserv "PRIVMSG $nick :\002welcome Set to:\002 $i"
putserv "PRIVMSG $nick :Use welcome SET $channel OFF if you want to turn it off."
putserv "PRIVMSG $nick :\002Random welcomes:\002"
}
set ctr 0
if {[info exists random_welcome([string tolower $channel])] && [lindex $random_welcome([string tolower $channel]) 0] != ""} {
foreach i $random_welcome([string tolower $channel]) {
incr ctr 1
putserv "PRIVMSG $nick :\002${ctr}.\002 $i"
}
} {
putserv "PRIVMSG $nick :No welcomes set."
}
putserv "PRIVMSG $nick :---- \002end\002 ----"
putserv "PRIVMSG $nick :Type \002/msg $botnick welcome HELP\002 for help."
return 1
}
proc welcome_show_dcc {hand idx arg} {
global random_welcome setwelcome botnick
set channel [lindex $arg 0]
if {$channel == ""} {
putidx $idx "Usage: welcome <channel>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putidx $idx "I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putidx $idx "Sorry, you are not authorized to use this command."
return 0
}
putidx $idx "welcomes for \002$channel\002:"
if {[info exists setwelcome([string tolower $channel])] && [lindex $setwelcome([string tolower $channel]) 0] != ""} {
set i $setwelcome([string tolower $channel])
putidx $idx "\002welcome Set to:\002 $i"
putidx $idx "Use welcome SET $channel OFF if you want to turn it off."
putidx $idx "\002Random welcomes:\002"
}
set ctr 0
if {[info exists random_welcome([string tolower $channel])] && [lindex $random_welcome([string tolower $channel]) 0] != ""} {
foreach i $random_welcome([string tolower $channel]) {
incr ctr 1
putidx $idx "\002${ctr}.\002 $i"
}
} {
putidx $idx "No welcomes set."
}
putidx $idx "---- \002end\002 ----"
putidx $idx "Type \002.welcome HELP\002 for help."
return 1
}
proc welcome_set_pub {nick uhost hand channel arg} {
global setwelcome
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {[string tolower [lindex $arg 1]] != "off"} {
putserv "PRIVMSG $nick :welcome set to:"
putserv "PRIVMSG $nick :[lrange $arg 1 end]"
set setwelcome([string tolower $channel]) [lrange $arg 1 end]
} {
putserv "PRIVMSG $nick :welcome set randomize on $channel"
set setwelcome([string tolower $channel]) [lreplace $setwelcome([string tolower $channel]) 0 0]
}
putlog "Writing welcomes file..."
welcome_write
return 1
}
proc welcome_set {nick uhost hand arg} {
global setwelcome
set channel [lindex $arg 1]
if {$channel == ""} {
putserv "PRIVMSG $nick :Usage: welcome SET <channel> <welcome>"
putserv "PRIVMSG $nick :Or: welcome SET <channel> OFF"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putserv "PRIVMSG $nick :I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {[string tolower [lindex $arg 2]] != "off"} {
putserv "PRIVMSG $nick :welcome set to:"
putserv "PRIVMSG $nick :[lrange $arg 1 end]"
set setwelcome([string tolower $channel]) [lrange $arg 2 end]
} {
putserv "PRIVMSG $nick :welcome set randomize on $channel"
set setwelcome([string tolower $channel]) [lreplace $setwelcome([string tolower $channel]) 0 0]
}
putlog "Writing welcomes file..."
welcome_write
return 1
}
proc welcome_set_dcc {hand idx arg} {
global setwelcome
set channel [lindex $arg 1]
if {$channel == ""} {
putidx $idx "Usage: welcome SET <channel> <welcome>"
putidx $idx "Or: welcome SET <channel> OFF"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putidx $idx "I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putidx $idx "Sorry, you are not authorized to use this command."
return 0
}
if {[string tolower [lindex $arg 2]] != "off"} {
putidx $idx "welcome set to:"
putidx $idx "[lrange $arg 1 end]"
set setwelcome([string tolower $channel]) [lrange $arg 2 end]
} {
putidx $idx "welcome set randomize on $channel"
set setwelcome([string tolower $channel]) [lreplace $setwelcome([string tolower $channel]) 0 0]
}
putlog "Writing welcomes file..."
welcome_write
return 1
}
proc welcome_add_pub {nick uhost hand channel arg} {
global random_welcome
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
putserv "PRIVMSG $nick :welcome list has been updated, thanks."
putserv "PRIVMSG $nick :$channel [lrange $arg 1 end]"
lappend random_welcome([string tolower $channel]) [lrange $arg 1 end]
putlog "Writing welcomes file..."
welcome_write
return 1
}
proc welcome_add {nick uhost hand arg} {
global random_welcome
set channel [lindex $arg 1]
if {$channel == ""} {
putserv "PRIVMSG $nick :Usage: welcome ADD <channel> <new welcome>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putserv "PRIVMSG $nick :I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
putserv "PRIVMSG $nick :welcome list has been updated, thanks."
putserv "PRIVMSG $nick :[lrange $arg 1 end]"
lappend random_welcome([string tolower $channel]) [lrange $arg 2 end]
putlog "Writing welcomes file..."
welcome_write
return 1
}
proc welcome_add_dcc {hand idx arg} {
global random_welcome
set channel [lindex $arg 1]
if {$channel == ""} {
putidx $idx "Usage: welcome ADD <channel> <new welcome>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putidx $idx "I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putidx $idx "Sorry, you are not authorized to use this command."
return 0
}
putidx $idx "welcome list has been updated, thanks."
putidx $idx "[lrange $arg 1 end]"
lappend random_welcome([string tolower $channel]) [lrange $arg 2 end]
putlog "Writing welcomes file..."
welcome_write
return 1
}
proc welcome_erase_pub {nick uhost hand channel arg} {
global random_welcome
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {![info exists random_welcome([string tolower $channel])]} {
putserv "PRIVMSG $nick :No welcomes set."
return 0
}
set i [expr [lindex $arg 1] - 1]
if {$i >=0 && [lindex $random_welcome([string tolower $channel]) $i] != ""} {
putserv "PRIVMSG $nick :Entry [lindex $arg 1] erased."
putserv "PRIVMSG $nick :$channel [lindex $random_welcome([string tolower $channel]) $i]"
set random_welcome([string tolower $channel]) [lreplace $random_welcome([string tolower $channel]) $i $i]
putlog "Writing welcomes file..."
welcome_write
return 1
} {
putserv "PRIVMSG $nick :That number is out of range!"
return 0
}
}
proc welcome_erase {nick uhost hand arg} {
global random_welcome
set channel [lindex $arg 1]
if {$channel == ""} {
putserv "PRIVMSG $nick :Usage: welcome DEL <channel> <welcome#>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putserv "PRIVMSG $nick :I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
return 0
}
if {![info exists random_welcome([string tolower $channel])]} {
putserv "PRIVMSG $nick :No welcomes set."
return 0
}
set i [expr [lindex $arg 2] - 1]
if {$i >=0 && [lindex $random_welcome([string tolower $channel]) $i] != ""} {
putserv "PRIVMSG $nick :Entry [lindex $arg 2] erased."
putserv "PRIVMSG $nick :$channel [lindex $random_welcome([string tolower $channel]) $i]"
set random_welcome([string tolower $channel]) [lreplace $random_welcome([string tolower $channel]) $i $i]
putlog "Writing welcomes file..."
welcome_write
return 1
} {
putserv "PRIVMSG $nick :That number is out of range!"
return 0
}
}
proc welcome_erase_dcc {hand idx arg} {
global random_welcome
set channel [lindex $arg 1]
if {$channel == ""} {
putidx $idx "Usage: welcome DEL <channel> <welcome#>"
return 0
}
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] == -1} {
putidx $idx "I am not on ${channel}."
return 0
}
if {![matchattr $hand m|m $channel]} {
putidx $idx "Sorry, you are not authorized to use this command."
return 0
}
if {![info exists random_welcome([string tolower $channel])]} {
putidx $idx "No welcomes set."
return 0
}
set i [expr [lindex $arg 2] - 1]
if {$i >=0 && [lindex $random_welcome([string tolower $channel]) $i] != ""} {
putidx $idx "Entry [lindex $arg 2] erased."
putidx $idx "$channel [lindex $random_welcome([string tolower $channel]) $i]"
set random_welcome([string tolower $channel]) [lreplace $random_welcome([string tolower $channel]) $i $i]
putlog "Writing welcomes file..."
welcome_write
return 1
} {
putidx $idx "That number is out of range!"
return 0
}
}
proc welcome_help_pub {nick uhost hand channel arg} {
putserv "PRIVMSG $nick :Usage: welcome - show welcomes"
putserv "PRIVMSG $nick : welcome ADD <new welcome> - add welcome entry"
putserv "PRIVMSG $nick : welcome DEL <welcome#> - delete welcome entry"
putserv "PRIVMSG $nick : welcome SET <welcome> - set a welcome for a channel (no randomize)"
putserv "PRIVMSG $nick : welcome SET OFF - set randomize on"
return 1
}
proc welcome_help {nick uhost hand arg} {
putserv "PRIVMSG $nick :Usage: welcome - show welcomes"
putserv "PRIVMSG $nick : welcome ADD <channel> <new welcome> - add welcome entry"
putserv "PRIVMSG $nick : welcome DEL <channel> <welcome#> - delete welcome entry"
putserv "PRIVMSG $nick : welcome SET <channel> <welcome> - set a welcome for a channel (no randomize)"
putserv "PRIVMSG $nick : welcome SET <channel> OFF - set randomize on"
return 1
}
proc welcome_help_dcc {hand idx arg} {
putidx $idx "Usage: welcome - show welcomes"
putidx $idx " welcome ADD <channel> <new welcome> - add welcome entry"
putidx $idx " welcome DEL <channel> <welcome#> - delete welcome entry"
putidx $idx " welcome SET <channel> <welcome> - set a welcome for a channel (no randomize)"
putidx $idx " welcome SET <channel> OFF - set randomize on"
return 1
}
proc welcome_load {} {
global random_welcome setwelcome welcomefile welcomesetfile
if {[info exists random_welcome]} {unset random_welcome}
if {[catch {set fd [open $welcomefile r]}] != 0} {return 0}
while {![eof $fd]} {
set inp [gets $fd]
if {[eof $fd]} {break}
if {[string trim $inp " "] == ""} {continue}
set channel [lindex $inp 0]
lappend random_welcome([string tolower $channel]) [lrange $inp 1 end]
}
close $fd
if {[info exists setwelcome]} {unset setwelcome}
if {[catch {set fd [open $welcomesetfile r]}] != 0} {return 0}
while {![eof $fd]} {
set inp [gets $fd]
if {[eof $fd]} {break}
if {[string trim $inp " "] == ""} {continue}
set channel [lindex $inp 0]
lappend setwelcome([string tolower $channel]) [lrange $inp 1 end]
}
close $fd
return 1
}
proc welcome_write {} {
global welcomefile random_welcome setwelcome welcomesetfile
set fd [open $welcomefile w]
foreach channel [array names random_welcome] {
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
if {[lindex $random_welcome([string tolower $channel]) 0] != ""} {
foreach i $random_welcome([string tolower $channel]) {
puts $fd "$channel $i"
}
}
}
}
close $fd
set fd [open $welcomesetfile w]
foreach channel [array names setwelcome] {
if {[lsearch -exact [string tolower [channels]] [string tolower $channel]] != -1} {
if {[lindex $setwelcome([string tolower $channel]) 0] != ""} {
set i $setwelcome([string tolower $channel])
puts $fd "$channel $i"
}
}
}
close $fd
return 1
}
proc msg_welcome {nick uhost hand arg} {
switch [string tolower [lindex $arg 0]] {
"add" {set r [welcome_add $nick $uhost $hand $arg]}
"del" {set r [welcome_erase $nick $uhost $hand $arg]}
"delete" {set r [welcome_erase $nick $uhost $hand $arg]}
"set" {set r [welcome_set $nick $uhost $hand $arg]}
"help" {set r [welcome_help $nick $uhost $hand $arg]}
default {set r [welcome_show $nick $uhost $hand $arg]}
}
return $r
}
proc pub_welcome {nick uhost hand channel arg} {
switch [string tolower [lindex $arg 0]] {
"add" {set r [welcome_add_pub $nick $uhost $hand $channel $arg]}
"del" {set r [welcome_erase_pub $nick $uhost $hand $channel $arg]}
"delete" {set r [welcome_erase_pub $nick $uhost $hand $channel $arg]}
"set" {set r [welcome_set_pub $nick $uhost $hand $channel $arg]}
"help" {set r [welcome_help_pub $nick $uhost $hand $channel $arg]}
default {set r [welcome_show_pub $nick $uhost $hand $channel $arg]}
}
return $r
}
proc dcc_welcome {hand idx arg} {
switch [string tolower [lindex $arg 0]] {
"add" {set r [welcome_add_dcc $hand $idx $arg]}
"del" {set r [welcome_erase_dcc $hand $idx $arg]}
"delete" {set r [welcome_erase_dcc $hand $idx $arg]}
"set" {set r [welcome_set_dcc $hand $idx $arg]}
"help" {set r [welcome_help_dcc $hand $idx $arg]}
default {set r [welcome_show_dcc $hand $idx $arg]}
}
return $r
}
welcome_load
if {![info exists set_welcome_running] && ![info exists random_welcome] && ![info exists setwelcome]} {
set set_welcome_running 1
}Am incercat sa inlocuiesc JOIN cu PART si WELCOME cu LEAVE , dar imi da urma
Am incercat sa inlocuiesc JOIN cu PART si WELCOME cu LEAVE , dar imi da urmatoarea eroare:
Code:
Tcl error [set_leave]: wrong # args: should be "set_leave nick uhost hand chan"
Sursa TCL cu Welcome este
MultiGreet facut de Creative1 !
As vrea sa stiu si eu de unde pot face rost de TCL cu Ban-Reason si Kick-Reason.Daca se poate as vrea sa se setez astfel:
Ban-Reason: !chanset #canal ban-reason <msg>
Kick-Reason: !chanset #canal kick-reason <msg>
P.S: Sorry Universalia daca am gresit cu ceva , dar nu a fost cu intentie

! Ms de intelegere ! Bafta !