Hi All, need help from this script (credit to the owner), I've modified the script based on what I wanted. i just want the list of account users to be in one line.
as of the moment it shows like this
and i want like this;
and for the timer channel show; it will be the same
Thank you guys in advance.
as of the moment it shows like this
Code:
<mabrook> !gc list
<botname> The GCASH USers list for #Channel: 1. John Doe +639564874562
<botname> The GCASH USers list for #Channel: 2. Jane Doe +639564874444
Code:
<mabrook> !gc list
<botname> The GCASH USers list for #Channel: 1. John Doe +639564874562 2. Jane Doe +639564874444
and for the timer channel show; it will be the same
Code:
<botname>[1] John Doe +639564874562 [2] Jane Doe +639564874444
tcl
#Here you can set the start char of the command
set gcash(char) "!"
#Here you can set what flags can use the command
set gcash(flags) "nm|MNnA"
#Here you can set the time interval of listed gcash users
set gcash(time) "20"
#If you want the listed gcash users to be done by the PRIVMSG $chan method #set here "0" or if you want by the /me (action) set here "1"
set gcash(how) "0"
#######################################################################
# GCASH USERS
#######################################################################
bind pub $gcash(flags) $gcash(char)gc anounce:process
setudef flag announce
if {![info exists announce:timer_running]} {
timer $gcash(time) announce:timer
set announce:timer_running 1
}
proc anounce:process {nick host hand chan arg} {
global gcash
set flag "announce"
set dir "logs/gc($chan).txt"
set who [lindex [split $arg] 0]
set message [join [lrange [split $arg] 1 end]]
set number [lindex [split $arg] 1]
if {[channel get $chan announce]} { set status "on" } else { set status "off" }
if {$who == ""} { puthelp "NOTICE $nick :Please use $gcash(char)gc <on> | <off> | <add> <mesaj> | <list> | <del> <number>"
return 0
}
if {([regexp -nocase -- {(#[0-9]+|on|off|add|list|del)} $who tmp a]) && (![regexp -nocase -- {\S#} $who])} {
switch $a {
on {
channel set $chan +$flag
puthelp "NOTICE $nick :I activated the GCASH system. To add an GCASH User Account just type $gcash(char)gc add <your name + mobile number>."
}
off {
channel set $chan -$flag
puthelp "NOTICE $nick :I deactivated the GCASH system."
}
add {
if {$message == ""} { puthelp "NOTICE $nick :Please use $gcash(char)gc add <your name + mobile number>"
return 0
}
if {$status == "off" } { puthelp "NOTICE $nick :First you have to activate the GCASH system by typing $gcash(char)gc on"
return 0
}
if {[file exists $dir] == 0} {
set file [open $dir a]
close $file
}
set file [open $dir a]
puts $file $message
close $file
puthelp "NOTICE $nick : GCASH Account Added"
puthelp "NOTICE $nick :$message"
}
list {
if {$status == "off" } { puthelp "NOTICE $nick :First you have to activate the GCASH system by typing $gcash(char)gc on"
return 0
}
if {[file exists $dir] == 0} {
set file [open $dir a]
close $file
}
set dir "logs/gc($chan).txt"
set file [open $dir "r"]
set w [read -nonewline $file]
close $file
set data [split $w "\n"]
set i 0
if {$data == ""} { puthelp "NOTICE $nick :There are no GCASH Account Added"
return 0
}
foreach account $data {
set i [expr $i +1]
puthelp "NOTICE $nick :The GCASH USers list for $chan: $i. $account"
}
}
del {
if {$message == ""} { puthelp "NOTICE $nick :Please use $gcash(char)gc del <number>. To list the GCASH Account type $gcash(char)gc list"
return 0
}
if {$status == "off" } { puthelp "NOTICE $nick :First you have to activate the GCASH system by typing $gcash(char)gc on"
return 0
}
set dir "logs/gc($chan).txt"
if {[file exists $dir] == 0} {
set file [open $dir a]
close $file
}
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
set lines [split $data "\n"]
set i [expr $number - 1]
set delete [lreplace $lines $i $i]
set files [open $dir "w"]
puts $files [join $delete "\n"]
close $files
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
if {$data == ""} {
set files [open $dir "w"]
close $files
}
puthelp "NOTICE $nick :Deleted the GCASH listed number :$number for $chan."
puthelp "NOTICE $nick :Please check if i am right by typing $gcash(char)gc list"
}
}
}
}
proc announce:timer {} {
global gcash count
foreach chan [channels] {
set dir "logs/gc($chan).txt"
if {[channel get $chan announce]} {
if {![info exists count(gc:$chan)]} {
set count(gc:$chan) 0
}
if {[file exists $dir] == 0} {
set file [open $dir a]
close $file
}
set file [open $dir "r"]
set data [read -nonewline $file]
close $file
set lines [split $data "\n"]
set line [lindex $lines $count(gc:$chan)]
incr count(gc:$chan)
if {$line == ""} {
unset count(gc:$chan)
}
if {$gcash(how) == "1"} {
puthelp "PRIVMSG $chan :\001ACTION $line\001"
} else {
puthelp "PRIVMSG $chan :$line"
}
}
}
timer $gcash(time) announce:timer
return 1
}
Thank you guys in advance.