mIRC Home    About    Download    Register    News    Help

Print Thread
#190718 24/11/07 11:55 PM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
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.
Buggs2008 #190724 25/11/07 04:00 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
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#

Code:
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.

Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Lpfix5 #190725 25/11/07 04:54 AM
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
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
Wims #190727 25/11/07 05:51 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Fixed :p


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Buggs2008 #190781 26/11/07 02:46 AM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
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 laugh

Buggs2008 #190782 26/11/07 02:52 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
blush :P


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Buggs2008 #190784 26/11/07 03:21 AM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
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.

Buggs2008 #190785 26/11/07 05:09 AM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
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

Code:
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


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Buggs2008 #190787 26/11/07 06:10 AM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
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 wink

Cheers and have a nice day!

- J

Buggs2008 #190802 26/11/07 02:42 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
I love playing with .txt files laugh


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }

Link Copied to Clipboard