;!subscribe 2.0 mutha
;By Panda200x
on *:join:#mafbot:if ($nick == $me && MafBot ison # || Mafia ison #) { hadd mafbot2 on text }
on *:start: {
window @mafbot
echo @mafbot Loaded.
.hmake mafbot 100
.hmake mafbot2 100
if ($isFile(mafbot.hsh)) { .hload mafbot mafbot.hsh }
if ($isFile(mafbot2.hsh)) { .hload mafbot2 mafbot2.hsh }
.timermafbot 0 300 .hsave -o mafbot mafbot.hsh
.timermafbot2 0 300 .hsave -o mafbot mafbot2.hsh
}
on *:exit: {
.hsave -o mafbot2 mafbot2.hsh
.hsave -o mafbot mafbot.hsh
.hfree mafbot
.hfree mafbot2
}
on *:mode:#mafbot: { if ($hget(mafbot) && $1 == -m && $address($nick,2) == *!*@Mafia.Bot && $hget(mafbot2,on) == -m) { mafbot-notify } }
on *:text:The* *IRC-game*:#mafbot: { if ($hget(mafbot) && $address($nick,2) == *!*@Mafia.Bot && $hget(mafbot2,on) == text) { mafbot-notify | hadd mafbot on -m } }
on *:quit:if ($hget(mafbot2) && $address($nick,2) == *!*@Mafia.Bot) { hadd mafbot on text | halt } | if ($hget(mafbot,$nick) ) { hdel -w mafbot $nick }
on *:disconnect:.hsave -o mafbot mafbot.hsh | .hsave -o mafbot2 mafbot2.hsh
raw 401:* { if ($hget(mafbot,$1)) { hdel mafbot $2 } }
;MafBot Notify Alias
alias mafbot-notify {
var %x = 1
while (%x <= $hget(mafbot,0).item) {
set %y $hget(mafbot,%x).item
if ($hget(mafbot,%y) == 1) { msg $hget(mafbot,%x).item [MAFBOT] A New Game in MafBot has started! (#MafBot) | notice $hget(mafbot,%x).item [MAFBOT] A New Game in MafBot has started! (#MafBot) | hinc mafbot2 %y }
if ($hget(mafbot,%y) == 2) { msg %y [MAFBOT] A New Game in MafBot has started! (#MafBot) | hinc mafbot2 %y }
if ($hget(mafbot,%y) == 3) { notice %y [MAFBOT] A New Game in MafBot has started! (#MafBot) | hinc mafbot2 %y }
if ($hget(mafbot2,%y) == 5) { msg %y [MAFBOT] Your subscription ran out. Please use !subscribe to re-subscribe. | hdel -w mafbot %y }
if ($rand(0,5) <= 2) { msg %y [MAFBOT] Like subscribe? /msg Mafia !give Panda200x 111 :D }
inc %x
}
}
;Debug - Echos it all out
alias mafbot-debug {
if (!$window(@mafbot)) { window @mafbot }
else {
echo @mafbot $time $date - MafBot Debug
var %x = 1
while (%x <= $hget(mafbot).size) {
var %y = $hget(mafbot,%x).item
echo @mafbot $hget(mafbot,%x).item - $hget(mafbot,%y)
inc %x
}
var %y = 1
while (%y <= $hget(mafbot2).size) {
var %x = $hget(mafbot,%x).item
echo @mafbot $hget(mafbot2,%x).item - $hget(mafbot2,%y)
inc %y
}
}
}
;Ban
alias banned {
if ($hget(mafbot,$+($1,-b)) { echo @mafbot [MAFBOT] $1 already banned. (Reason: $hget(mafbot,$+($1,-b).item $+ ) }
else {
.hdel -w mafbot $1
.hadd mafbot $+($1,-b) $2-
echo -s [MAFBOT] Sucessfully Banned - $1 $+ .
}
}
;On Text :D
on *:text:!subscribe*:*: {
if ($hget(mafbot,$nick)) { .notice $nick [MAFBOT] You are already subscribed! | halt }
elseif ($hget(mafbot,$+($nick,-b))) { .notice $nick [MAFBOT] You are banned. Reason: $hget(mafbot,$+($nick,-b) | halt }
else {
.hadd mafbot $nick $iif($3 == $null || $3 == Both,1,$hget(mafbot,$3).item)
.hadd mafbot2 $+($nick,-use) 5
notice $nick [MAFBOT] Subscribed - You will be notified for 5 games.
}
}
on *:text:!unsubscribe*:*: {
if (!$hget(mafbot,$nick)) { .notice $nick [MAFBOT] You aren't subscribed. | halt }
elseif ($hget(mafbot,$+($nick,-b))) { .notice $nick [MAFBOT] You are banned. Reason: $hget(mafbot,$+($nick,-b) | halt }
else {
.hdel -w mafbot $nick
notice $nick [MAFBOT] UnSubscribed - Use !subscribe if you wish to subscribe. }
}
on *:text:!both:*: {
if (!$hget(mafbot,$nick)) { .notice $nick [MAFBOT] You aren't subscribed. | halt }
elseif ($hget(mafbot,$+($nick,-b))) { notice $nick [MAFBOT] You are banned. Reason: $hget(mafbot,$+($nick,-b) | halt }
elseif ($hget(mafbot,$nick).item) == 1) { notice $nick [MAFBOT] You are already on this option. | halt }
else { .hadd mafbot $nick 1 | notice $nick [MAFBOT] You are now on the Both option. (Private Messages and Notices) }
}
on *:text:!notice:*: {
if (!$hget(mafbot,$nick)) { notice $nick [MAFBOT] You aren't subscribed. | halt }
elseif ($hget(mafbot,$+($nick,-b))) { notice $nick [MAFBOT] You are banned. Reason: $hget(mafbot,$+($nick,-b) | halt }
elseif ($hget(mafbot,$nick).item) == 3) { notice $nick [MAFBOT] You are already on this option. | halt }
else { .hadd mafbot $nick 3 | notice $nick [MAFBOT] You are now on the Notice-only option. }
}
on *:text:!privmsg:*: {
if (!$hget(mafbot,$nick)) { notice $nick [MAFBOT] You aren't subscribed. | halt }
elseif ($hget(mafbot,$+($nick,-b))) { notice $nick [MAFBOT] You are banned. Reason: $hget(mafbot,$+($nick,-b) | halt }
elseif ($hget(mafbot,$nick).item) == 2) { notice $nick [MAFBOT] You are already on this option. | halt }
else { .hadd mafbot $nick 2 | notice $nick [MAFBOT] You are now on the Private Message-Only option. }
}