Some Setup Required (You should know what your doing...)
If you type !a it sets in the announce, to view announcements type !announce and it supports multiple announcements...to delete announcements i didnt include because it's buggy...if you know what your doing you shouldn't have a problom...
;Announce Script Created By Lavamike
on *:TEXT:!announce*:#: { /msg $chan 4The Announcements Are:3 $read(A.txt)}
on <USERLEVEL>:TEXT:*:#: {
if ($1 == !a) {
if (!$2) { notice $nick Usage: !a <Item> }
var %i = $addtok($read(A.txt), $2- $20,32)
/write A.txt %i 4|-|3
notice $nick " $+ $2- $+ " has been stored in the announcements. To view the announcements please type !announce.
}
}
or you can just do it this way but it\'s up too you...
on *:text:*:#: {
if (($nick isop #) || ($nick ishop #)) {
if (($1 == !announce) && (!$2)) {
msg $chan Please select a announcement number 1 - $lines(A.txt)
}
elseif (($1 == !announce) && ($read(A.txt, n) == $null)) {
msg $chan There Are No Announcement\'s At This Time.
}
elseif (($1 == !announce) && ($read(A.txt, n, $2) == $null)) {
msg $chan Sorry $nick But That Announcement Number Does Not Exist. Please Pick A Announcement Number (1 - $lines(A.txt) $+ )
}
elseif ($1 == !announce) {
msg $chan Reading Announcement $2 of $lines(A.txt) $+ : $read(A.txt, n, $2)
}
elseif ($1 == !a) {
write A.txt $2-
msg $chan Announcement: $2- Has Been Added! As Announcement Number $lines(A.txt)
}
elseif ($1 == !dela) {
msg $chan Deleteing Announcement Number $2 $+ : Of $read(A.txt, n, $2)
write -dl $+ $2 A.txt
}
elseif (($1 == !counta) && ($lines(A.txt) == 0)) {
msg $chan There Are No Announcement\'s To Count.
}
elseif ($1 == !counta) {
msg $chan $nick I Have A Total Of $lines(A.txt) Announcement\'s So Far.
}
}
}
This is moderate. There are a few errors I found though.
var %x = 1
while (%x <= $lines(A.txt)) {
; This line returns if the total number of lines in a text is more than 1
.timer 1 2 msg $chan $read(A.txt,%x) | inc %x
; This line broadcasts to the channel the announcements with a timer. This is to prevent flooding. The $read(A.txt,%x) reads a specific line in the text. The %x varaible will add 1 to its current number each time. And until the events ends, it will keep on msging the channel with the %x line in the txt file.
}
Remove the ; comments if you end up using the code. I just wanted to explain what everything does. ;)
There needs to be a space between the $read and the closing bracket.
Other then that, nice idea. I recommend you add a feature to remove a specific line of text from the txt file.