• Welcome to Valhalla Legends Archive.
 

Unbanning with wildcards and removing users

Started by Gangz, February 07, 2004, 01:20 AM

Previous topic - Next topic

Gangz

K this time i am ahving 2 problems... after i figure these 2 out i pretty much got it figured out..

Unbannign with * script
       

       Dim argSplit As Variant, temp As String
       argSplit = Split(message)
If UCase(argSplit(0)) = Form1.varTrigger & "UNBAN" Then
           templen = Len(argSplit(0) & argSplit(1)) + 1: If templen <> Len(message) Then temp = Mid(message, templen + 1)
           If InStr(argSplit(1), "*") Then
               For X = 0 To Form1.cbobanned.ListCount - 1
                   If Form1.cbobanned.List(X) Like argSplit(1) Then Form1.cboQueue.AddItem "/unban " & Form1.cbobanned.List(X) & temp
               Next X
               Else: Form1.cboQueue.AddItem "/unban " & argSplit(1) & temp
           End If
       End If
im not asking anyone to re-write i it to work just point out erros =\

And i also was wondering how to remove users from a userlist..

this is the adding code
       If UCase(Mid(message, 1, 5)) = Form1.varTrigger & "ADD " Then
       Dim User As String
           User = (Mid(message, 6))
        Form1.cboUsers.AddItem User


i can add just not remove =\ because it adds the user with flags such as M O S B

hismajesty

You have to use an API call to remove from a ListBox. I don't remember it off the top of my head though, try msdn.

Newby

- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

UserLoser.

#3
Quote from: hismajesty on February 07, 2004, 06:58 AM
You have to use an API call to remove from a ListBox. I don't remember it off the top of my head though, try msdn.

Hmm..

int i_Retval = SendMessage(lstHwnd, LB_FINDSTRING, 0, (LPARAM)"My listbox item");

SendMessage(lstHwnd, LB_DELETESTRING, i_Retval, 0);


hismajesty

Yes, UserLoser, but I remember you giving me a direct API call for that a while back. Without having to use SendMessage.

Gangz

Eh... I gatta look this one up =\.. its kinda complecated i can see

UserLoser.

Quote from: Gangz on February 08, 2004, 12:22 AM
Eh... I gatta look this one up =\.. its kinda complecated i can see

There is a much simpiler way, something like:


Dim I as Long
   For I = 0 To MyList.ListCount
       If UCase(MyList.List(i)) = UCase(UserToRemove) Then MyList.RemoveItem I: Exit For
   Next I

Gangz

Quote from: UserLoser. on February 08, 2004, 10:35 AM
Quote from: Gangz on February 08, 2004, 12:22 AM
Eh... I gatta look this one up =\.. its kinda complecated i can see

There is a much simpiler way, something like:


Dim I as Long
   For I = 0 To MyList.ListCount
       If UCase(MyList.List(i)) = UCase(UserToRemove) Then MyList.RemoveItem I: Exit For
   Next I

wont work.. that is were i get caught up to... On the list it adds as Userloser. M ... So i need it to remove the whole line =\

UserLoser.

Quote from: Gangz on February 08, 2004, 01:05 PM
Quote from: UserLoser. on February 08, 2004, 10:35 AM
Quote from: Gangz on February 08, 2004, 12:22 AM
Eh... I gatta look this one up =\.. its kinda complecated i can see

There is a much simpiler way, something like:


Dim I as Long
   For I = 0 To MyList.ListCount
       If UCase(MyList.List(i)) = UCase(UserToRemove) Then MyList.RemoveItem I: Exit For
   Next I

wont work.. that is were i get caught up to... On the list it adds as Userloser. M ... So i need it to remove the whole line =\

Try:

Dim I as Long
Dim Sp() as String
   For I = 0 To MyList.ListCount
       Sp() = Split(MyList.List(I), " ")
       If UCase(Sp(0)) = UCase(UserToRemove) Then MyList.RemoveItem I: Exit For
   Next I


Sp(0) would be Userloser.
Sp(1) would be M

Newby

I was going to say that. But then I got lazy and fell asleep :(
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Networks

Public Function WildCard(ByVal WC As String, ByVal SearchStr As String) As Boolean
      If WC Like SearchStr Then
            WildCard = True
            Exit Function
      Else
            WildCard = False
      End If
End Function

Could someone give me a usage for when someone joins the channel and meets specifications for a wildcard ban?

MyndFyre

#11
okay, first use [ code ] [ /code ] tags:

Public Function WildCard(ByVal WC As String, ByVal SearchStr As String) As Boolean
     If WC Like SearchStr Then
           WildCard = True
           Exit Function
     Else
           WildCard = False
     End If
End Function


And here is some Pseudocode for you:


' Assume that mySrchStr is declared as a String variable

' Sorry, this code looks like Visual Basic 7....  You should be able to
' get the meaning out of it though, hence _pseudo_code...
Public Function User_Joined (ByVal usr As String, ByVal flags As Integer, ByVal stats As String, ByVal ping As Integer) Handles Me.connection.UserJoined

If WildCard mySrchStr, usr
  DoMyWildcardAction
End If

End Function
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

o.OV


Public Function WildCard(ByVal WC As String, ByVal SearchStr As String) As Boolean
     If WC Like SearchStr Then
           WildCard = True
           Exit Function
     Else
           WildCard = False
     End If
End Function


er.. it should look something like this..


Public Function WildCard(ByVal WC As String, ByVal SearchStr As String) As Boolean
     wildcard = (WC Like SearchStr)
End Function


Why would you want to even bother making such a simple function.. the Like operator returns a boolean value already...
If the facts don't fit the theory, change the facts. - Albert Einstein

MyndFyre

Quote from: o.OV on February 09, 2004, 08:57 PM
Why would you want to even bother making such a simple function.. the Like operator returns a boolean value already...

I disagree.  What happens when somewhere down the line, he wants to change his wildcard processing?

This is good encapsulation (although I doubt he knew that).
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Soul Taker

Yes, would be a good idea to make a function for wildcard matching which changes the default behavior of some masking characters.