on *:TEXT:.quote*:#:{
if !$read(quotes.txt, n, 1) { .msg $chan zQuote currently does not have any quotes. Maybe you should add some. }
else {
if !$2 { .msg $chan zQuote Random Quote: $read(quotes.txt, n) }
else {
if $2 isnum {
if !$read(quotes.txt, n, $2) { .msg $chan zQuote number $2 does not exist! There are only $lines(quotes.txt) quotes in the database. }
else {
.msg $chan zQuote Number $2 $+ : $read(quotes.txt, n, $2)
}
}
else {
set %s * $+ $2- $+ *
set %r $null
set %i 1
while %i <= $lines(quotes.txt) {
if %s iswm $read(quotes.txt, n, %i) {
%r = %r $+ $chr(32) $+ %i
}
inc %i
}
if $numtok(%r,32) == 0 { .msg $chan There are not any quotes found using those words. Try diffrent words for your search. | halt }
set %q $gettok(%r,$rand(1,$numtok(%r,32)),32)
.msg $chan zQuote Random quote for %s $+ : $read(quotes.txt, n, %q)
}
}
}
}
on *:TEXT:.findquote*:#:{
set %s * $+ $2- $+ *
set %r $null
set %i 1
while %i <= $lines(quotes.txt) {
if %s iswm $read(quotes.txt, n, %i) {
%r = %r $+ $chr(32) $+ %i
}
inc %i
}
if $numtok(%r,32) == 0 { .msg $chan There are not any quotes found using those words. Try diffrent words for your search. | halt }
.msg $chan zQuote Quotes found for %s $+ : %r
}
on *:TEXT:.lastquote:#:{ .msg $chan zQuote Last Quote: $read(quotes.txt, n, $lines(quotes.txt)) }
on 3:TEXT:.addquote*:#:{
.write quotes.txt $2-
.msg $chan $nick $+ , The quote has been added!
}
on 3:TEXT:.delquote*:#:{
.write -dl $+ $2 quotes.txt
.msg $chan $nick $+ , The quote has been deleted!
}
More will be added sometime, commit all you like.