|
Joined: Oct 2007
Posts: 214
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2007
Posts: 214 |
Hello,
I have this code but I would like to create an alias to del the user from the blacklist.
the format would be: $blacklist(del,$gettok($ial($$2,1),1,64))
alias blacklist { if ($1 == check) { var %addr = $gettok($ial($$2,1),1,64) var %line = $read($scriptdirblacklist.txt,w,%addr) if (%line) return $true else return $false } elseif ($1 == set) { if (!$isfile(blacklist.txt)) write -c blacklist.txt var %addr = $gettok($ial($$2,1),1,64) var %line = $read($scriptdirblacklist.txt,w,%addr) if (!%line) write $scriptdirblacklist.txt $gettok($ial($$2,1),1,64) $3- } }
on 1:join:#:{ if ($blacklist(check,$nick) == $true) { kick # $nick : [-BlackListed-] } }
Any help is greatly appreciated.
Thanks a bunch.
J
Last edited by Buggs2008; 24/11/07 11:56 PM.
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
Um (I just replaced vars around so they arew not called 1 million times) and I use the same format of your picked to delete the user with Write -dl#
alias blacklist {
if ($$1) {
var %addr = $gettok($ial($$2,1),1,64)
var %line = $read($scriptdirblacklist.txt,w,%addr)
if ($1 == check) {
if (%line) return $true
else return $false
}
elseif ($1 == set) {
if (!$isfile(blacklist.txt)) write -c blacklist.txt
if (!%line) write $scriptdirblacklist.txt $gettok($ial($$2,1),1,64) $3-
}
elseif ($1 == del) {
if (!$isfile(blacklist.txt)) write -c blacklist.txt
if (!%line) .write $+(-dl,$readn) $scriptdirblacklist.txt
}
}
else { echo 4 ERROR: Incorrect Syntax Use }
} EDIT: FIXED $scriptdirblacklist.txt
Last edited by Lpfix5; 25/11/07 05:14 AM.
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Jul 2006
Posts: 4,149
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,149 |
I think you forgot some $scriptdir and a "blacklist.txt"
Edit : the OP himself don't use $scriptdir at some point ...
Last edited by Wims; 25/11/07 04:58 AM.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Oct 2007
Posts: 214
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2007
Posts: 214 |
Hello I just wanted to give a big thanks to everyone who helped me on this. You guys are god saint Thanks a bunch Cheers - J
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
:P
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Oct 2007
Posts: 214
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2007
Posts: 214 |
I was trying to play around with it, it works perfectly to delete the user from the blacklist on one condition -> They are in the channel,
however how could I modify this code such that it would be possible to delete user when they are not in the channel, but rather in the database itself?
alias blacklist { if ($$1) { var %addr = $gettok($ial($$2,1),1,64) var %line = $read($scriptdirblacklist.txt,w,%addr) if ($1 == check) { if (%line) return $true else return $false } elseif ($1 == set) { if (!$isfile(blacklist.txt)) write -c blacklist.txt if (!%line) write $scriptdirblacklist.txt $gettok($ial($$2,1),1,64) $3- } elseif ($1 == del) { if (!%line) { echo -a ***** Error: $chr(91) %addr $chr(93) is not listed in the [-BlackList-] | halt } elseif (%line) { write -dl $readn $scriptdirblacklist.txt echo -a 4***** $chr(91) $+ %addr $+ $chr(93) deleted from blacklist ***** } } } }
Thanks a bunch.
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
Um, a quick fix to your answer is Adding a var and using that var for that section and to call up the search terms of identifier $2 to scan file for matches (If match return then) it deletes data from file weather he/she is on #channel
alias blacklist {
if ($$1) {
var %addr = $gettok($ial($$2,1),1,64)
var %line = $read($scriptdirblacklist.txt,w,%addr)
if ($1 == check) { echo -a $iif(%line,$true,$false) }
elseif ($1 == set) {
if (!%line) write $scriptdirblacklist.txt %addr $3- }
elseif ($1 == del) {
var %del = $read($scriptdirblacklist.txt,w,$+(*,$$2,*))
if (!%del) { echo -a ***** Error: $chr(91) %addr $chr(93) is not listed in the [-BlackList-] | halt }
elseif (%del) {
write $+(-dl,$readn) $scriptdirblacklist.txt
echo -a 4***** $chr(91) $+ %addr $+ $chr(93) deleted from blacklist *****
}
}
}
} enjoy
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Oct 2007
Posts: 214
Fjord artisan
|
OP
Fjord artisan
Joined: Oct 2007
Posts: 214 |
Wow, Thanks for the fast reply, everything works fine now. Thanks again, I really appreciate it, im very glad this forum has lots of mIRC experts Cheers and have a nice day! - J
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
I love playing with .txt files
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
|