mIRC Homepage
Posted By: Mpot on BAN erro - 12/01/08 05:10 AM
My bot is programmed with the ability to protect itself from bannings as well as users in it's userlist with level protect. The script works, for the most part, except for the fact that the bot seems to be registering protected users as itself and doing a /msg chanserv unban $chan instead of a /mode $chan -b $banmask. Any ideas on what's up?

Here's the full address of myself and the friend I was testing user protection on:

Me:

Code:
Mpot is ~Mpot@adsl-065-007-137-149.sip.asm.bellsouth.net * Mpot


Friend:

Code:
J711 is jbarron711@adsl-68-75-52-26.dsl.emhril.ameritech.net * J711


Script:

Code:
on *:BAN:#:{
  if (%selfprotect == on && $banmask == $address($me,1) || $address($me,2) || $address($me,3) || $address($me,4) || $address($me,5) || $address($me,6) || $address($me,7) || $address($me,8) || $address($me,9)) { /msg chanserv unban $chan }
  elseif (%userprotect == on && protect isin $level($mask($banmask,1)) || $level($mask($banmask,2)) || $level($mask($banmask,3)) || $level($mask($banmask,4)) || $level($mask($banmask,5)) || $level($mask($banmask,6)) || $level($mask($banmask,7)) || $level($mask($banmask,8)) || $level($mask($banmask,9))) { /mode $chan -b $banmask }
}
Posted By: Collective Re: on BAN erro - 12/01/08 09:32 AM
|| is for separating conditions, not parameters to conditions. For example:
if ( $1- == hello || goodbye ) { }
will be parsed as:
if ( $1 == hello ) || ( goodbye ) { }
That /if statement will always be true, as "goodbye" is not $null, $false or 0.

In this case you can avoid the problem entirely by using:
if ( $banmask iswm $address($me,5) ) { dostuff }
Posted By: Mpot Re: on BAN erro - 16/01/08 11:01 PM
I don't understand the difference between iswm and isin. It appears that iswm is match, not just a partial. That wouldn't work, because someone could simpled ban my nick, or alter the banmask to still ban me, but not equal my full address.
Posted By: CtrlAltDel Re: on BAN erro - 17/01/08 03:24 PM
Quote:
from the help files:
isin string v1 is in string v2
iswm wildcard string v1 matches string v2

isin requires the banmask (v1) to match your address (v2) exactly

iswm will cover either banmask:
*!*@*.asm.bellsouth.net
or
*!*Mpot@adsl-065-007-137-149.sip.asm.bellsouth.net
as v1 to match v2
mpot!Mpot@adsl-065-007-137-149.sip.asm.bellsouth.net
© mIRC Discussion Forums