SHARE
TWEET

Userlist v5.2+g

Seb Dec 21st, 2015 (edited) 113 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##############################
  2. #      Userlist System       #
  3. #        Version: 5.2        #
  4. #          By: Seb           #
  5. # Mail: seblemery@gmail.com  #
  6. #   Net: ix.undernet.org     #
  7. #   Chan: #mircscripting     #
  8. ##############################
  9. # Changelog:                 #
  10. # v1 was ugly, and from 2001 #
  11. # v2 revamped completely,    #
  12. # added levels and aliases   #
  13. # ---------------------      #
  14. # todo:                      #
  15. # [] .set (chanset)          #
  16. # [] %var in menu?           #
  17. # [X] combined aliases       #
  18. # [x] lvl edits              #
  19. # [] help files              #
  20. ##############################
  21.  
  22. #aliases
  23.  
  24. alias user.list {
  25.   var %dbp = database\ $+ # $+ .ini
  26.   var %valid.levels = op,voice,protect,bot,manager
  27.   vas %pull.level = $1
  28.   if ($1 !isin %valid.levels) { echo -a [Error] Invalid Level, try: /c.list <op|voice|protect|bot|manager> | halt }
  29.   if ($ini(%dbp,$1,0) == $null) { echo -at $1 List Empty | halt }  
  30.   echo -a Listing:4 $1 on # 
  31.   var %o = 1 | while (%o <= $ini(%dbp,$1,0)) { echo -a $2 $ini(%dbp,$1,%o) | inc %o }
  32. }
  33.  
  34. alias show.levels {
  35.   var %dbp = database\ $+ # $+ .ini
  36.   echo -a command disabled for now
  37.   msg $chan Levels for $1 with this mask :: $address($1,2)
  38.   msg $chan $&
  39.     $iif($readini(%dbp, manager, $address($1,2)),3+manager,4-manager) $&    
  40.     $iif($readini(%dbp, infoline, $address($1,2)),3+infoline,4-infoline) $&    
  41.     $iif($readini(%dbp, op, $address($1,2)),3+autoop,4-autoop) $&    
  42.     $iif($readini(%dbp, voice, $address($1,2)),3+autovoice,4-autovoice) $&    
  43.     $iif($readini(%dbp, keepop, $address($1,2)),3+keepop,4-keepop) $&    
  44.     $iif($readini(%dbp, bot, $address($1,2)),3+bot,4-bot) $&
  45.     $iif($readini(%dbp, protect, $address($1,2)),3+protect,4-protect)              
  46. }
  47.  
  48.  
  49. alias update.levels {
  50.   var %dbp2 = database\ $+ $2 $+ .ini
  51.   msg $2 Levels for $1 with this mask :: $address($1,2)
  52.   msg $2 $&
  53.     $iif($readini(%dbp2, manager, $address($1,2)),3+manager,4-manager) $&    
  54.     $iif($readini(%dbp2, infoline, $address($1,2)),3+infoline,4-infoline) $&    
  55.     $iif($readini(%dbp2, op, $address($1,2)),3+autoop,4-autoop) $&    
  56.     $iif($readini(%dbp2, voice, $address($1,2)),3+autovoice,4-autovoice) $&    
  57.     $iif($readini(%dbp2, keepop, $address($1,2)),3+keepop,4-keepop) $&    
  58.     $iif($readini(%dbp2, bot, $address($1,2)),3+bot,4-bot) $&
  59.     $iif($readini(%dbp2, protect, $address($1,2)),3+protect,4-protect) $&
  60.     $iif($readini(%dbp2, suspend, $address($2,2)),3+suspend,4-suspend)        
  61. }
  62.  
  63. alias c.update {
  64.   if ($timershow) { halt }
  65.   set %dbupchan $chan
  66.   .timer $+ show 1 2 update.levels $1 %dbupchan
  67.   unset %dbupchan
  68. }
  69.  
  70. #events
  71.  
  72. on *:JOIN:#:{
  73.   var %dbp = database\ $+ # $+ .ini
  74.   if ($readini(%dbp, suspend, $address($nick,2))) { msg $chan $+([,$nick,]) Is Suspended | halt }
  75.   if ($readini(%dbp, infoline, $address($nick,2))) {
  76.     if ($nick == $me) { return }
  77.     msg $chan ( $+ $nick $+ ) $readini(%dbp, infoline, $address($nick,2))
  78.   }
  79.   if ($readini(%dbp, op, $address($nick,2)) == 1) && ($readini(%dbp, voice, $address($nick,2)) == 1) {
  80.     .mode # +ov # $nick
  81.     halt
  82.   }
  83.   if ($readini(%dbp, op, $address($nick,2)) == 1) {
  84.     mode $chan +o $nick
  85.     halt
  86.   }
  87.   if ($readini(%dbp, voice, $address($nick,2)) == 1) {
  88.     mode $chan +v $nick
  89.     halt
  90.   }
  91. }
  92. on *:KICK:#:{
  93.   var %dbp = database\ $+ # $+ .ini
  94.   if ($readini(%dbp, protect, $address($knick,2)) == 1) {
  95.     ban -k $chan $nick $knick is Protected! [Suspended: 1h]
  96.     writeini %dbp suspend $address($nick,2) 1
  97.     .timer 1 3600 remini %dbp suspend $address($nick,2) 1
  98.   }
  99. }
  100. on *:ban:#:{
  101.   var %dbp = database\ $+ # $+ .ini
  102.   if ($bnick == $nick) { halt }
  103.   if ($readini(%dbp, protect, $address($bnick,2)) == 1) {
  104.     mode $chan -bo+b $banmask $nick $address($nick,2)
  105.     kick $chan $nick $bnick is Protected! [Suspended: 1h]
  106.     writeini %dbp suspend $address($nick,2) 1    
  107.     .timer 1 3600 remini %dbp suspend $address($nick,2) 1
  108.   }
  109. }
  110. on *:DEOP:#:{
  111.   var %dbp = database\ $+ # $+ .ini
  112.   if ($nick == $me) { halt }
  113.   if ($opnick == $nick) { halt }
  114.   if ($readini(%dbp, keepop, $address($opnick,2)) == 1) {
  115.     mode $chan -o+o $nick $opnick
  116.     msg $chan $opnick has KeepOp Enabled on $opnick
  117.   }
  118. }
  119.  
  120. on 1:input:#:{
  121.   var %dbp = database\ $+ # $+ .ini
  122.   if ($1 == .who) {
  123.     .timer 1 1 msg $chan Levels for $2 with this mask :: $address($2,2)
  124.     .timer 1 1 msg $chan $&
  125.       $iif($readini(%dbp, manager, $address($2,2)),3+manager,4-manager) $&    
  126.       $iif($readini(%dbp, infoline, $address($2,2)),3+infoline,4-infoline) $&    
  127.       $iif($readini(%dbp, op, $address($2,2)),3+autoop,4-autoop) $&    
  128.       $iif($readini(%dbp, voice, $address($2,2)),3+autovoice,4-autovoice) $&    
  129.       $iif($readini(%dbp, keepop, $address($2,2)),3+keepop,4-keepop) $&    
  130.       $iif($readini(%dbp, bot, $address($2,2)),3+bot,4-bot) $&
  131.       $iif($readini(%dbp, protect, $address($2,2)),3+protect,4-protect) $&
  132.       $iif($readini(%dbp, suspend, $address($2,2)),3+suspend,4-suspend)    
  133.     $iif($readini(%dbp, infoline, $address($2,2)),msg $chan Infoline: $readini(%dbp, infoline, $address($2,2)),$null)
  134.   }
  135.   if ($1 == .mod) {
  136.     if (+bot isin $3-) { writeini %dbp bot $address($2,2) 1 | c.update $2 }
  137.     if (+autoop isin $3-) { writeini %dbp op $address($2,2) 1 | c.update $2 | mode $chan +o $2 }
  138.     if (+autovoice isin $3-) { writeini %dbp voice $address($2,2) 1 | c.update $2 | mode $chan +v $2 }
  139.     if (+keepop isin $3-) { writeini %dbp keepop $address($2,2) 1 | c.update $2 }
  140.     if (+protect isin $3-) { writeini %dbp protect $address($2,2) 1 | c.update $2 }
  141.     if (+manager isin $3-) { writeini %dbp manager $address($2,2) 1 | c.update $2 }
  142.     if (+suspend isin $3-) { writeini %dbp suspend $address($2,2) 1 | c.update $2 }    
  143.     if (-bot isin $3-) { remini %dbp bot $address($2,2) | c.update $2 }
  144.     if (-autoop isin $3-) { remini %dbp op $address($2,2) | c.update $2 | mode $chan -o $2 }
  145.     if (-autovoice isin $3-) { remini %dbp voice $address($2,2) | c.update $2 | mode $chan -v $2 }
  146.     if (-keepop isin $3-) { remini %dbp keepop $address($2,2) | c.update $2 }
  147.     if (-protect isin $3-) { remini %dbp protect $address($2,2) | c.update $2 }
  148.     if (-manager isin $3-) { remini %dbp manager $address($2,2) | c.update $2 }
  149.     if (-suspend isin $3-) { remini %dbp suspend $address($2,2) 1 | c.update $2 }    
  150.   }
  151.   if ($1 == +infoline) {
  152.     writeini %dbp infoline $address($2,2) $3-
  153.     .timer 1 1 msg $chan Added infoline to $2 on $chan :: $3-
  154.   }
  155.   if ($1 == -infoline) {
  156.     remini %dbp infoline $address($2,2)
  157.     .timer 1 1 msg $chan Removed infoline From $2 on $chan
  158.   }
  159. }
  160.  
  161. on *:text:.who *:#:{
  162.   var %dbp = database\ $+ # $+ .ini
  163.   msg $chan Levels for $2 with this mask :: $address($2,2)
  164.   msg $chan $&
  165.     $iif($readini(%dbp, manager, $address($2,2)),3+manager,4-manager) $&    
  166.     $iif($readini(%dbp, infoline, $address($2,2)),3+infoline,4-infoline) $&    
  167.     $iif($readini(%dbp, op, $address($2,2)),3+autoop,4-autoop) $&    
  168.     $iif($readini(%dbp, voice, $address($2,2)),3+autovoice,4-autovoice) $&    
  169.     $iif($readini(%dbp, keepop, $address($2,2)),3+keepop,4-keepop) $&    
  170.     $iif($readini(%dbp, bot, $address($2,2)),3+bot,4-bot) $&
  171.     $iif($readini(%dbp, protect, $address($2,2)),3+protect,4-protect) $&
  172.     $iif($readini(%dbp, suspend, $address($2,2)),3+suspend,4-suspend)    
  173.   $iif($readini(%dbp, infoline, $address($2,2)),msg $chan Infoline: $readini(%dbp, infoline, $address($2,2)),$null)
  174. }
  175.  
  176. on *:TEXT:.mod *:#:{
  177.   var %dbp = database\ $+ # $+ .ini
  178.   if ($readini(%dbp, manager, $address($nick,2)) !== 1) {
  179.     msg $chan you need manager level to use this command.
  180.     HALT
  181.   }
  182.   if ($readini(%dbp, manager, $address($nick,2)) == 1) {
  183.     if (+bot isin $3-) { writeini %dbp bot $address($2,2) 1 | c.update $2 }
  184.     if (+autoop isin $3-) { writeini %dbp opj $address($2,2) 1 | c.update $2 | mode $chan +o $2 }
  185.     if (+autovoice isin $3-) { writeini %dbp voice $address($2,2) 1 | c.update $2 | mode $chan +v $2 }
  186.     if (+keepop isin $3-) { writeini %dbp keepop $address($2,2) 1 | c.update $2 }
  187.     if (+protect isin $3-) { writeini %dbp protect $address($2,2) 1 | c.update $2 }
  188.     if (+manager isin $3-) { writeini %dbp manager $address($2,2) 1 | c.update $2 }
  189.     if (+suspend isin $3-) { writeini %dbp suspend $address($2,2) 1 | c.update $2 }    
  190.     if (-bot isin $3-) { remini %dbp bot $address($2,2) | c.update $2 }
  191.     if (-autoop isin $3-) { remini %dbp op $address($2,2) | c.update $2 | mode $chan -o $2 }
  192.     if (-autovoice isin $3-) { remini %dbp voice $address($2,2) | c.update $2 | mode $chan -v $2 }
  193.     if (-keepop isin $3-) { remini %dbp keepop $address($2,2) | c.update $2 }
  194.     if (-protect isin $3-) { remini %dbp protect $address($2,2) | c.update $2 }
  195.     if (-manager isin $3-) { remini %dbp manager $address($2,2) | c.update $2 }
  196.     if (-suspend isin $3-) { remini %dbp suspend $address($2,2) 1 | c.update $2 }    
  197.   }
  198. }
  199.  
  200. on *:text:+infoline *:#:{
  201.   var %dbp = database\ $+ # $+ .ini
  202.   writeini $+(%dbp) infoline $address($nick,2) $2-
  203.   .notice $nick Added infoline to $nick on $chan :: $2-
  204. }
  205. on *:text:-infoline:#:{
  206.   remini $+(%dbp) infoline $address($nick,2)
  207.   .notice $nick Removed infoline From $nick on $chan
  208. }
  209.  
  210. #menus
  211.  
  212. menu nicklist {
  213.   [Userlist]
  214.   .Add
  215.   ..manager:writeini $+(database\,$chan,.ini) manager $address($$1,2) 1 | echo -a Added $$1 To manager level on $chan with this host: $address($$1,2) | mode $chan +o $$1
  216.   ..Op:writeini $+(database\,$chan,.ini) op $address($$1,2) 1 | echo -a Added $$1 To Op list on $chan with this host: $address($$1,2) | mode $chan +o $$1
  217.   ..Voice:writeini $+(database\,$chan,.ini) voice $address($$1,2) 1 | echo -a Added $$1 To Voice list on $chan with this host: $address($$1,2) | mode $chan +v $$1
  218.   ..KeepOp:writeini $+(database\,$chan,.ini) keepop $address($$1,2) 1 | echo -a Added $$1 To KeepOp list on $chan with this host: $address($$1,2) | mode $chan +o $$1
  219.   ..Protect:writeini $+(database\,$chan,.ini) protect $address($$1,2) 1 | echo -a Added $$1 To protect list on $chan with this host: $address($$1,2)
  220.   ..Bot:writeini $+(database\,$chan,.ini) bot $address($$1,2) 1 | writeini $+(database\,$chan,.ini) opjoin $address($$1,2) 1 | echo -a Added $$1 To Bot list on $chan with this host: $address($$1,2) | mode # +o $$1
  221.   .Remove
  222.   ..manager:remini $+(database\,$chan,.ini) manager $address($$1,2) | echo -a Removed $$1 From manager list on $chan with this host: $address($$1,2) | mode $chan -o $$1
  223.   ..Op:remini $+(database\,$chan,.ini) op $address($$1,2) | echo -a Removed $$1 From Op list on $chan with this host: $address($$1,2) | mode $chan -o $$1
  224.   ..Voice:remini $+(database\,$chan,.ini) voice $address($$1,2) | echo -a Removed $$1 From Voice list on $chan with this host: $address($$1,2) | mode $chan -v $$1  
  225.   ..KeepOp:remini $+(database\,$chan,.ini) KeepOp $address($$1,2) 1 | echo -a Removed $$1 From KeepOp list on $chan with this host: $address($$1,2)
  226.   ..Protect:remini $+(database\,$chan,.ini) protect $address($$1,2) 1 | echo -a Removed $$1 From protect list on $chan with this host: $address($$1,2)
  227.   ..Bot:remini $+(database\,$chan,.ini) bot $address($$1,2) 1 | echo -a Removed $$1 From Bot list on $chan with this host: $address($$1,2)
  228. }
  229.  
  230. menu channel {
  231.   [Userlist]
  232.   .Show
  233.   ..Managers:user.list manager  
  234.   ..Op:user.list op
  235.   ..Voice:user.list voice
  236.   ..Protect:user.list protect
  237.   ..Bots:user.list bot
  238. }
  239.  
  240. on *:LOAD:{
  241.   echo -a Userlist v5.2 Succesfully loaded
  242.   echo -a Make sure the folder database has been created. Type: //run database To verify.
  243.   echo -a if you see: * /run: unable to open file 'database' Then it failed.  (Will not usually fail)
  244.   echo -a Just type /mkdir database or open your mIRC folder (where mirc.exe is) and create it manually with read/write permissions
  245.   mkdir database
  246. }
RAW Paste Data
Top