Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Xsczo's Twitch Points System
- ; - - - - - - - - - - - - - - - - -
- alias xtpconf {
- if $isid { return $hget(XTPConf,$1) }
- ;if $1 === -d { dialog -md xtpconf xtpconf }
- else {
- hfree -w XTPConf
- hmake -s XTPConf 4
- if $file(XTPConf.ini).longfn { hload -i XTPConf $qt($v1) config }
- else {
- writeini $qt(XTPConf.ini) config autopoints 1
- writeini $qt(XTPConf.ini) config viewotherpoints 2
- writeini $qt(XTPConf.ini) config gotpointslimit 10
- }
- }
- }
- alias xtpoints {
- if $isid { return $hget(XTPoints@ $+ [ $iif($2 != $null,$1 $chr(44) $2, $1) ] ) }
- if $0 < 2 { echo -abcefg i * /xtpoints: insufficient parameters }
- else {
- var %h $+(XTPoints@,$iif(-* iswm $1,$2,$1))
- if $1 === -l {
- hfree -w %h
- hmake %h $ceil($calc($iif($calc($ini(XTPoints.ini,$2,0)) > 100,$v1,100) / 0.39))
- if $ini(XTPoints.ini,$2,0) { hload -i %h $qt(XTPoints.ini) $2 }
- }
- elseif $1 === -s && $hget(%h) { hsave -i %h $qt(XTPoints.ini) $2 }
- else {
- if $3 !isnum { echo -abcefg i * /xtpoints: invalid points amount }
- else hadd %h $2 $iif($calc($hget(%h,$2) + $int($3)) > 0,$v1,0)
- }
- }
- }
- alias -l xtpautotimers {
- if $int($xtpconf(autopoints)) {
- var %i 1
- while $nick($1,%i) != $null {
- if $v1 != $me { $+(.timerxtpoints:,$1:,$v1) 0 60 xtpoints $1 $v1 $int($xtpconf(autopoints)) }
- inc %i
- }
- }
- }
- ; - - - - - - - - - - - - - - - - -
- on *:CONNECT:if *.twitch.tv iswm $~servertarget || $network == Twitch { xtpconf }
- ; - - - - - - - - - - - - - - - - -
- on *:JOIN:#:{
- if *.twitch.tv !iswm $~servertarget && $network != Twitch { return }
- if $nick == $me {
- xtpoints -l #
- .timer 1 0 xtpautotimers #
- }
- else {
- if !$xtpoints(#) { xtpoints -l # }
- if $int($xtpconf(autopoints)) {
- xtpoints $nick $v1
- $+(.timerxtpoints:,#,:,$nick) 0 60 xtpoints # $nick $v1
- }
- }
- }
- on *:PART:#:{
- if *.twitch.tv !iswm $~servertarget && $network != Twitch { return }
- if $nick == $me {
- xtpoints -s #
- $+(.timerxtpoints:,#,:*) off
- hfree -w XTPoints@ $+ #
- }
- else $+(.timerxtpoints:,#,:,$nick) off
- }
- ; - - - - - - - - - - - - - - - - -
- on *:TEXT:!xtpoints*:#:{
- if *.twitch.tv !iswm $~servertarget && $network != Twitch { return }
- if $hget(xtpflood,global) || $hget(xtpflood,$nick) { return }
- hinc -mu5 xtpflood $nick
- hinc -u3 xtpflood global
- if $0 < 3 {
- if $2 == $null { msg # You currently have $calc($xtpoints(#,$nick)) point(s), $nick $+ . }
- else {
- if $xtpconf(viewotherpoints) == 2 && $nick !isop # || !$xtpconf(viewotherpoints) { msg # Sorry, but you may not view other people's points, $nick $+ . }
- else { msg # $2 currently has $calc($xtpoints(#,$2)) point(s). }
- }
- }
- else {
- if $nick !isop # { msg # You must be a moderator to give or take points, $nick $+ . }
- else {
- if $2 == $nick { msg # You cannot give or take points from yourself, $nick $+ ! }
- elseif $2 !ison # { msg # That user is not in the channel. }
- elseif $abs($3) !isnum $+(1-,$xtpconf(gotpointslimit)) { msg # Invalid points amount; please enter a number between (-)1 and (-) $+ $xtpconf(gotpointslimit) }
- else {
- xtpoints # $2 $int($3)
- msg # $nick has $iif($3 < 0,taken $abs($int($3)) point(s) from,given $abs($int($3)) point(s) to) $2.
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement