Advertisement
Xzempt

Untitled

Jan 16th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 17.83 KB | None | 0 0
  1.  
  2. on *:LOAD: {
  3.   echo -a 04Remember that all commands 2nd/3rd parameter are without the < > symbols.
  4.   echo -a The list of commands are as follows:
  5.   echo -a 14!quote <number> <- optional number. This command will display a completely random quote. If a number is supplied it will display the corresponding quote number.
  6.   echo -a 14!addquote <your quote here> This command allows you to add a quote to the database.
  7.   echo -a 14!delquote <number>  number = the quote number
  8.   echo -a 14!findquote intext <search paramaters here> . i.e !findquote intext fuck your face
  9.   echo -a 14!quoteban <name here>  (bans them from adding quotes only) (( 04Channel ops only ))
  10.   echo -a 14!delquoteban <name here>  (removes the ban on their add quote priviledges.) (( 04Channel ops only ))
  11.   echo -a 14!randquote <search params here>  (more or less the same as !findquote instead of giving you a list of quote numbers this will auto choose a quote matching your search parameters and display it)
  12.   echo -a 04This script uses the /userip Oper Command. If you are not an IRCop on your network then the !quoteban will not function properly.
  13.   if ($exists(quotes.txt) == $false) {
  14.     write quotes.txt
  15.   }
  16. }
  17.  
  18. #Quotebot on
  19. raw 340:*: {
  20.   set %nickcheck $gettok($1-,2,64)
  21. }
  22. on *:TEXT:*:#gigebox,#calmdown,#blaze.u,#staff,#lobby,#opers,#priv8,#Blame.Ezrie: {
  23.   if ($chan != #torrentleech) {
  24.     if (!%quoteflood) {
  25.       if ($1 == !addquote) && (!$2) {
  26.         set -u3 %quoteflood on
  27.         msg $chan Add a quote idiot.
  28.       }
  29.       if ($1 == !addquote) && ($2) {
  30.         userip $nick
  31.         if (%nickcheck != $readini(quoteban.ini,$chan,$nick)) {
  32.           if ($chr(191) !isin $2-) {
  33.             set -u3 %quoteflood on
  34.             write quotes.txt $2- ¿  Added: $adate ¿ By: $nick
  35.             hadd -sm quotes $calc($hget(quotes,0).item + 1) $2-
  36.             msg $chan 11(14Quote Added: $chr(35) $+ $lines(quotes.txt) $+ 11)
  37.           }
  38.         }
  39.         elseif (%nickcheck == $readini(quoteban.ini,$chan,$nick)) {
  40.           set -u3 %quoteflood on
  41.           echo -a $readini(quoteban.ini,$chan,$nick)
  42.           notice $nick Sorry $nick $+ , You have been banned from using this command.
  43.         }
  44.         else {
  45.           set -u3 %quoteflood on
  46.           msg $chan 04Error: Please try again without " $+ $chr(191) $+ ".
  47.         }
  48.       }
  49.       if ($1 == !quote) && (!$2) {
  50.         set -u3 %quoteflood on
  51.         %rand = $rand(1, $hget(quotes,0).item)
  52.         %item.num = $hget(quotes, %rand).item
  53.         %quote.data = $hget(quotes, %item.num).data
  54.         %quote.num = $hget(quotes,%item.num).item
  55.         msg $chan 09Quote Number11:04 %quote.num $+  %quote.data 14-09 $+($gettok($gettok($read(quotes.txt,n,%quote.num),2,191),1,58),11:07,$gettok($gettok($read(quotes.txt,n,%quote.num),2,191),2,58))  09 $+($gettok($gettok($read(quotes.txt,n,%quote.num),3,191),1,58),11:07,$gettok($gettok($read(quotes.txt,n,%quote.num),3,191),2,58))
  56.  
  57.       }
  58.       if ($1 == !quote) && ($2 isnum) {
  59.         set -u3 %quoteflood on
  60.         set -u3 %quote $gettok($read(quotes.txt,n,$2),1,191)
  61.         if (%quote != $null) {
  62.           msg $chan 09Quote Number:04 $2 $+  $gettok($read(quotes.txt,n,$2),1,191) 14-09 $+($gettok($gettok($read(quotes.txt,n,$2),2,191),1,58),11:07,$gettok($gettok($read(quotes.txt,n,$2),2,191),2,58))  09 $+($gettok($gettok($read(quotes.txt,n,$2),3,191),1,58),11:07,$gettok($gettok($read(quotes.txt,n,$2),3,191),2,58))
  63.         }
  64.         else {
  65.           set -u3 %quoteflood on
  66.           msg $chan 04Error: The quote you specified does not exist.
  67.         }
  68.       }
  69.       if ($1 == !quote) && ($2 != $null) {
  70.         if ($left($2,1) == $chr(35)) {
  71.           var %2 = $remove($2,$chr(35))
  72.           msg $chan 09Quote Number:04 %2 $+  $gettok($read(quotes.txt,n,%2),1,191) 14-09 $+($gettok($gettok($read(quotes.txt,n,%2),2,191),1,58),11:07,$gettok($gettok($read(quotes.txt,n,%2),2,191),2,58))  09 $+($gettok($gettok($read(quotes.txt,n,%2),3,191),1,58),11:07,$gettok($gettok($read(quotes.txt,n,%2),3,191),2,58))
  73.  
  74.         }
  75.         if ($2 !isnum) && ($left($2,1) != $chr(35)) {
  76.           msg $chan 09Error11: 07Try 09!randquote $2 07or 09!findquote intext $2 $+ .07 This command only accepts quote numbers.
  77.         }
  78.       }
  79.  
  80.       if ($1 ==  !quotehelp) {
  81.         set -u3 %quoteflood on
  82.         .notice $nick 04Remember that all commands 2nd/3rd parameter are without the < > symbols.
  83.         .notice $nick The list of commands are as follows:
  84.         .notice $nick 14!quote <number> <- optional number. This command will display a completely random quote. If a number is supplied it will display the corresponding quote number.
  85.         .notice $nick 14!addquote <your quote here> This command allows you to add a quote to the database.
  86.         .notice $nick 14!delquote <number>  number = the quote number
  87.         .notice $nick 14!findquote intext <search paramaters here> . i.e !findquote intext fuck your face
  88.         .notice $nick 14!quoteban <name here>  (bans them from adding quotes only) (( 04Channel Owners or Admin only ))
  89.         .notice $nick 14!delquoteban <name here>  (removes the ban on their add quote priviledges.) (( 04Channel Owners or Admin only ))
  90.         .notice $nick 14!randquote <search params here>  (more or less the same as !findquote instead of giving you a list of quote numbers this will auto choose a quote matching your search parameters and display it)
  91.       }
  92.       if ($1 == !quotes) {
  93.         set -u3 %quoteflood on
  94.         msg $chan  There's a total of $lines(quotes.txt) quotes.
  95.       }
  96.       if ($1 == !findquote) && ($2 == intext) && ($3) {
  97.         set -u3 %quoteflood on
  98.         set %chan $chan
  99.         set -u5 %search $3-
  100.         set -u5 %find on
  101.         if ($hget(results,0).item > 0) {
  102.           hfree results
  103.           rsearch
  104.         }
  105.         else {
  106.           rsearch
  107.         }
  108.       }
  109.       if ($1 == !randquote) {
  110.         if ($2) {
  111.           set -u3 %quoteflood on
  112.           unset %qnumber
  113.           set %chan $chan
  114.           set -u5 %search $2-
  115.           if ($hget(results,0).item > 0) {
  116.             hfree results
  117.             rsearch
  118.           }
  119.           else {
  120.             rsearch
  121.           }
  122.         }
  123.         else {
  124.           set -u3 %quoteflood on
  125.           msg $chan 09Error11:07 Please supply a 2nd parameter.
  126.         }
  127.       }
  128.       if ($1 == !findquote) && ($2 == intext) && (!$3) {
  129.         set -u3 %quoteflood on
  130.         msg $chan 09Error11:07 Please supply a 3rd parameter.
  131.       }
  132.       if ($left($nick($chan,$nick).pnick,1) == &) || ($left($nick($chan,$nick).pnick,1) == ~) {
  133.         if ($1 == !delquote) && ($2 isnum) {
  134.           set -u5 %delquote $read(quotes.txt,$2)
  135.           if (%delquote != $null) {
  136.             set -u3 %quoteflood on
  137.             write -dl $2 quotes.txt
  138.             hdel -s quotes $remove($2, $chr(35))
  139.             msg $chan 11(14Quote: $chr(35) $+ $2 Deleted.11)
  140.           }
  141.           else {
  142.             set -u3 %quoteflood on
  143.             msg $chan 09Error11:07 The quote you specified does not exist.
  144.           }
  145.         }
  146.         if ($1 == !delquote) && ($2 !isnum) {
  147.           msg $chan 09Error11:07 Syntax is !delquote 69 (69 = number of the quote)
  148.  
  149.         }
  150.         if ($1 == !delquote) && (!$2) {
  151.           set -u3 %quoteflood on
  152.           msg $chan 09Error11:07 Syntax is !delquote number
  153.         }
  154.         if ($1 == !quoteban) && (!$2) {
  155.           set -u3 %quoteflood on
  156.           msg $chan 09Error11:07 Please supply a 2nd parameter.
  157.         }
  158.         if ($1 == !quoteban) && ($2) {
  159.           if ($2 != $me) {
  160.             userip $2
  161.             if (%nickcheck != $null) {
  162.               userip $2
  163.               set -u3 %quoteflood on
  164.               writeini quoteban.ini $chan $2 %nickcheck
  165.               notice $nick 14" $+ $2 $+ 's" host was added to quote ban.
  166.             }
  167.             else {
  168.               set -u3 %quoteflood on
  169.               notice $nick Nick: $2 does not exist, please try again.
  170.             }
  171.           }
  172.  
  173.           if ($1 == !quoteban) && ($2 == $me) {  
  174.             set -u3 %quoteflood on
  175.             msg $chan 09Error11:07 You can not ban me from the add quote command.
  176.  
  177.           }
  178.         }
  179.         if ($1 == !delquoteban) && ($2) {
  180.           userip $2
  181.           if (%nickcheck == $readini(quoteban.ini,$chan,$2)) {
  182.             set -u3 %quoteflood on
  183.             remini quoteban.ini $chan $2
  184.             notice $nick $2 was removed from the quote ban list.
  185.           }
  186.           else {
  187.             set -u3 %quoteflood on
  188.             notice $nick Nick: $2 does not exist, please try again.
  189.           }
  190.         }
  191.       }
  192.       if ($1 == !quoteban) || ($1 == !delquoteban) || ($1 == !delquote) && ($2) && ($nick !isop $chan) {
  193.         set -u3 %quoteflood on
  194.         notice $nick 09Error11:07 You do not have access to this command, $nick $+ .
  195.  
  196.       }
  197.     }
  198.   }
  199.   unset %quotes
  200. }
  201. on *:START: { echo -a 09Loading Quote Data | hmake quotes 100 | %start.load = $ticks | hload -n quotes quotes.txt | quote.table }
  202.  
  203. alias quote.table {  
  204.   %finish.load = $ticks
  205.   echo -a 09Loaded: $hget(quotes,0).item quotes in $calc(%finish.load - %start.load) ms.
  206.   unset %*.load
  207.  
  208. }
  209. alias get.ids {
  210.   if ($1 == results) && ($2) {
  211.     var %search = $2-
  212.     %ids = 0
  213.     while (%ids <= $hget(results,0).item) {    
  214.       var %string = $hget(results,%ids).data
  215.       if ($regex(%string, /(.* %search .*)/i)) {
  216.         ;echo -a Matches: $regml(0) Data: $regml(1)
  217.         echo -a 09Item11:09 ID11:07 %ids 09Quote Number11:04 $hget(results,%ids).item 09Quote11:07 $replace($hget(results,%ids).data, %search, 09 $+ %search $+ 07)
  218.         inc %ids
  219.       }
  220.       inc %ids
  221.     }
  222.   }
  223.   if ($1 == quotes) && ($2) {
  224.     var %search = $2-
  225.     %ids = 0
  226.     while (%ids <= $hget(quotes,0).item) {
  227.       var %string = $hget(quotes,%ids).data
  228.       var %blah = $regex(%string, /(.* %search .*)/i)
  229.       if (%blah > 0) {
  230.         echo -a Matches: $regml(0) Data: $regml(1) 09Item11:09 ID11:07 %ids 09Quote Number11:04 $hget(quotes,%ids).item 09Quote11:07 $replace($hget(quotes,%ids).data, %search, 09 $+ %search $+ 07)    
  231.         inc %ids
  232.       }
  233.       inc %ids
  234.     }
  235.   }
  236. }
  237. ;echo -a 09Table Entry11: %x 09Quote Number11:04 $hget(quotes,%x).item
  238. ;echo -a 09Quote11:07 $hget(quotes,%x).data
  239. // !find quote intext "string" / !randquote "string" search function
  240.  
  241.  
  242. alias rsearch {
  243.   var %x = 0
  244.  
  245.   ;--------------iterate through quotes table
  246.   while (%x <= $hget(quotes,0).item) {
  247.  
  248.     ;--------------set string data(the quote text);;;;;;;;;;
  249.     var %string = $hget(quotes,%x).data
  250.  
  251.     ;--------------perform a regular expression match on the search parameters
  252.     if ($regex(%string, /(.* $+ %search $+ .*)/i)) {
  253.  
  254.       ;--------------found a match, add it to the results table
  255.       hadd -m results $hget(quotes,%x).item $hget(quotes,%x).data
  256.  
  257.       ;--------------set quote number and it's item referral
  258.       var %qnumber %qnumber $+($chr(35),$hget(quotes,%x).item,=,%x)
  259.       inc %x
  260.     }
  261.     inc %x
  262.   }
  263.   var %results = 1
  264.  
  265.   ;--------------iterate through the results table
  266.   while (%results <= $hget(results,0).item) {
  267.  
  268.     ;--------------set quote number with the # sign for the return values
  269.     set -u3 %quotes %quotes $chr(35) $+ $hget(results, %results).item
  270.     inc %results
  271.   }
  272.  
  273.   ;--------------sets a random number between 1 and $numtok(%qnumber,32), this variable determines the quote number displayed
  274.   var %rquote = $rand(1,$numtok(%qnumber,32))
  275.  
  276.   ;--------------this is the item number of the quote in the table
  277.   var %item.no = $gettok($gettok(%qnumber,%rquote,32),2,61)
  278.  
  279.   ;--------------this is the quote number of the quote in the table
  280.   var %quote.no = $remove($gettok($gettok(%qnumber,%rquote,32),1,61),$chr(35))
  281.  
  282.   ;--------------this is the quote text
  283.   var %quote = $hget(quotes,%item.no).data
  284.  
  285.   ;--------------!%find represents the !randquote command used to trigger this script.
  286.   if (!%find) {
  287.  
  288.     ;--------------found matches for our search parameters...
  289.     if (%quote != $null) {
  290.  
  291.       ;--------------Display the number of matches found for the search parameters...
  292.       msg $chan  09Found1107 $hget(results,0).item 09entries.
  293.  
  294.       ;--------------Display the quote details.
  295.       msg $chan  09Quote Number11:04 %quote.no 09Quote11: $replace($gettok(%quote,1,191),%search,09 $+ %search $+ ) $&
  296.         14-09 $gettok($gettok($read(quotes.txt,%quote.no),2,191),1,58) $+ 11: $+ 07 $+ $gettok($gettok($read(quotes.txt,%quote.no),2,191),2,58) $+ 09 $&
  297.         $gettok($gettok($read(quotes.txt,%quote.no),3,191),1,58) $+ 11:07 $+ $gettok($gettok($read(quotes.txt,%quote.no),3,191),2,58)
  298.  
  299.       ;--------------determines if more than 1 match was found, if so, notices the requesting nick the quote numbers for the remaining entries matched via the supplied search parameters.
  300.       if ($calc($numtok(%quotes,32) - 1) > 0) {
  301.  
  302.         ;--------------notices the requesting nick the remaining matches
  303.         .notice $nick 09 $+ $calc($numtok(%quotes,32) - 1) other related entries11:07 $remove(%quotes, $chr(35) $+ %quote.no)
  304.       }
  305.  
  306.     }
  307.     ;--------------no matches found, error.
  308.     else {
  309.       msg $chan  09Error11:07 There's no quotes containing what you specified.
  310.       unset %quotes
  311.     }
  312.   }
  313.   ;--------------!findquote intext searchparameters command was used.
  314.   else {
  315.  
  316.     ;--------------found matches for our search parameters
  317.     if (%quote != $null) {
  318.  
  319.       ;--------------Display result total
  320.       msg $chan  09Found1107 $hget(results,0).item 09entries.
  321.  
  322.       ;--------------Send quote data
  323.       msg $chan 09Entries11:07 $hget(results,0).item 09Quote Number:04 %quote.no $+  $replace($gettok(%quote,1,191),%search,09 $+ %search $+ ) $&
  324.         14-09 $gettok($gettok($read(quotes.txt,%quote.no),2,191),1,58) $+ : $+ 07 $+ $gettok($gettok($read(quotes.txt,%quote.no),2,191),2,58) $+ 09 $&
  325.         $gettok($gettok($read(quotes.txt,%quote.no),3,191),1,58) $+ :07 $+ $gettok($gettok($read(quotes.txt,%quote.no),3,191),2,58)
  326.  
  327.       ;--------------checks if more than 1 result was found.
  328.       if ($calc($numtok(%quotes,32) - 1) > 0) {
  329.  
  330.         ;--------------notices requesting nick the remaining quote numbers matching our search parameters
  331.         notice $nick 09 $+ $calc($numtok(%quotes,32) - 1) other related entries11:07 $remove(%quotes, $chr(35) $+ %quote.no)
  332.         unset %quotes
  333.       }
  334.       unset %quotes
  335.     }
  336.     ;--------------No matches found, error.
  337.     else {
  338.       ;--------------send error.
  339.       msg $chan 09Error11:07 There's no quotes containing what you specified.
  340.       unset %quotes
  341.     }
  342.   }
  343. }
  344.  
  345.  
  346. ;<--[ Input commands. Use these to add/delete/quote them yourself. ]-->;
  347.  
  348.  
  349. alias addquote {
  350.   if (!$1) {
  351.     set -u3 %quoteflood on
  352.     echo -a Add a quote idiot.
  353.   }
  354.   if ($1) {
  355.     if ($chr(191) !isin $2-) {
  356.       set -u3 %quoteflood on
  357.       write quotes.txt $1- ¿  Added: $adate ¿ By: $me
  358.       echo -a 11(14Quote Added: $chr(35) $+ $lines(quotes.txt) $+ 11)
  359.     }
  360.     else {
  361.       echo -a 04Error: Please try again without " $+ $chr(191) $+ ".
  362.     }
  363.   }
  364. }
  365. alias delquote {
  366.   if ($1) {
  367.     set -u5 %delquote $read(quotes.txt,$1)
  368.     if (%delquote != $null) {
  369.       set -u3 %quoteflood on
  370.       write -dl $1 quotes.txt
  371.       echo -a 11(14Quote: $chr(35) $+ $1 Deleted.11)
  372.     }
  373.     else {
  374.       echo -a 04Error: The quote you specified does not exist.
  375.     }
  376.   }
  377. }
  378. /*
  379. alias quote {
  380.   if (!$1) {
  381.     set -u3 %quoteflood on
  382.     set -u3 %quote $read(quotes.txt)
  383.     %line = $readn
  384.     msg $chan 14Quote Number:04 %line $+  $gettok(%quote,1,191) 14- $gettok(%quote,2,191) $gettok(%quote,3,191)
  385.     unset %line
  386.   }
  387.   if ($1) {
  388.     set -u3 %quoteflood on
  389.     %quote = $gettok($read(quotes.txt,$1),1,191)
  390.     if (%quote != $null) {
  391.       msg $chan 14Quote Number:04 $1 $+  $gettok($read(quotes.txt,$1),1,191) 14- $gettok($read(quotes.txt,$1),2,191) $gettok($read(quotes.txt,$1),3,191)
  392.     }
  393.     else {
  394.       msg $chan 04Error: The quote you specified does not exist.
  395.     }
  396.   }
  397. }
  398. */
  399. #Quotebot end
  400.  
  401. on *:INPUT:*: {
  402.   if ($1 == .reload) { timerload -m 1 1 msg $chan 09Loading Quote Data... | timerloaded -m 1 $calc(%finish.load - %start.load) msg $chan 09Loaded: $hget(quotes,0).item quotes in $calc(%finish.load - %start.load) ms. }
  403.   if ($1 == !randquote) {
  404.     if ($2) {
  405.       set -u3 %quoteflood on
  406.       unset %qnumber
  407.       set %chan $chan
  408.       set -u5 %search $2-
  409.       if ($hget(results,0).item > 0) {
  410.         hfree results
  411.         rsearch
  412.       }
  413.       else {
  414.         rsearch
  415.       }
  416.     }
  417.     else {
  418.       set -u3 %quoteflood on
  419.       msg $chan 09Error11:07 Please supply a 2nd parameter.
  420.     }
  421.   }
  422.   if ($1 == !addquote) {
  423.     write quotes.txt $2- ¿  Added: $adate ¿ By: $me
  424.     .timer.msg 1 1 msg $active 11(14Quote Added: $chr(35) $+ $lines(quotes.txt) $+ 11)
  425.   }
  426.   if ($1 == !delquote) {
  427.     write -dl $2 quotes.txt
  428.     .timer.msg 1 1 msg $active 11(14Quote: $chr(35) $+ $2 Deleted.11)
  429.   }
  430.   if ($1 == !quote) {
  431.     if (!$2) {
  432.       set -u3 %quoteflood on
  433.       set -u3 %quote $read(quotes.txt)
  434.       %line = $readn
  435.       .timer.msg 1 1 msg $chan 09Quote Number:04 %line $+  $gettok(%quote,1,191) 14- $gettok(%quote,2,191) $gettok(%quote,3,191)
  436.       unset %line
  437.     }
  438.     if ($2) {
  439.       set -u3 %quoteflood on
  440.       %quote = $gettok($read(quotes.txt,$2),1,191)
  441.       if (%quote != $null) {
  442.         .timer.msg 1 1 msg $chan 09Quote Number:04 $2 $+  $gettok($read(quotes.txt,n,$2),1,191) 14- $gettok($read(quotes.txt,n,$2),2,191) $gettok($read(quotes.txt,n,$2),3,191)
  443.       }
  444.       else {
  445.         .timer.msg 1 1 msg $chan 04Error: The quote you specified does not exist.
  446.       }
  447.     }
  448.   }
  449. }
  450. ;IP REGEX: $regex(192.168.0.3, /([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement