mIRC Home    About    Download    Register    News    Help

Print Thread
#192889 12/01/08 05:10 AM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
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 }
}

Mpot #192896 12/01/08 09:32 AM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
|| 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 }

Collective #193229 16/01/08 11:01 PM
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
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.

Last edited by Mpot; 16/01/08 11:03 PM.
Mpot #193255 17/01/08 03:24 PM
Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
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


I refuse to engage in a battle of wits with an unarmed person. wink

Link Copied to Clipboard