| View previous topic :: View next topic |
| Author |
Message |
mrdr Halfop

Joined: 16 Jun 2005 Posts: 42 Location: Lithuania / Vilnius / Underground
|
Posted: Sun Nov 27, 2005 5:27 pm Post subject: dumbasses tcl add/list/del |
|
|
Hi,
I have dumbasses.tcl but it can only add ant list dumbasses.
Can anyone make that tcl could delete nick from the file. If nick isn't in the dumbasses file bot sents msg that he is not dumbass.
| Code: | set quoteitpubprefix "!"
set quoteitfile "quoteit.data"
# 0 = Channel
# 1 = Notice
set quoteitvianotice "1"
if { ![info exists toolbox_loaded] } { source scripts/alltools.tcl }
bind pub - [string trim $quoteitpubprefix]dumbasses quoteit:pub:dumbasses
bind pub G|G [string trim $quoteitpubprefix]dumbass quoteit:pub:dumbass
proc quoteit:pub:dumbass {nick uhost hand chan arg} {
global quoteitfile quoteitvianotice
set quotes ""
if { [file exists $quoteitfile] } { set file [open $quoteitfile r]
} else {
if { $quoteitvianotice == 0 } { putmsg $chan "$quoteitfile does not exist. You'll need to add quotes to the database first by typing \002!dumbass <nick>\002" }
if { $quoteitvianotice == 1 } { putnotc $nick "$quoteitfile does not exist. You'll need to add quotes to the database first by typing \002!dumbass <nick>\002" }
return 0
}
while { ![eof $file] } {
set quote [gets $file]
if { $quote != "" } {
set quotes [linsert $quotes end $quote]
}
}
close $file
set row [rand [llength $quotes]]
set quote [list $quotes]
if { $quote != "" } {
if { $quoteitvianotice == 0 } {
putmsg $chan "Dumbasses: $quote"
}
if { $quoteitvianotice == 1 } {
putnotc $nick "Dumbasses: $quote"
}
return 1
}
}
proc quoteit:pub:dumbasses {nick uhost hand chan arg} {
global quoteitfile
if { $arg == "" } {
putnotc $nick "Usage: !dumbass <nick>"
return 0
}
set file [open $quoteitfile a]
puts $file "$arg"
close $file
putmsg $chan "{$arg dumbassed}"
return 1
}
putlog "*** dumbasses.tcl loaded"
|
_________________ IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Wed Nov 30, 2005 12:34 am Post subject: |
|
|
talk about rightly named scripts  _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
|