Advertisement
illpastethat

Quotes Script Revised Basic Compatibility leafghoul

Jan 14th, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 13.88 KB | None | 0 0
  1. on *:TEXT:qowner:?: {
  2.   if ($readini(quotes.ini,owner,owner) == $null) {
  3.     query $nick You are now the owner of the quotes system. Type .qhelp (in a channel) for commands.
  4.     enable #quotes
  5.     writeini quotes.ini owner owner $nick
  6.   }  
  7.   else {
  8.     msg $nick A quote owner is already selected $+([,$readini(quotes.ini,owner,owner),])
  9.   }
  10. }
  11.  
  12. #quotes off
  13. on *:text:*:#: {
  14.   tokenize 32 $strip($1-)
  15.   if ($nick isin $readini(quotes.ini,bans,bans)) {
  16.     if ($($+(%,quoteabuse,$nick),2) == true) {
  17.       halt
  18.     }
  19.     else {
  20.       set -u5 $+(%,quoteabuse,$nick) true
  21.       msg $chan $qstyleb(You are banned from quotes. Please see a quote moderator/owner to resolve this problem.)
  22.       halt
  23.     }
  24.   }
  25.   if (($1 == .quote) || ($1 == .qread) || ($1 == .quoteread) || ($1 == .readquote) || ($1 == .qrand)) {
  26.     if (($2 == $null) || ($2 == random) || ($1 == .qrand)) {
  27.       if (!$readini(quotes.ini,stats,all)) {
  28.         msg $chan $qstyleb(There are no quotes (yet).  Add one with .qadd <quote>)
  29.       }
  30.       else {
  31.         :RandomTop
  32.         var %quoterandom $rand(1,$lines(quotes.txt))
  33.         if (*-* iswm $read(Quotes.txt,%QuoteRandom)) {
  34.           msg $chan $qstyleb(Quote $+($chr(35),$readn) added by $gettok($read(quotes.txt,$readn),2,45) $timedifference($gettok($read(quotes.txt,$readn),1,45)) ago.)
  35.           msg $chan $qstyle($gettok($read(quotes.txt,n,$readn),3-,45))
  36.         }
  37.         elseif (*-* !iswm $read(Quotes.txt,%QuoteRandom)) {
  38.           goto RandomTop
  39.         }
  40.       }
  41.     }
  42.     elseif (($2 !isnum) || ($2 == 0)) {
  43.       msg $chan $qstyle(To read a quote type .qread <quoteNumber> -- If you meant to add a quote type .qadd <quote> -- For help type .qhelp)
  44.     }
  45.     elseif ($2 !isnum 1- $+ $lines(quotes.txt)) {
  46.       msg $chan $qstyle(Sorry, but there are only $lines(quotes.txt) quotes in database! Add one by typing .qadd <quote>)
  47.     }
  48.     else {
  49.       if ($read(quotes.txt,$2) == $null) {
  50.         msg $chan $qstyleb(Quote $+($chr(35),$2) no longer exists (it has been deleted).)
  51.       }
  52.       else {
  53.         msg $chan $qstyleb(Quote $+($chr(35),$2) added by $gettok($read(quotes.txt,$2),2,45) $timedifference($gettok($read(quotes.txt,$2),1,45)) ago.)
  54.         msg $chan $qstyle($gettok($read(quotes.txt,n,$2),3-,45))
  55.       }
  56.     }
  57.   }
  58.   if (($1 == .qsearch) || ($1 == .searchquote) || ($1 == .quotesearch)) {
  59.     if ($2 == $null) {
  60.       msg $chan $qstyle(Type .qsearch <search term / author> to search the quote database.)
  61.     }
  62.     else {
  63.       if (!$3) {
  64.         var %asearch
  65.         var %x 1
  66.         while (%x <= $lines(quotes.txt)) {
  67.           if ($2 == $gettok($read(Quotes.txt,n,%x),2,45)) {
  68.             var %asearch $addtok(%asearch,%x,44)
  69.           }
  70.           inc %x
  71.         }
  72.         if (%asearch != $null) {
  73.           if (*,* !iswm %asearch) {
  74.             msg $chan $qstyleb(Quote $+($chr(35),%asearch) added by4 $gettok($read(quotes.txt,%asearch),2,45) 10 $+ $timedifference($gettok($read(quotes.txt,%asearch),1,45)) ago.)
  75.             msg $chan $qstyle($gettok($read(quotes.txt,n,%asearch),3-,45))
  76.             var %sreply true
  77.           }
  78.           else {
  79.             msg $chan $qstyle(Quotes found authored by $qt($2-) $+ : $replace(%asearch,$chr(44),$chr(44) $+ $chr(32)))
  80.             var %sreply true
  81.           }
  82.         }
  83.       }
  84.       var %search
  85.       var %i 1
  86.       while (%i <= $lines(quotes.txt)) {
  87.         if ($+(*,$2-,*) iswm $gettok($read(Quotes.txt,n,%i),3-,45)) {
  88.           var %search $addtok(%search,%i,44)
  89.         }
  90.         inc %i
  91.       }
  92.       if (%search != $null) {
  93.         if ((*,* !iswm %search) && (%search != %asearch)) {
  94.           msg $chan $qstyleb(Quote $+($chr(35),%search) added by $gettok($read(quotes.txt,%search),2,45) $timedifference($gettok($read(quotes.txt,%search),1,45)) ago matches search $qt($2-) $+ .)
  95.           msg $chan $qstyle($gettok($read(quotes.txt,n,%search),3-,45))
  96.           var %sreply true
  97.         }
  98.         elseif (*,* iswm %search) {
  99.           msg $chan $qstyle(Quotes found matching search $qt($2-) $+ : $replace(%search,$chr(44),$chr(44) $+ $chr(32)))
  100.           var %sreply true
  101.         }
  102.       }
  103.       elseif ((%sreply == $null) && (%search == $null)) {
  104.         msg $chan $qstyle(No quotes were found that matched your search of $qt($2-) $iif($3,$+ .,or were authored by $qt($2) $+ .))
  105.       }
  106.     }
  107.   }
  108.   if (($1 == .qadd) || ($1 == .quoteadd) || ($1 == .qadd)) {
  109.     if ($2 == $null) {
  110.       msg $chan $qstyle(If you want to add a quote type .qadd <quote> -- For help type .qhelp)
  111.     }
  112.     elseif ($2-) {
  113.       write quotes.txt $+($asctime,-,$nick,-,$2-)
  114.       msg $chan $qstyleb(Added $qt($+($2-12,$iif($13 != $null,...,$null))) as quote number $+($lines(quotes.txt),.))
  115.       writeini quotes.ini stats $nick $calc($readini(quotes.ini,stats,$nick) + 1 )
  116.       writeini quotes.ini stats all $calc($readini(quotes.ini,stats,all) + 1 )
  117.     }
  118.   }
  119.   if ($1 == .qban) {
  120.     if (($nick isin $readini(quotes.ini,mods,mods)) || ($nick isin $readini(quotes.ini,owner,owner))) {
  121.       if (!$2) {
  122.         msg $chan $qstyle(Type .qban add/del/list for more help type .qhelp)
  123.       }
  124.       if ($2 == add) {
  125.         if (!$3) {
  126.           msg $chan $qstyle(Type .qban add <nick> for more help type .qhelp)
  127.         }
  128.         elseif ($3 isin $readini(quotes.ini,bans,bans)) {
  129.           msg $chan $qstyle($3 is already banned from quotes!)
  130.         }
  131.         elseif ($3 isin $readini(quotes.ini,owner,owner)) {
  132.           msg $chan $qstyle(Sorry you may not ban $3 from quotes, as he is a quotes owner.)
  133.         }
  134.         else {
  135.           writeini quotes.ini bans bans $addtok($readini(quotes.ini,bans,bans),$3,32)
  136.           msg $chan $qstyle($3 added to quote bans list.)
  137.           if ($chr(42) isin $readini(quotes.ini,bans,bans)) {
  138.             writeini quotes.ini bans bans $remtok($readini(quotes.ini,bans,bans),$chr(42),1,32)
  139.           }
  140.         }
  141.       }
  142.       elseif ($2 == del) {
  143.         if (!$3) {
  144.           msg $chan $qstyle(Type .qban del <nick> for more help type .qhelp)
  145.         }
  146.         elseif ($3 !isin $readini(quotes.ini,bans,bans)) {
  147.           msg $chan $qstyle($3 isn't banned from quotes. How can I unban him?)
  148.         }
  149.         else {
  150.           var %t = $remtok($readini(quotes.ini,bans,bans),$3,1,32)
  151.           writeini quotes.ini bans bans $iif(%t == $null,$chr(42),%t)
  152.           msg $chan $qstyle($3 has been removed from the quotes ban list.)
  153.         }
  154.       }
  155.       elseif ($2 == list) {
  156.         msg $chan $qstyleb(Quote Bans)
  157.         msg $chan $qstyle($iif($readini(quotes.ini,bans,bans) == $null,Nobody is banned from using quotes (yet).,$v1))
  158.       }
  159.       else {
  160.         msg $chan $qstyle(Type .qban add/del/list for more help type .qhelp)
  161.       }
  162.     }
  163.     else {
  164.       msg $chan $qstyle(Sorry, you need to be a quote mod/owner to modify the ban list. See .qhelp or an op for assistance.)
  165.     }
  166.   }
  167.   if ($1 == .qmod) {
  168.     if ($nick isin $readini(quotes.ini,owner,owner)) {
  169.       if (!$2) {
  170.         msg $chan $qstyle(Type .qmod add/del/list for more help type .qhelp)
  171.       }
  172.       elseif ($2 == add) {
  173.         if ($3 == $null) {
  174.           msg $chan $qstyle(Type .qmod add <nick> for more help type .qhelp)
  175.         }
  176.         elseif ($3 isin $readini(quotes.ini,mods,mods)) {
  177.           msg $chan $qstyle($3 is already a quote mod.)
  178.         }
  179.         else {
  180.           writeini quotes.ini mods mods $addtok($readini(quotes.ini,mods,mods),$3,32)
  181.           msg $chan $qstyle($3 is now a quotes mod.)
  182.           if ($chr(42) isin $readini(quotes.ini,mods,mods)) {
  183.             writeini quotes.ini mods mods $remtok($readini(quotes.ini,mods,mods),$chr(42),1,32)
  184.           }
  185.         }
  186.       }
  187.       elseif ($2 == del) {
  188.         if ($3 == $null) {
  189.           msg $chan $qstyle(Type .qmod del <nick> for more help type .qhelp)
  190.         }
  191.         elseif ($3 !isin $readini(quotes.ini,mods,mods)) {
  192.           msg $chan $qstyle($3 isn't a quote mod. How can I remove him?)
  193.         }
  194.         else {
  195.           var %r = $remtok($readini(quotes.ini,mods,mods),$3,1,32)
  196.           writeini quotes.ini mods mods $iif(%r == $null,$chr(42),%r)
  197.           msg $chan $qstyle($3 has been removed from the quote mods list!)
  198.         }
  199.       }
  200.       elseif ($2 == list) {
  201.         msg $chan $qstyleb(Quote Mods)
  202.         msg $chan $qstyle($iif($readini(quotes.ini,mods,mods) == $null,Nobody is a quote moderator (yet).,$v1))
  203.       }
  204.       else {
  205.         msg $chan $qstyle(Type .qmod add/del/list for more help type .qhelp)
  206.       }
  207.     }
  208.     else {
  209.       if (($2 == list) && ($nick isin $readini(quotes.ini,mods,mods))) {
  210.         msg $chan $qstyleb(Quote Mods)
  211.         msg $chan $qstyle($iif($readini(quotes.ini,mods,mods) == $null,Nobody is a quote moderator (yet).,$v1))
  212.         halt
  213.       }
  214.       msg $chan $qstyle(Sorry, you need to be the quote owner to modify the mod list. See .qhelp or an op for assistance.)
  215.     }
  216.   }
  217.   if ($1 == .qowner) {
  218.     if ($nick isin $readini(quotes.ini,owner,owner)) {
  219.       if (!$2) {
  220.         msg $chan $qstyle(Type .qowner add/list for more help type .qhelp)
  221.       }
  222.       elseif ($2 == add) {
  223.         if ($3 == $null) {
  224.           msg $chan $qstyle(Type .qowner add <nick> for more help type .qhelp)
  225.         }
  226.         elseif ($3 isin $readini(quotes.ini,owner,owner)) {
  227.           msg $chan $qstyle($3 is already a quote owner.)
  228.         }
  229.         else {
  230.           writeini quotes.ini owner owner $addtok($readini(quotes.ini,owner,owner),$3,32)
  231.           msg $chan $qstyle($3 is now a quotes owner.)
  232.           if ($chr(42) isin $readini(quotes.ini,owner,owner)) {
  233.             writeini quotes.ini owner owner $remtok($readini(quotes.ini,owner,owner),$chr(42),1,32)
  234.           }
  235.         }
  236.       }
  237.       elseif ($2 == list) {
  238.         msg $chan $qstyleb(Quote Owners)
  239.         msg $chan $qstyle($iif($readini(quotes.ini,owner,owner) == $null,Nobody is a quote owner (yet). Type "/msg $me qowner" to be the first.,$v1))
  240.       }
  241.       else {
  242.         msg $chan $qstyle(Type .qowner add/list for more help type .qhelp)
  243.       }
  244.     }
  245.     else {
  246.       msg $chan $qstyle(Sorry, you need to be the quote owner to modify/read the owner list. See .qhelp or an op for assistance.)
  247.     }
  248.   }
  249.   if (($1 == .qdel) || ($1 == .quotedel) || ($1 == .delquote)) {
  250.     if ($2 == $null) {
  251.       msg $chan $qstyle(If you want to add a quote type .qadd <quote> -- For help type .qhelp)
  252.       halt
  253.     }
  254.     elseif ($nick isin $readini(quotes.ini,mods,mods)) || ($nick isin $readini(quotes.ini,owner,owner)) || ($nick == $gettok($read(quotes.txt,$2),2,45)) {
  255.       if (($2 !isnum) || ($2 == 0)) {
  256.         msg $chan $qstyle(To delete a quote type .qdel <quoteNumber> -- If you meant to add a quote type .qadd <quote> -- For help type .qhelp)
  257.       }
  258.       elseif ($2 !isnum 1- $+ $lines(quotes.txt)) {
  259.         msg $chan $qstyle(Sorry, but there are only $lines(quotes.txt) quotes in database! Add one by typing .qadd <quote>)
  260.       }
  261.       else {
  262.         if ($read(quotes.txt,$2) == $null) {
  263.           msg $chan $qstyleb(Quote $+($chr(35),$2) has previously been deleted.)
  264.           halt
  265.         }
  266.         writeini quotes.ini stats $gettok($read(quotes.txt),2,45) $calc($readini(quotes.ini,stats,$nick) - 1 )
  267.         writeini quotes.ini stats all $calc($readini(quotes.ini,stats,all) - 1 )
  268.         write -l $+ $2 quotes.txt
  269.         msg $chan $qstyleb(Quote $+($chr(35),$2) has been deleted.)
  270.       }
  271.     }
  272.     else {
  273.       msg $chan $qstyle(Sorry, you may only delete quotes that you didn't add if you are a quote mod/owner. For more help see .qhelp or an operator.)
  274.     }
  275.   }
  276.   if (($1 == .qnum) || ($1 == .qtotal)) {
  277.     var %total $readini(quotes.ini,stats,all)
  278.     var %nick $readini(quotes.ini,stats,$nick)
  279.     msg $chan $qstyle(There are %total quotes in the database. You have written %nick $+([,$calc($calc(%nick / %total) * 100),%,]) of them.)
  280.   }
  281.   if ($1 == .qhelp) {
  282.     if ($($+(%,quotehelp,$nick),2) == true) {
  283.       msg $chan $qstyle(You were just sent the quote help info. Check your notices.)
  284.     }
  285.     else {
  286.       set -u5 $+(%,quotehelp,$nick) true
  287.       notice $nick $qstyleb(Normal Quote Commands)
  288.       notice $nick $qstyle(.qread <number> - Displays quote <number> from quote database. If there is no <number>, it displays a random quote.)
  289.       notice $nick $qstyle(.qadd <quote> - Adds <quote> to database.)
  290.       .timer -m 1 10 notice $nick $qstyle(.qsearch <search term / author> to search the quote database.)
  291.       .timer -m 1 25 notice $nick $qstyle(.qnum - Displays the number of quotes in the database.)
  292.       .timer -m 1 50 notice $nick $qstyle(.qdel <number> - Deletes quote <number> from the database. $+($chr(40),Requires authorship or mod/owner,$chr(41)))
  293.       if ($nick isin $readini(quotes.ini,mods,mods)) || ($nick isin $readini(quotes.ini,owner,owner)) {
  294.         .timer -m 1 100 notice $nick $qstyleb(Moderator Quote Commands)
  295.         .timer -m 1 150 notice $nick $qstyle(.qban [add-del] <nick> - Adds or deletes <nick> to the banlist.)
  296.         .timer -m 1 200 notice $nick $qstyle(.qban [list] - Lists the names on the ban list.)
  297.         .timer -m 1 250 notice $nick $qstyle(.qmod [list] - Lists the names on the mod list.)
  298.       }
  299.       if ($nick isin $readini(quotes.ini,owner,owner)) {
  300.         .timer -m 1 300 notice $nick $qstyleb(Owner Quote Commands)
  301.         .timer -m 1 350 notice $nick $qstyle(.qmod [add-del] <nick> - Adds or deletes <nick> to the mod list.)
  302.         .timer -m 1 400 notice $nick $qstyle(.qowner [add] <nick> - Adds or deletes <nick> to the owner list. NOTE: You may not delete other quote owners.)
  303.         .timer -m 1 450 notice $nick $qstyle(.qowner [list] - Lists the names on the owner list.)
  304.       }
  305.     }
  306.   }
  307. }
  308. alias qstyleb {
  309.   return 14(4x14)10 $+ $1- $+ 14(4x14)
  310. }
  311. alias qstyle {
  312.   return 14(4x14) $+ $1- $+ 14(4x14)
  313. }
  314. alias timeDifference {
  315.   ;Input a date in $asctime format and this will return time from current date.
  316.   return $duration($calc($ctime - $ctime($1-)))
  317. }
  318. #Quotes end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement