mIRC Home    About    Download    Register    News    Help

Print Thread
#157600 26/08/06 04:11 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Why does it turn off or disable when I add a new nick to be notify?

menu nicklist {
-
Notify BanList Settings
.Add Nick:set %bnn $$?="Nick To Add" | notify %bnn | write $scriptdir $+ NB.txt %bnn 2 | unset %bnn
.Remove Nick:set %bnn $$?="Nick To Remove" | notify -r %bnn | write -ds [ $+ [ %bnn ] ] $scriptdir $+ NB.txt | unset %bnn
.View Ban NickList:/run $scriptdir $+ NB.txt
}

#157601 26/08/06 04:28 PM
Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
Code:
menu nicklist {
-
Notify BanList Settings
.Add Nick:set %bnn $$?="Nick To Add" | notify %bnn | write [color:red]$scriptdir $+[/color] NB.txt %bnn 2 | unset %bnn
.Remove Nick:set %bnn $$?="Nick To Remove" | notify -r %bnn | write -ds [ $+ [ %bnn ] ] [color:red]$scriptdir $+[/color] NB.txt | unset %bnn
.View Ban NickList:/run [color:red]$scriptdir $+[/color] NB.txt
}

the red parts do not need to be there, it already writes to the directory, so, it'll write in the folder, without it, it seems to work.
try this:
Code:
menu nicklist {
  -
  Notify BanList Settings
  .Add Nick:set %bnn $$?="Nick To Add" | notify %bnn | write NB.txt %bnn 2 | unset %bnn
  .Remove Nick:set %bnn $$?="Nick To Remove" | notify -r %bnn | write -ds [ $+ [ %bnn ] ] NB.txt | unset %bnn
  .View Ban NickList:/run NB.txt
} 

Last edited by Kurdish_Assass1n; 26/08/06 04:31 PM.

-Kurdish_Assass1n
#157602 26/08/06 04:34 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
what "it" are you talking about?
Unrelated: you can avoid the need to unset %bnn by using var instead of set to create it.

You aren't trying to add a nick named 'off' to your notify list are you?

write $scriptdir $+ NB.txt %bnn 2
... will only add the correct mask if the nick is present, so perhaps you will want to instead have it use $$1 instead of entering the nick?

You'll need quotes if your $scriptdir contains a space in it.

#157603 26/08/06 04:43 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Quote:
the red parts do not need to be there, it already writes to the directory, so, it'll write in the folder, without it, it seems to work.


Kurdish, $scriptdir refers to the folder where the script being run is located - and is not always the same as $mircdir - but it is true that if he wants the .txt to be written into $mircdir that he should skip the references to the complete path when writing to the file.

#157604 26/08/06 04:44 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I only add the correct nick and it still turns off after i add a new nick. Here is all my code.

menu nicklist {
-
Notify BanList Settings
.Add Nick:set %bnn $$?="Nick To Add" | notify %bnn | write NB.txt %bnn 2 | unset %bnn
.Remove Nick:set %bnn $$?="Nick To Remove" | notify -r %bnn | write -ds [ $+ [ %bnn ] ] NB.txt | unset %bnn
.View Ban NickList:/run NB.txt
}

