;#
;# visit http://sp00fed.org for updates or support.
;# script by Sumsar
;#
;# Trigger: !warn <nick> [Reason]
;# You must be operator on the channel.
;# There is set changeable default reasons, if you dont set one youself, reasons can be changes below.
;# There is no commando to remove a user from the database.
;# Tested and works on version 6.15
alias -l ::database { return warn }
alias -l ::file { return warn.hsh }
;# Warning 1
alias -l ::warn1 { return You did something wrong, stop it, before you get banned. }
;# Warning 2
alias -l ::warn2 { return You did something wrong, stop it, banned for 5 minuts. }
alias -l ::ban2 { return 300 }
;# Warning 3
alias -l ::warn3 { return You did something wrong, stop it, last chance, banned for 30 minuts. }
alias -l ::ban3 { return 1800 }
;# Warning 4
alias -l ::warn4 { return You have been permanently banned from this channel. }
;# Script
on *@:TEXT:!warn *:#: {
if ($2 ison $chan) {
if (!$hget($::database)) { if ($exists($::file)) { .hmake $::database 1000 | .hload $::database $::file } }
if ($nick isop $chan) {
var %n = $2,%h = $address($2,1),%r = $3-
if (!$hget($::database,$+(incr.,$chan,.,%h))) { .hadd -m $::database $+(incr.,$chan,.,%h) 1 } | else { .hinc -m $::database $+(incr.,$chan,.,%h) 1 }
if ($hget($::database,$+(incr.,$chan,.,%h)) == 1) {
.msg %n $iif($3-,$ifmatch,$::warn1)
}
elseif ($hget($::database,$+(incr.,$chan,.,%h)) == 2) {
.ban $+(-ku,$::ban2) $chan %n 1 $iif($3-,$ifmatch,$::warn2)
}
elseif ($hget($::database,$+(incr.,$chan,.,%h)) == 3) {
.ban $+(-ku,$::ban3) $chan %n 1 $iif($3-,$ifmatch,$::warn3)
}
elseif ($hget($::database,$+(incr.,$chan,.,%h)) == 4) {
.ban -k $chan %n 1 $iif($3-,$ifmatch,$::warn4)
.hadd -m $::database $+(banned.,$chan,.,%h) $iif($3-,$ifmatch,$::warn4)
.hdel $::database $+(incr.,$chan,.,%h)
}
.hsave -o $::database $::file
}
}
}
on *!@:JOIN:#: {
if (!$hget($::database)) { if ($exists($::file)) { .hmake $::database 1000 | .hload $::database $::file } }
if ($hget($::database,$+(banned.,$chan,.,$address($nick,1)))) { .ban -k $chan $nick 1 $hget($::database,$+(banned.,$chan,.,$address($nick,1))) }
}