Advertisement
westor

Twitch points system for ekwag v2.0

Feb 13th, 2016
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 6.63 KB | None | 0 0
  1. ON *:CONNECT: {
  2.   if (twitch isin $server) {
  3.     .raw CAP REQ :twitch.tv/membership
  4.     .raw CAP REQ :twitch.tv/commands
  5.     .raw CAP REQ :twitch.tv/tags
  6.   }
  7. }
  8.  
  9. ON *:TEXT:*:#: {
  10.   tokenize 32 $strip($1-)
  11.   if ($1 == !hours) {
  12.     if (%floodpoints) || (%floodpoints. [ $+ [ $nick ] ]) { return }
  13.     set -eu10 %floodpoints 1
  14.     set -eu30 %floodpoints. $+ $nick 1
  15.     if ($2) { var %p = $points($chan,$2) }
  16.     elseif (!$2) { var %p = $points($chan,$nick) }
  17.     var %tot = $floor($calc(%p / 12))
  18.     msg $chan ( $+ $nick $+ ): $iif($2,The  $+ $nick $+  nickname has,You have) %tot total hour(s) on the channel.
  19.   }
  20.   if ($1 == !mypoints) {
  21.     if (%floodpoints2) || (%floodpoints2. [ $+ [ $nick ] ]) { return }
  22.     set -eu10 %floodpoints2 1
  23.     set -eu30 %floodpoints2. $+ $nick 1
  24.     var %p = $points($chan,$nick)
  25.     if (!%p) { msg $chan ( $+ $nick $+ ): You have not any point earned yet! | return }
  26.     msg $chan ( $+ $nick $+ ): You have $iif(%p == 1, $+  $+ %p $+  point, $+  $+ %p $+  points) $+ .
  27.   }
  28.   if ($1 == !viewpoints) {
  29.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  30.     if (!$2) { msg $chan $nick ( $+ $nick $+ ): Error, Please specify an nickname! | return }
  31.     var %p = $points($chan,$2)
  32.     if (!%p) { msg $chan ( $+ $nick $+ ): Error, The  $+ $2 $+  nickname has NOT earned any point yet! | return }
  33.     msg $chan ( $+ $nick $+ ): The $2 user $iif(%p == 1,has  $+ %p $+  point,have  $+ %p $+  points) $+ .
  34.   }
  35.   if ($1 == !points) {
  36.     var %l = +,-,total
  37.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  38.     if (!$2) { msg $chan ( $+ $nick $+ ): Error, Please specify an option! - (Options:  $+ %l $+ ) | return }
  39.     if (!$istok(%l,$2,44)) { msg $chan ( $+ $nick $+ ): Error, Please specify an vaild option! - (Options:  $+ %l $+ ) | return }
  40.     if ($2 == +) {
  41.       if (!$3) { msg $chan ( $+ $nick $+ ): Error, Please specify a nickname! | return }
  42.       if (!$4) { msg $chan ( $+ $nick $+ ): Error, Please specify an number! | return }
  43.       if (!$isdig($4)) { msg $chan ( $+ $nick $+ ): Error, Please specify an digital number! | return }
  44.       points+ $chan $3 $4
  45.       msg $chan ( $+ $nick $+ ):  $+ $4 $+  points have been added to  $+ $3 $+  nickname.
  46.     }
  47.     if ($2 == -) {
  48.       if (!$3) { msg $chan ( $+ $nick $+ ): Error, Please specify a nickname! | return }
  49.       if (!$4) { msg $chan ( $+ $nick $+ ): Error, Please specify an number! | return }
  50.       if (!$isdig($4)) { msg $chan ( $+ $nick $+ ): Error, Please specify an digital number! | return }
  51.       points- $chan $3 $4
  52.       msg $chan ( $+ $nick $+ ):  $+ $4 $+  points have been removed from  $+ $3 $+  nickname.
  53.     }
  54.     if ($2 == total) {
  55.       var %f = $mircdirpoints\ $+ $mkfn($chan) $+ .db
  56.       var %t = $lines(%f)
  57.       if (%t) { msg $chan ( $+ $nick $+ ): There are  $+ %t $+  nicknames into the channel database. }
  58.       elseif (!%t) { msg $chan ( $+ $nick $+ ): There is NOT any user into the channel database yet! }
  59.     }
  60.   }
  61.   if ($1 == !top1) {
  62.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  63.     give_top 1 $chan $nick
  64.   }
  65.   if ($1 == !top3) {
  66.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  67.     give_top 3 $chan $nick
  68.   }
  69.   if ($1 == !top5) {
  70.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  71.     give_top 5 $chan $nick
  72.   }
  73.   if ($1 == !top10) {
  74.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  75.     give_top 10 $chan $nick
  76.   }
  77.   if ($1 == !top15) {
  78.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  79.     give_top 15 $chan $nick
  80.   }
  81.   if ($1 == !help) { msg $chan ( $+ $nick $+ ): Available Commands: !top1 - !top3 - !top5 - !top10 - !top15 - !points <+|-|total> <Nickname> <Points> - !viewpoints <Nickname> - !mypoints - !hours [Nickname] }
  82. }
  83.  
  84. ON *:PART:#: {
  85.   if ($nick !== $me) { .timer[points_ $+ $chan $+ _ $+ $nick $+ ] off }
  86.   elseif ($nick == $me) { .timer[points_ $+ $chan $+ _*] off }
  87. }
  88.  
  89. ON !*:JOIN:#:{
  90.   .timer[points_ $+ $chan $+ _ $+ $nick $+ ] 0 300 points+ $chan $nick 1
  91.   points+ $chan $nick 1
  92. }
  93.  
  94. alias points+ {
  95.   if ($0 !== 3) { return }
  96.   var %dir = $mircdirpoints
  97.   if (!$isdir(%dir)) { mkdir points }
  98.   var %f = $mircdirpoints\ $+ $mkfn($1) $+ .db
  99.   var %r = $read(%f,nw,* $+ $2 $+ *)
  100.   var %rn = $readn
  101.   var %p = $gettok(%r,2,32)
  102.   var %add = $calc(%p + $3)
  103.   if (%rn) { write -dl $+ %rn $qt(%f) | write $qt(%f) $2 %add }
  104.   elseif (!%rn) { write $qt(%f) $2 %add }
  105. }
  106.  
  107. alias points- {
  108.   if ($0 !== 3) { return }
  109.   var %f = $mircdirpoints\ $+ $mkfn($1) $+ .db
  110.   if (!$isfile(%f)) { return }
  111.   var %r = $read(%f,nw,* $+ $2 $+ *)
  112.   var %rn = $readn
  113.   var %p = $gettok(%r,2,32)
  114.   var %rem = $calc(%p - $3)
  115.   if (%rn) {
  116.     if (%rem) { write -dl $+ %rn $qt(%f) | write $qt(%f) $2 %rem }
  117.     elseif (!%rem) { write -dl $+ %rn $qt(%f) }
  118.   }
  119. }
  120.  
  121. alias points {
  122.   if ($0 !== 2) { return }
  123.   var %f = $mircdirpoints\ $+ $mkfn($1) $+ .db
  124.   if (!$isfile(%f)) { return 0 }
  125.   var %r = $read(%f,nw,* $+ $2 $+ *)
  126.   var %rn = $readn
  127.   var %p = $gettok(%r,2,32)
  128.   return $iif(%p,$v1,0)  
  129. }
  130.  
  131. alias give_top {
  132.   if (!$1-) { return }
  133.   var %win = @top_ $+ $2
  134.   var %db = $mircdirpoints\ $+ $mkfn($2) $+ .db
  135.   if (!$isfile(%db)) { return }
  136.   if ($window(%win)) { window -c %win }
  137.   window -hj $+ $lines(%db) %win
  138.   loadbuf %win $qt(%db)
  139.   filter -ceutww 2 32 %win %win
  140.   var %i = 1
  141.   while (%i <= $1) { var %list = $addtok(%list,%i $+ . $line(%win,%i),44) $iif(%i !== $1,-) | inc %i }
  142.   msg $2 ( $+ $3 $+ ): Top $1 point(s) are: $replace(%list,$chr(44),$+($chr(32)))
  143.   if ($window(%win)) { window -c %win }
  144. }
  145.  
  146. alias convert_points {
  147.   var %f = points.ini
  148.   var %dir = $mircdirpoints
  149.   if (!$isdir(%dir)) { mkdir points }
  150.   var %t = $lines(%f)
  151.   var %i = 1
  152.   while (%i <= %t) {
  153.     var %l = $read(%f,n,%i)
  154.     var %ii = $calc(%i +1)
  155.     var %c = $remove($gettok(%l,1,46),[)
  156.     var %n = $remove($gettok(%l,2,46),])
  157.     var %p = $remove($read(%f,n,%ii),Points=)
  158.     var %file = $mircdirpoints\ $+ $mkfn(%c) $+ .db
  159.     if (%n) && (%c) && (%p) { write $qt(%file) %n %p }
  160.     inc %i
  161.   }
  162.   echo 3 -a OK Finished!
  163. }
  164.  
  165. alias -l isdig {
  166.   if ($1 == $null) { return 0 }
  167.   if ($regex($1,^\d+$)) { return 1 }
  168.   else { return 0 }
  169. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement