Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

News Snippet

Recommended Posts

  • Administrators

Instructions: Copy/Paste in remote (ALT+R).
News commands;

!add-news [Adds a new news.]
!del-news [Delete news.]
!clear-news [Delete all news / clears the news list.]
!news [Shows you the news list.]

 

on *:load:{ set %news.num 0 | set %news.channel $$?="Enter your news channel" }
on @*:text:*:%news.channel:{
  if ($nick isop #) {
    if ($1 == !add-news) {
      if ($2) { inc %news.num | .write news.txt $2- | notice $nick Done, add $2- to news list. }
      else { notice $nick Syntax error: Usage: !add-news Line. }
    }
    if ($1 == !del-news) {
      if ($2) {
        if ($2 !isnum) { .notice $nick Syntax error: Usage: !del-news <LINE> }
        elseif ($2 <= %news.num) { .notice $nick Deleted $read(news.txt,$2) from news list. | .write $+(-,d,l,$2) news.txt | dec %news.num }
        else { .notice $nick Line $2 dowsnt exist. }
      }
      else { .notice $nick Syntax error: Usage: !del-news Line }
    }
    if ($1 == !news) { run-news %news.channel }
    if ($1 == !clear-news) { .write -c news.txt | .notice $nick Done, Remove %news.num lines from news list. | set %news.num 0 }
    if ($1 == !commands) { .msg %news.channel (- News-Commands: !news , !add-news , !del-news , !clear-news -) }
  }
}
alias run-news {
  if (%news.num != 0) {
    .mode $1 +m
    .play -a msg $1 news.txt 1
    .timerENEWS $calc(%news.num +2) 1 .mode $1 -m
  }
  else { msg $1 There is no news for now. }
}

 

xelent

Link to comment
Share on other sites



×
×
  • Create New...