Advertisement
westor

Points system for ekwag v1.0

Feb 12th, 2016
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.15 KB | None | 0 0
  1. alias convert_points {
  2.   var %f = points.ini
  3.   var %dir = $mircdirpoints
  4.   if (!$isdir(%dir)) { mkdir points }
  5.   var %t = $lines(%f)
  6.   var %i = 1
  7.   while (%i <= %t) {
  8.     var %l = $read(%f,n,%i)
  9.     var %ii = $calc(%i +1)
  10.     var %c = $remove($gettok(%l,1,46),[)
  11.     var %n = $remove($gettok(%l,2,46),])
  12.     var %p = $remove($read(%f,n,%ii),Points=)
  13.     var %file = $mircdirpoints\ $+ $mkfn(%c) $+ .db
  14.     if (%n) && (%c) && (%p) { write $qt(%file) %n %p }
  15.     inc %i
  16.   }
  17.   echo 3 -a OK Finished!
  18. }
  19.  
  20. ON *:CONNECT: {
  21.   if (twitch isin $server) {
  22.     .raw CAP REQ :twitch.tv/membership
  23.     .raw CAP REQ :twitch.tv/commands
  24.     .raw CAP REQ :twitch.tv/tags
  25.   }
  26. }
  27.  
  28. ON *:TEXT:*:#: {
  29.   tokenize 32 $strip($1-)
  30.   if ($1 == !hours) {
  31.     if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  32.     set -u10 %floodpoints On
  33.     set -u30 %floodpoints. $+ $nick On
  34.     var %f = $mircdirpoints\ $+ $mkfn($chan) $+ .db
  35.     var %r = $read(%f,* $+ $nick $+ *)
  36.     var %p = $gettok(%r,2,32)
  37.     msg $chan $nick has $floor($calc(%p / 12)) total hour(s) on the channel.
  38.   }
  39.   if ($1 == !points) {
  40.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  41.     if (!$2) { msg $chan $nick ( $+ $nick $+ ): Error, Please specify n nickname! | return }
  42.     var %f = $mircdirpoints\ $+ $mkfn($chan) $+ .db
  43.     var %r = $read(%f,* $+ $nick $+ *)
  44.     if (!%r) { msg $chan ( $+ $nick $+ ): Error, The $qt($2) nickname does NOT exists into the database! | return }
  45.     var %p = $gettok(%r,2,32)
  46.     msg $chan ( $+ $nick $+ ): The $qt($2) user $iif(%p == 1,has  $+ %p $+  point,have  $+ %p $+  points) $+ .
  47.   }
  48.   if ($1 == !top3) {
  49.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  50.     give_top 3 $chan
  51.   }
  52.   if ($1 == !top5) {
  53.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  54.     give_top 5 $chan
  55.   }
  56.   if ($1 == !top10) {
  57.     if ($nick !isop $chan) { msg $chan ( $+ $nick $+ ): Error, This command is only available to moderators! | return }
  58.     give_top 10 $chan
  59.   }
  60. }
  61.  
  62. ON !*:PART:#: { .timer[points_ $+ $chan $+ _ $+ $nick $+ ] } off
  63. ON !*:JOIN:#:{
  64.   .timer[points_ $+ $chan $+ _ $+ $nick $+ ] 0 300 add.pts $chan $nick
  65.   add.pts $chan $nick
  66. }
  67.  
  68. alias add.pts {
  69.   var %dir = $mircdirpoints
  70.   if (!$isdir(%dir)) { mkdir points }
  71.   var %f = $mircdirpoints\ $+ $mkfn($1) $+ .db
  72.   var %r = $read(%f,* $+ $2 $+ *)
  73.   var %rn = $readn
  74.   if (%rn) { write -dl $+ %rn | write $qt(%f) $2 $calc(%r + 1) }
  75.   elseif (!%rn) { write $qt(%f) $2 $calc(%r + 1) }
  76. }
  77.  
  78. alias give_top {
  79.   if (!$1-) { return }
  80.   var %win = @top_ $+ $2
  81.   var %db = $mircdirpoints\ $+ $mkfn($2) $+ .db
  82.   if ($window(%win)) { window -c %win }
  83.   window -hj $+ $lines(%db) %win
  84.   loadbuf %win $qt(%db)
  85.   filter -ceutww 2 32 %win %win
  86.   var %i = 1
  87.   while (%i <= $1) {
  88.     var %list = $addtok(%list,%i $+ . $line(%win,%i),44) $iif(%i !== $1,-)
  89.     inc %i
  90.   }
  91.   echo msg $2 Top $1 point(s) are: $replace(%list,$chr(44),$+($chr(32)))
  92.   if ($window(%win)) { window -c %win }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement