Advertisement
Iire

(new) twitch points system - alpha

Aug 17th, 2014
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.35 KB | None | 0 0
  1. ; Xsczo's Twitch Points System
  2.  
  3. ; - - - - - - - - - - - - - - - - -
  4.  
  5. alias xtpconf {
  6.   if $isid { return $hget(XTPConf,$1) }
  7.   ;if $1 === -d { dialog -md xtpconf xtpconf }
  8.   else {
  9.     hfree -w XTPConf
  10.     hmake -s XTPConf 4
  11.     if $file(XTPConf.ini).longfn { hload -i XTPConf $qt($v1) config }
  12.     else {
  13.       writeini $qt(XTPConf.ini) config autopoints 1
  14.       writeini $qt(XTPConf.ini) config viewotherpoints 2
  15.       writeini $qt(XTPConf.ini) config gotpointslimit 10
  16.     }
  17.   }
  18. }
  19.  
  20. alias xtpoints {
  21.   if $isid { return $hget(XTPoints@ $+ [ $iif($2 != $null,$1 $chr(44) $2, $1) ] ) }
  22.   if $0 < 2 { echo -abcefg i * /xtpoints: insufficient parameters }
  23.   else {
  24.     var %h $+(XTPoints@,$iif(-* iswm $1,$2,$1))
  25.     if $1 === -l {
  26.       hfree -w %h
  27.       hmake %h $ceil($calc($iif($calc($ini(XTPoints.ini,$2,0)) > 100,$v1,100) / 0.39))
  28.       if $ini(XTPoints.ini,$2,0) { hload -i %h $qt(XTPoints.ini) $2 }
  29.     }
  30.     elseif $1 === -s && $hget(%h) { hsave -i %h $qt(XTPoints.ini) $2 }
  31.     else {
  32.       if $3 !isnum { echo -abcefg i * /xtpoints: invalid points amount }
  33.       else hadd %h $2 $iif($calc($hget(%h,$2) + $int($3)) > 0,$v1,0)
  34.     }
  35.   }
  36. }
  37.  
  38. alias -l xtpautotimers {
  39.   if $int($xtpconf(autopoints)) {
  40.     var %i 1
  41.     while $nick($1,%i) != $null {
  42.       if $v1 != $me { $+(.timerxtpoints:,$1:,$v1) 0 60 xtpoints $1 $v1 $int($xtpconf(autopoints)) }
  43.       inc %i
  44.     }
  45.   }
  46. }
  47.  
  48. ; - - - - - - - - - - - - - - - - -
  49.  
  50. on *:CONNECT:if *.twitch.tv iswm $~servertarget || $network == Twitch { xtpconf }
  51.  
  52. ; - - - - - - - - - - - - - - - - -
  53.  
  54. on *:JOIN:#:{
  55.   if *.twitch.tv !iswm $~servertarget && $network != Twitch { return }
  56.   if $nick == $me {
  57.     xtpoints -l #
  58.     .timer 1 0 xtpautotimers #
  59.   }
  60.   else {
  61.     if !$xtpoints(#) { xtpoints -l # }
  62.     if $int($xtpconf(autopoints)) {
  63.       xtpoints $nick $v1
  64.       $+(.timerxtpoints:,#,:,$nick) 0 60 xtpoints # $nick $v1
  65.     }
  66.   }
  67. }
  68.  
  69. on *:PART:#:{
  70.   if *.twitch.tv !iswm $~servertarget && $network != Twitch { return }
  71.   if $nick == $me {
  72.     xtpoints -s #
  73.     $+(.timerxtpoints:,#,:*) off
  74.     hfree -w XTPoints@ $+ #
  75.   }
  76.   else $+(.timerxtpoints:,#,:,$nick) off
  77. }
  78.  
  79. ; - - - - - - - - - - - - - - - - -
  80.  
  81. on *:TEXT:!xtpoints*:#:{
  82.   if *.twitch.tv !iswm $~servertarget && $network != Twitch { return }
  83.   if $hget(xtpflood,global) || $hget(xtpflood,$nick) { return }
  84.   hinc -mu5 xtpflood $nick
  85.   hinc -u3 xtpflood global
  86.   if $0 < 3 {
  87.     if $2 == $null { msg # You currently have $calc($xtpoints(#,$nick)) point(s), $nick $+ . }
  88.     else {
  89.       if $xtpconf(viewotherpoints) == 2 && $nick !isop # || !$xtpconf(viewotherpoints) { msg # Sorry, but you may not view other people's points, $nick $+ . }
  90.       else { msg # $2 currently has $calc($xtpoints(#,$2)) point(s). }
  91.     }
  92.   }
  93.   else {
  94.     if $nick !isop # { msg # You must be a moderator to give or take points, $nick $+ . }
  95.     else {
  96.       if $2 == $nick { msg # You cannot give or take points from yourself, $nick $+ ! }
  97.       elseif $2 !ison # { msg # That user is not in the channel. }
  98.       elseif $abs($3) !isnum $+(1-,$xtpconf(gotpointslimit)) { msg # Invalid points amount; please enter a number between (-)1 and (-) $+ $xtpconf(gotpointslimit) }
  99.       else {
  100.         xtpoints # $2 $int($3)
  101.         msg # $nick has $iif($3 < 0,taken $abs($int($3)) point(s) from,given $abs($int($3)) point(s) to) $2.
  102.       }
  103.     }
  104.   }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement