; protectuser by teppuli
; Protect example your friends from getting deopped/kicked on channels
; Type /protect help to see commands
alias protect {
if ($1 == help) { echo -ag 7Usage: /protect channel add/del/list $chr($asc(|)) host add/del/list $chr($asc(|)) status enabled/disabled $chr($asc(|)) kickskin set/status $chr($asc(|)) help $chr($asc(|)) version | halt }
if ($1 == version) { echo -ag 7Version: protectuser by teppuli | halt }
if ($1 == channel) { protect.channel.process $2- | halt }
if ($1 == host) { protect.host.process $2- | halt }
if ($1 == status) { protect.status.process $2- | halt }
if ($1 == kickskin) { protect.kickskin.process $2- | halt }
echo -ag 7Usage: /protect channel add/del/list $chr($asc(|)) host add/del/list $chr($asc(|)) status enabled/disabled $chr($asc(|)) kickskin set/status $chr($asc(|)) help $chr($asc(|)) version
}
alias -l protect.status.process {
if (!$1) { echo -ag 7Usage: /protect status enabled/disabled | halt }
if ($1 == enabled) {
writeini protectusers.ini status status enabled
echo -ag 7Info: Protection succesfully enabled.
halt
}
if ($1 == disabled) {
writeini protectusers.ini status status disabled
echo -ag 7Info: Protection succesfully disabled.
halt
}
}
alias -l protect.kickskin.process {
if (!$1) { echo -ag 7Usage: /protect kickskin set/status | halt }
if ($1 == status) {
echo -ag 7Info: Current kickskin: $decodeCodes($protect.getskin)
halt
}
if ($1 == set) {
if (!$2) { echo -ag 7Error: Use /protect kickskin set <new skin> | echo -ag 7Note: Possible variables on skin: :protected: and :id: | halt }
echo -ag 7Info: Done.
writeini protectusers.ini settings kickskin $encodeCodes($2-)
halt
}
}
alias -l protect.channel.process {
if (!$1) { echo -ag 7Usage: /protect channel add/del/list | halt }
if ($1 == list) {
if ($ini(protectusers.ini,channels,0) == 0) || (!$ini(protectusers.ini,channels,0)) { echo -ag 7Error: No channels on list | halt }
echo -ag 7Info: Total $ini(protectusers.ini,channels,0) channels in protect channels list
echo -ag Channel list:
var %i = 1
while (%i <= $ini(protectusers.ini,channels,0)) {
echo -ag 7Channel: $ini(protectusers.ini,channels,%i)
inc %i
}
echo -ag End of list
halt
}
if ($1 == add) {
if (!$isValidChannel($2)) { echo -ag 7Error: Please specify valid channel. Example: #m00 | halt }
if ($readini(protectusers.ini,channels,$2) != $null) { echo -ag 7Error: Channel already added in list | halt }
writeini protectusers.ini channels $2 $ctime
echo -ag 7Info: Channel succesfully added to protect list. Total $ini(protectusers.ini,channels,0) channels in protect channels list
halt
}
if ($1 == del) {
if (!$isValidChannel($2)) { echo -ag 7Error: Please specify valid channel. Example: #m00 | halt }
if ($readini(protectusers.ini,channels,$2) == $null) { echo -ag 7Error: Channel isnt on list | halt }
remini protectusers.ini channels $2
echo -ag 7Info: Channel succesfully removed from protect list. Total $ini(protectusers.ini,channels,0) channels in protect channels list
halt
}
}
alias -l protect.host.process {
if (!$1) { echo -ag 7Usage: /protect host add/del/list | halt }
if ($1 == list) {
if ($ini(protectusers.ini,hosts,0) == 0) || (!$ini(protectusers.ini,hosts,0)) { echo -ag 7Error: No hosts on list | halt }
echo -ag 7Info: Total $ini(protectusers.ini,hosts,0) hosts in protect list
echo -ag Host list:
var %i = 1
while (%i <= $ini(protectusers.ini,hosts,0)) {
echo -ag 7Host: $ini(protectusers.ini,hosts,%i)
inc %i
}
echo -ag End of list
halt
}
if ($1 == add) {
if (!$isValidHost($2)) { echo -ag 7Error: Please specify valid hostname. Example: *!*@AndRew.goes.m00.com | halt }
if ($readini(protectusers.ini,hosts,$2) != $null) { echo -ag 7Error: Host already added in list | halt }
writeini protectusers.ini hosts $2 $ctime
echo -ag 7Info: Host succesfully added to protect list. Total $ini(protectusers.ini,hosts,0) hosts in protect list
halt
}
if ($1 == del) {
if (!$isValidHost($2)) { echo -ag 7Error: Please specify valid hostname. Example: *!*@m00.com | halt }
if ($readini(protectusers.ini,hosts,$2) == $null) { echo -ag 7Error: Host isnt on list | halt }
remini protectusers.ini hosts $2
echo -ag 7Info: Host succesfully removed from protect list. Total $ini(protectusers.ini,hosts,0) hosts in protect list
halt
}
}
alias protect.hostisinlist {
var %i = 1
while (%i <= $ini(protectusers.ini,hosts,0)) {
if ($ini(protectusers.ini,hosts,%i) iswm $1-) { return true }
inc %i
}
return false
}
alias -l protect.formatskin {
return $replace($1,:protected:,$2,:id:,$3)
}
alias -l protect.getskin {
return $iif($readini(protectusers.ini,settings,kickskin),$readini(protectusers.ini,settings,kickskin),Protected user: :protected: ID: :id:)
}
alias -l encodeCodes {
return $replace($1,$chr(3),ÿÿÿÿcÿÿÿÿ,$chr(2),ÿÿÿÿbÿÿÿÿ,$chr(31),ÿÿÿÿuÿÿÿÿ)
}
alias -l decodeCodes {
return $replace($1,ÿÿÿÿcÿÿÿÿ,$chr(3),ÿÿÿÿbÿÿÿÿ,$chr(2),ÿÿÿÿuÿÿÿÿ,$chr(31))
}
alias -l isValidHost {
return $iif(*!*@* iswm $1-,$true,$false)
}
on *:kick:#:{
if ($nick == Q) && ($network == QuakeNet) { halt }
if ($readini(protectusers.ini,status,status) != enabled) { halt }
if (!$readini(protectusers.ini,channels,$chan)) { halt }
if ($nick == $me) { halt }
if ($protect.hostisinlist($address($knick,5)) == false) { halt }
inc %userprotectid
if (Q ison $chan) {
msg Q TEMPBAN $chan $iif(*!*@*.quakenet.org iswm $address($nick,5),$address($nick,2),$address($nick,3)) 1w $decodeCodes($protect.formatskin($protect.getskin,$knick,%userprotectid))
}
mode $chan +b-o $iif(*!*@*.quakenet.org iswm $address($nick,5),$address($nick,2),$address($nick,3)) $nick
kick $chan $nick $decodeCodes($protect.formatskin($protect.getskin,$knick,%userprotectid))
}
on *:deop:#:{
if ($nick == Q) && ($network == QuakeNet) { halt }
if ($readini(protectusers.ini,status,status) != enabled) { halt }
if (!$readini(protectusers.ini,channels,$chan)) { halt }
if ($nick == $me) { halt }
if ($protect.hostisinlist($address($opnick,5)) == false) { halt }
inc %userprotectid
if (Q ison $chan) {
msg Q TEMPBAN $chan $iif(*!*@*.quakenet.org iswm $address($nick,5),$address($nick,2),$address($nick,3)) 1w $decodeCodes($protect.formatskin($protect.getskin,$opnick,%userprotectid))
}
mode $chan +ob-o $opnick $iif(*!*@*.quakenet.org iswm $address($nick,5),$address($nick,2),$address($nick,3)) $nick
kick $chan $nick $decodeCodes($protect.formatskin($protect.getskin,$opnick,%userprotectid))
}