Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Gangz on October 15, 2003, 02:30 AM

Title: Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 02:30 AM
 :'( I have spent litterally hours triing to do ip bans and wildcards in vb if anyone can help me please reply or whisper me at Gangz@uswest. thnx much
Title: Re:Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 03:41 AM
I spent like 2 hours surfing through the Previous posts to see what i can find....As of ip bans i can make it ignore right before it bans, but I Do not understand how to make it check the flags when users join to ban it..


..as of wildcards i found the script

If Lcase(username) Like "a" Then
CleanSlateBot1.Send "/ban " & Username

I was wondering if this would work if i added it to the bans and kicks...or does "a" need to be substituted with something else...

I know im not to far from learning these commands..All help is much appreciated
Title: Re:Wildcards and Ip bans
Post by: WiLD on October 15, 2003, 04:18 AM
Ok this is for CSB, i used it when i made a quick bot 2 hold ops and ban every1 that entered i change i took over =P

If Form1.chkIPBan = vbChecked And Flags = &H20 Then
CleanSlateBot2.Send "/ban " & Username & " IP Banned"
End If

if you want it to ALWAYS be on just remove the "Form1.chkIPBan = vbChecked And" so it looks like this;

If Flags = &H20 Then
CleanSlateBot2.Send "/ban " & Username & " IP Banned"
End If

Quiet easy, but we all have to start somewhere.
Title: Re:Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 01:55 PM
tHNX WILd
Title: Re:Wildcards and Ip bans
Post by: Banana fanna fo fanna on October 15, 2003, 02:00 PM
You have to squelch them first.
Title: As usual, people doing it wrong ...
Post by: Kp on October 15, 2003, 03:00 PM
Quote from: WiLD on October 15, 2003, 04:18 AMOk this is for CSB, i used it when i made a quick bot 2 hold ops and ban every1 that entered i change i took over =P

If Form1.chkIPBan = vbChecked And Flags = &H20 Then
CleanSlateBot2.Send "/ban " & Username & " IP Banned"
End If

if you want it to ALWAYS be on just remove the "Form1.chkIPBan = vbChecked And" so it looks like this;

If Flags = &H20 Then
CleanSlateBot2.Send "/ban " & Username & " IP Banned"
End If
I can avoid your "IP ban" very easily simply by not sending 0x14 at logon, thus getting myself the plug.  Then my flags would be 0x30 (after you squelch me).  Thus, your test would fail to recognize me as IP banned.  The correct way to test for squelch (as well as test for any other properties a user's flags indicate) is to use bitwise and, not to test for equality, as you are doing.
Title: Re:Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 03:54 PM
Interesting KP..So are you saying that anyone with a botplug on would slip through the ip ban that Wild has produced?
Title: Re:Wildcards and Ip bans
Post by: iago on October 15, 2003, 04:24 PM
No, he said that that code is checking flags incorrectly, since if he has a plug, his flags will be:
0x10 (Plug) | 0x20 (squelched), which is 0x30 (Plug | squelched)
Title: Re:Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 04:30 PM
See this is where the problem is...I dont understand how to make it identify the proper flags...Sorry im kinda new to this...
Title: Re:Wildcards and Ip bans
Post by: Soul Taker on October 15, 2003, 04:37 PM
Check http://www.valhallalegends.com/arta/docs/flags.txt it explains such things.
Title: Re:Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 04:43 PM
If (BattleNetFlag And FlagValue) = 0x30 Then
    CleanSlateBot2.Send "/ban " & Username & " IP Banned"
End If
would that be correct?
Title: Re:Wildcards and Ip bans
Post by: SNiFFeR on October 15, 2003, 04:47 PM

If Flags = &H20 And Flags = &H30 Then ' Flags is already declared when you are using CleanSlatebot2.
CleanSlateBot2.Send "/ban " & Username & " IP Banned"
End If


I suppose that'd work, It depends how you setup your flags though. The flags could be 48 and 32.
Title: Re:Wildcards and Ip bans
Post by: iago on October 15, 2003, 04:55 PM
Quote from: Gangz on October 15, 2003, 04:43 PM
If (BattleNetFlag And FlagValue) = 0x30 Then
    CleanSlateBot2.Send "/ban " & Username & " IP Banned"
End If
would that be correct?

Nope.

First, you can't use 0x in VB
Second, just say:
if(UserFlag and 0x20) then
...

Title: Re:Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 05:03 PM
thanks iago ill give it a try..If anyone can help with cards please post..thanks
Title: Re:Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 05:06 PM
hrm..Thanks sniff i think that might work and be a little bit easier  :P
Title: Re:Wildcards and Ip bans
Post by: MyndFyre on October 15, 2003, 06:34 PM
For example (sorry I'm using C#), I have an enumeration set up for flags.


[Flags]
public enum UserFlags
{
  Blizzard = 0x01,
  Moderator = 0x02,
  Speaker = 0x04,
  BnetAdmin = 0x08,
  Squelched = 0x20,
  Guest = 0x40
}

Then I use bitwise operators to check for concurrency.  In C#, the | operator is OR, & operator is AND, ! is NOT, and ^ is XOR.

private void User_Joined(UserEventArgs e)
{
  // e.Name is the screen name,
  // e.Flags are the user's flags,
  // e.Text is (currently) the user's statstring and product ID.
  User u = new User(e.Name, e.Flags, e.Text);

  // Here's the important part:
  bool isSquelched = ((u.Flags & UserFlags.Squelched) == UserFlags.Squelched);


That last statement ANDs the user's flags with the one flag UserFlags.Squelched.  The result is either 0x00 (no flags) or UserFlags.Squelched.  If it's 0x00, then it does NOT equal UserFlags.Squelched, and the boolean isSquelched is assigned false; otherwise (blinding flash of the obvious) it is assigned true.

Hope this helps!
Title: Re:Wildcards and Ip bans
Post by: Gangz on October 15, 2003, 07:49 PM
wow thanks fo the input on the ip bans..I have used all you information together and i have it figured out so it cant be bypassed form any angle and it responds quickly....=) Now..i need to learn wild cards for the perfect ops bot...thanks Again everyone!!