on @*:notify: {
if ( %bnn == off ) || ( %bnn == $null ) || ($nick isop #) { return }
if ( $read -s $+ $nick NB.txt == 2) {
if (($chan(1) != $null) && ($me isop $chan(1))) //ban $chan(1) $$1
if (($chan(2) != $null) && ($me isop $chan(2))) //ban $chan(2) $$1
if (($chan(3) != $null) && ($me isop $chan(3))) //ban $chan(3) $$1
if (($chan(4) != $null) && ($me isop $chan(4))) //ban $chan(4) $$1
if (($chan(5) != $null) && ($me isop $chan(5))) //ban $chan(5) $$1
if (($chan(6) != $null) && ($me isop $chan(6))) //ban $chan(6) $$1
if (($chan(7) != $null) && ($me isop $chan(7))) //ban $chan(7) $$1
if (($chan(8) != $null) && ($me isop $chan(8))) //ban $chan(8) $$1
if (($chan(9) != $null) && ($me isop $chan(9))) //ban $chan(9) $$1
if (($chan(10) != $null) && ($me isop $chan(10))) //ban $chan(10) $$1
if (($chan(11) != $null) && ($me isop $chan(11))) //ban $chan(11) $$1
if (($chan(12) != $null) && ($me isop $chan(12))) //ban $chan(12) $$1
}
}

Last edited by Garou; 26/08/06 04:47 PM.
#157605 26/08/06 05:16 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Quote:

on @*:notify: {
if ( %bnn == off ) || ( %bnn == $null ) || ($nick isop #) { return }
[snip]
}


The # symbol is undefined inside this event. Either pass it as a variable, or else assume you're wanting to do it with $active

#157606 26/08/06 05:20 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Same problem when I add or remove a nick it still turn off.

#157607 26/08/06 05:26 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Here's a little re-write of your code, and a quick test shows it to be working as expected.
Code:
 menu nicklist {
  -
  Notify BanList Settings
  .Add Nick: banlist add $$?="Nick To Add"
  .Remove Nick: banlist del $$?="Nick To Remove"
  .View Ban NickList:/run NB.txt
}
alias banlist {
  notify $iif($1 == del,-r) $2
  write $iif($1 == del,-ds $+ $2) nb.txt $2
}
on *:notify: {
  if ($read(NB.txt,s,$nick) == 2) {
    var %a = 1, %b = $chan(0)
    while %a <= %b {
      if ($me isop $chan(%a)) ban $chan(%a) $nick
      inc %a
    }
  }
}
 

#157608 26/08/06 05:43 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
RusselB Its the adding and removing fine but it doesnt set ban!!

Last edited by Garou; 26/08/06 05:57 PM.
#157609 26/08/06 11:46 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Found the problem, corrected, and then added a few little options, giving
Code:
on *:start:{
  if !$hget(NB) { .hmake NB 100 }
  if $exists(NB.txt) { .hload NB NB.txt }
}
on *:exit:{
  .hsave -o NB NB.txt
}
on *:disconnect:{
  .hsave -o NB NB.txt
}
menu nicklist {
  -
  Notify BanList Settings
  .Add Nick: banlist add $iif(!$snicks,$$?="Nick(s) To Add",$snicks)
  .Remove Nick: banlist del $iif(!$snicks,$$?="Nick To Remove",$snicks)
  .View Ban NickList:.hsave -o NB NB.txt | run NB.txt
}
alias banlist {
  var %nicks = $remove($replace($2-,$chr(32),$chr(44)),$me)
  while %nicks {
    notify $iif($1 == del,-r) $gettok(%nicks,1,44)
    .hadd -m NB $gettok(%nicks,1,44) $iif($1 == add,Banned)
    %nicks = $remtok(%nicks,$gettok(%nicks,1,44),1,44)
  }
}
on *:notify: {
  if $hget(NB,$nick) {
    var %a = 1, %b = $chan(0)
    while %a <= %b {
      if ($me isop $chan(%a)) {
        ban $iif($nick ison $chan(%a),-k) $chan(%a) $nick
      }
      inc %a
    }
  }
}
 


I realize there's a lot more code than originally, but I think you'll like the additions. Please review the code before using it so that you understand what I added, and why.

#157610 27/08/06 12:21 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Wow its pretty cool thx :P
Can you please remove the kick msg?
Just set ban no kick thx.

Last edited by Garou; 27/08/06 12:59 AM.
#157611 27/08/06 01:31 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Remove $iif($nick ison $chan(%a),-k) from the ban line

#157612 27/08/06 01:48 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Great stuff :P
One last thing can you add another line to clear banlist ?
To clear all in NB.txt ?

Last edited by Garou; 27/08/06 01:51 AM.
#157613 27/08/06 02:12 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Add this to the nicklist menu
Code:
 .Clear Ban NickList: .hfree NB | $iif($exists(NB.txt),remove NB.txt) 

#157614 27/08/06 02:21 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Great stuff thx.


Link Copied to Clipboard