alias selected {
var %counter = 1
var %count = $snick($chan,0)
var %first = $snick($chan, 1)
var %boolean = $hfind(pmusers, %first)
while (%counter <= %count) {
var %nick = $snick($chan, %counter)
if (%boolean != %first) {
hadd pmusers %nick %nick
if (%count == 1 ) {
.notice $me %nick added to PM access database.
}
if (%counter == %count && %count > 1) {
.notice $me Selected group added to PM access database.
}
}
if (%boolean == %first ) {
hdel -w pmusers %nick
if (%count == 1) {
.notice $me Removed %nick from PM access database.
}
if (%counter == %count && %count > 1) {
.notice $me Removed selected group from PM access database.
}
}
inc %counter
}
}
menu nicklist {
$iif($hget(pmusers) == $null, PM rights)
. Create access rights database {
hmake pmusers 100
.notice $me PM access database created.
}
$iif($hget(pmusers) != $null, PM rights)
. $iif($hfind(pmusers, $snick($chan,1)) != $snick($chan,1), Give, Remove): selected
.-
. Remove access database {
hfree -w pmusers
.notice $me PM access database destroyed.
}
}
on *:LOAD: {
hmake pmusers 100
hload pmusers pmusers.txt
}
on *:EXIT: {
hsave pmusers pmusers.txt
}
on ^*:OPEN:?:*:{
if ($hget(pmusers) != $null) {
var %pm $comchan($nick,0)
var %boolean 0
while (%pm) {
if ($nick isop $comchan($nick,%pm)) {
inc %boolean
return
}
dec %pm
}
if ($nick != $hget(pmusers, $nick) && %boolean == 0) {
.notice $me $nick just tried to sen PM with starting word: $1
.notice $nick Sorry, unknown PM messages are not allowed and not received. Please ask privlidges in main chat.
halt
}
else {
msg $nick Hello, I got your message and will try to respond to you ASAP.
}
}
}
on 1:INPUT:?: {
if ($active != $hget(pmusers, $active)) {
hadd pmusers $active $active
}
}