mIRC Homepage
Posted By: varul i need help please ! - 27/10/03 08:22 AM
hello .. i am trying to make a black-list script over a week and i dont know what is the problem ... it should normally work
Here is it :

on 10:TEXT:!blist *:#: { //mode $chan -o $2 //mode $chan +b $address($2,3) | //kick $chan $2 0,4! 0,2Blacklisted 0,4! | //write blist\blist.txt $address($2,3) }
on *:JOIN:#kappa:{
var %blist = $read(blist\blist.txt, s, $address($nick,3))
if (%blist == $null) { notice $nick 0,4Welcome to  $chan  }
else { //mode $chan -o $nick | //mode $chan +b $address($nick,3) | //kick $chan $nick 0,4! 0,2Blacklisted 0,4! }
}


Does anyone have any ideea why doesnt it work ? confused
Posted By: J0ke Re: i need help please ! - 27/10/03 09:22 AM
quick edit...

Code:
on 10:TEXT:!blist*:#:{
  mode $chan -o+b $2 $address($2,3)
  kick $chan $2 0,4! 0,2Blacklisted 0,4!
  write blist\blist.txt $address($2,3)
}
on *:JOIN:#kappa:{ 
  var %blist = $read(blist\blist.txt, w, $address($nick,3))
  if (!%blist) { notice $nick 0,4Welcome to  $chan  } 
  else {
    mode $chan -o+b $nick $address($nick,3)
    kick $chan $nick 0,4! 0,2Blacklisted 0,4!
  }
}

;if using mIRC 6.12
on 10:TEXT:!blist*:#:{
  mode $chan -o $2
  ban -k $chan $2 3 0,4! 0,2Blacklisted 0,4!
  write blist\blist.txt $address($2,3)
}
on *:JOIN:#kappa:{ 
  var %blist = $read(blist\blist.txt, w, $address($nick,3))
  if (!%blist) { notice $nick 0,4Welcome to  $chan  } 
  else {
    mode $chan -o $nick
    ban -k $chan $2 3 0,4! 0,2Blacklisted 0,4!
  }
}
Posted By: krunch Re: i need help please ! - 27/10/03 02:25 PM
i find
$read(blist\blist.txt, w, * $+ $address($nick,3) $+ *)
works alot better
Posted By: varul Thx joke but still doesnt work - 28/10/03 07:33 AM
It still doesnt work... only the first part works and by that i mean when i say !blist someone it ban-kicks him but when he rejoins nothing hapens.i think it has to do whit the variable
%blist smirk.. do you still have another ideea ??
Posted By: LocutusofBorg Re: Thx joke but still doesnt work - 28/10/03 08:55 AM
Just out of curiosity, why are you using a txt file? mIRC has a userlist feature which is more than adequate for this.
Code:
[color:green]; code to add a user[/color]
[color:green]; syntax: !blist <nick> <reason>[/color]
on [color:blue]@[/color]10:TEXT:!blist*:#: {
  [color:green]; This checks if the specified nick is on the channel[/color]
  if ($2 ison #) {
    [color:green]; if so, it adds him[/color]
    [color:green]; format: *!*identd@*.host.domain #channel reason[/color]
    .guser BLIST $2 3 $chan $3-
    [color:green]; and of course it removes him, kicking with the specified reason[/color]
    ban -k # $2 3 $3-
  }
}
[color:blue] [/color]
[color:green]; When a user matching a banned address joins[/color]
on @BLIST:JOIN:#: {
  [color:green]; check if he is banned on the channel he joined in[/color]
  if ($gettok($ulist($address($nick,3)).info,1,32) == $chan) {
    [color:green]; if so, then remove him with the pre-specified reason[/color]
    ban -k # $nick 3 $gettok($ulist($address($nick,3)).info,2-,32) 
  }
}

note: these two events are only triggered when you are opped. The second is pointless if you are not, but if you want to allow people to blacklist users even when you are not opped, remove the blue @. I am also assuming you work with 6.12 here.

note2: if you rather not rely on the userlist (it occasionally gets wiped, although you can of course add code to the first event to auto-back it up when a user gets added), you might wanna consider using a hash table (same but), or a ini file.
Posted By: varul hmmm... - 28/10/03 09:42 AM
i have mirc 6.03 ... and that is exaclty the point ... it makes no fun working with predefined mirc variables ... i would appreciate if you could help me with MY script smile . thx
Posted By: LocutusofBorg Re: hmmm... - 28/10/03 09:58 AM
The only difference is that I'm not sure if 6.03 supports the -k flag in the ban. If not, use the following to replace the one ban line and it will work:

Code:
ban # $nick 3 
kick # $nick $gettok($ulist($address($nick,3)).info,2-,32


As for the rest, it shouldn't be that hard to use

Code:
write filename.txt $address($1,3) $chan $3-


instead of the guserline, and

Code:
if ($read(filename.txt,s,$address($nick,3))) { kickban here }


to match in the on join line. It's merely a helluva lot simpler to match entries when you add them to the userlist. And why re-invent the wheel?

Code:
on @*:JOIN:#: {
  [color:green]; if the user exists, kickban[/color]
  if ($read(filename.txt,s,$address($nick,3))) { 
    ban # $nick 3 
    kick # $nick $gettok($ulist($address($nick,3)).info,2-,32
  }  
  [color:green]; otherwise welcome him[/color]
  else {  
    .notice $nick Welcome to $chan ! 
  }
}
Posted By: varul got it :) - 29/10/03 09:56 AM
it finally works smile) thx m8s smile
© mIRC Discussion Forums