Advertisement
westor

Custom Commands for Aotik v1.0

Feb 10th, 2015
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.97 KB | None | 0 0
  1. ON *:TEXT:!commands *:#: {
  2.   tokenize 32 $strip($1-)
  3.   var %chc = $chr(35) $+ $nick
  4.   if ($chan = %chc) || ($nick isop #) {
  5.     if ($2 == list) {
  6.       var %command_file = commandslist.ini
  7.       var %x = $ini(%command_file,$chan,0)
  8.       if (!%x) { msg $chan $nick -> No custom commands available | return }
  9.       var %kk = ''
  10.       if (%x) {
  11.         msg $chan $nick -> Sending a query of all available custom commands for $chan
  12.         while (%x) {
  13.           var %kk = $ini(%command_file,$chan,%x)
  14.           var %comtxt = $readini(%command_file,n,$chan,%kk)
  15.           if (mod=true isin $gettok(%comtxt,1,32)) { var %kk = %kk (Mods) }
  16.           var %text = %text %kk
  17.           dec %x
  18.         }
  19.         msg $chan $nick -> Custom commands available %text
  20.       }
  21.     }
  22.     elseif ($2 == total) {
  23.       var %command_file = commandslist.ini
  24.       var %t = $ini(%command_file,$chan,0)
  25.       if (%t) { msg $chan $nick -> Total commands are %t }
  26.       elseif (!%t) { msg $chan $nick -> There is NOT any custom command available }
  27.     }
  28.     elseif ($2 == clearlist) {
  29.       if (%chc = $chan) || ($nick == aotik) {
  30.         var %command_file = commandslist.ini
  31.         var %x = $ini(%command_file,$chan,0)
  32.         if (!%x) { msg $chan $nick -> No custom commands available | return }
  33.         var %kk = ''
  34.         if (%x) {
  35.           while (%x) {
  36.             var %kk = $ini(%command_file,$chan,%x)
  37.             remini %command_file $chan %%kk
  38.             dec %x
  39.           }
  40.           msg $chan $nick -> Custom commands list has been cleared
  41.         }
  42.       }
  43.       else { msg $chan $nick -> This command is only for channel owners }
  44.     }
  45.     else { msg $chan $nick -> Wrong command list parameter, use list or clearlist }
  46.   }
  47. }
  48.  
  49. on *:TEXT:!addcommand *:#: {
  50.   tokenize 32 $strip($1-)
  51.   if ($istok(%botcommands,$2,44)) { msg $chan $nick -> Error, This command $qt($2) is already exist on the bot, you cannot add this command! | return }
  52.   var %chc = $chr(35) $+ $nick
  53.   if ($chan = %chc) || ($nick isop #) {
  54.     var %command_file = commandslist.ini
  55.     if ($left($2,1) !== !) { msg $chan $nick -> You must add ! before any command! (E.g: ! $+ $2 $+ ) | return }
  56.     if ($ini(%command_file,$chan,$2)) { msg $chan $nick -> Command $2 already exists }
  57.     else {
  58.       writeini %command_file $chan $2 $3-
  59.       msg $chan $nick -> $2 has been added $iif(($3 == mod=true),(Channel Moderators command only))
  60.     }
  61.   }
  62. }
  63.  
  64. on *:TEXT:!editcommand *:#: {
  65.   tokenize 32 $strip($1-)
  66.   var %chc = $chr(35) $+ $nick
  67.   if ($chan = %chc) || ($nick isop #) {
  68.     var %command_file = commandslist.ini
  69.     if ($left($2,1) !== !) { msg $chan $nick -> You must add ! before any command! (E.g: ! $+ $2 $+ ) | return }
  70.     if ($ini(%command_file,$chan,$2)) {
  71.       remini %command_file $chan $2
  72.       writeini %command_file $chan $2 $3-
  73.       msg $chan $nick -> $2 has been edited to $iif($3 == mod=true,(Channel Moderators only) $4-,$3-)
  74.     }
  75.     else { msg $chan $nick -> Command $2 could not be found }
  76.   }
  77. }
  78.  
  79. on *:TEXT:!delcommand *:#: {
  80.   tokenize 32 $strip($1-)
  81.   var %chc = $chr(35) $+ $nick
  82.   if ($chan = %chc) || ($nick isop #) {
  83.     if ($left($2,1) !== !) { msg $chan $nick -> You must add ! before any command! (E.g: ! $+ $2 $+ ) | return }
  84.     var %command_file = commandslist.ini
  85.     if ($ini(%command_file,$chan,$2)) {
  86.       remini %command_file $chan $2
  87.       msg $chan $nick -> Command $2 has been deleted
  88.     }
  89.     else { msg $chan $nick -> Command $2 could not be found }
  90.   }
  91. }
  92.  
  93. ON *:TEXT:*:#: {
  94.   var %command_file = commandslist.ini
  95.   var %t = $readini(%command_file,n,$chan,$strip($1))
  96.   var %t = $replace(%t,@user@,$nick,@chan@,$chan)
  97.   tokenize 32 %t
  98.   if ($1 == mod=true) && (%t) {
  99.     var %text = $2-
  100.     if ($nick !isop $chan) { msg $chan $nick -> Error, You are NOT an channel moderator! | return }
  101.     if (!%text) { return }
  102.     msg $chan %text
  103.   }
  104.   elseif ($1 !== mod=true) && (%t) {
  105.     var %text = $1-
  106.     if (!%text) { return }
  107.     msg $chan %text
  108.   }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement