Valhalla Legends Forums Archive | Battle.net Bot Development | Wild Card Ban Help

AuthorMessageTime
TeEhEiMaN
ok this is what I got so far and I know its way off, but Im not sure what to do.

[code]
If Username = Form5.txtMaster.Text Then
If Left((LCase(Message)), 6) = (Form5.txtTrigger.Text & "ban *") Then
Dim bUsername As String
bUsername = Right(Message, (Len(Message) - 5))
If bUsername Like (lvChannel) Then
CleanSlateBot1.Send "/ban " & bUsername
End If
End If
[/code]
June 24, 2003, 9:19 PM
Kp
... you're trying to ban the channel's name? :) Not sure, since you didn't post what lvChannel is. Either way, the correct solution would be to iterate over in-channel users and do that Like test on each of them, adding the ban if it is true.
June 24, 2003, 9:29 PM
______
im taking he wants to ban a person in that channel

[code]
Dim bUsername As String
bUsername = Right(Message, (Len(Message) - 5)
dim tempusr as string
for i = 1 to lvchannel.listitems.count
tmpusr = lvchannel.listitems(i).text
if lcase(bUsername) like lcase(tmpusr) then
CleanSlateBot1.Send "/ban " & tmpusr
endif
next i
[/code]
June 24, 2003, 10:54 PM
DarkMinion
[code]
int wildcmp(char *wild, char *string)
{   
   char *cp, *mp;   
   while ((*string) && (*wild != '*')) {
      if ((*wild != *string) && (*wild != '?')) {
         return 0;      
      }
      wild++;
      string++;
   }         
   while (*string) {
      if (*wild == '*') {
         if (!*++wild) {
            return 1;
         }
         mp = wild;
         cp = string+1;
      }
      else if ((*wild == *string) || (*wild == '?')) {         
         wild++;
         string++;
      }
      else {
         wild = mp;
         string = cp++;
      }
   }
   while (*wild == '*') {
      wild++;
   }   
   return !*wild;
}

void WildCardBan(const char *szWild, const char *szMsg)
{
   for(int i = 0; i < ChanList.Count(); i++){
      if(wildcmp(strlwr((char *)szWild), strlwr(ChanList.Get(i))) && !IsSafe(ChanList.Get(i)))
         Send("/ban %s %s", ChanList.Get(i), szMsg);
   }
}[/code]
June 24, 2003, 11:13 PM
TeEhEiMaN
Sweet thx so much
June 25, 2003, 12:43 AM
Camel
[code]Public Function Matches(ByVal UserName As String, ByVal Format As String) As Boolean
'MSDN: Note To match the special characters left bracket ([), question mark (?), number sign (#), and asterisk (*), enclose them in brackets. The right bracket (]) can't be used within a group to match itself, but it can be used outside a group as an individual character.
Format = Replace(Format, "[", "[[]")
Format = Replace(Format, "#", "[#]")
Matches = (UserName Like Format)
End Function[/code]

if you want to be able to use ? as a literal charactor, add [code]Format = Replace(Format, "?", "[?]")[/code] otherwise it will be interperated as a single unknown charactor
June 25, 2003, 12:53 AM

Search