• Welcome to Valhalla Legends Archive.
 

Acces lists

Started by Gangz, December 07, 2003, 01:42 AM

Previous topic - Next topic

Gangz

Dim splt() As String
   Dim i As Integer
   Dim strAccess As String
   For i = 0 To Form1.cboUsers.ListCount
       splt() = Split(Form1.cboUsers.List(i), " ")
       If LCase(splt(0)) = LCase(Username) Then
           Select Case LCase(splt(0))
               Case "M"
                   strAccess = "M"
               Case "O"
                   strAccess = "O"
               Case "S"
                   strAccess = "S"
               Case "B"
                   strAccess = "B"
           End Select
       End If
   Next i
   While InStr(Message, "  ") Or InStr(Message, ",") Or Right(Message, 1) = " "
       Message = Replace(Message, "  ", " ")
       Message = Replace(Message, ",", " ")
       If Right(Message, 1) = " " Then Message = Left(Message, Len(Message) - 1)
   Wend
   '''
   lentrig = Len(Form1.varTrigger): givencommand = Split(UCase(Message))(0): lengiven = Len(givencommand)
   If lengiven > lentrig Then
       If Left(givencommand, lentrig) = Form1.varTrigger Then
           upperusername = UCase(Split(Username, "#")(0))
           Select Case Right(givencommand, lengiven - lentrig)
               Case "SAY"
                   If strAccess = "M" Then Form1.Send Right(Message, (Len(Message) - 5))
Wont work =\ and i cant figure out why

Stealth

#1
Quote from: Gangz on December 07, 2003, 01:42 AM
...
       If LCase(splt(0)) = LCase(Username) Then
           Select Case LCase(splt(0))
               Case "M"
                   strAccess = "M"
...

I'm assuming your database is held as "username flags". At this point in your code you compare splt(0), or "username", to their username. If they match (and you're probably better off using StrComp() to determine this) then your Select Case statement should be applied to splt(1) ("flags").

Also, you should not be lowercasing then selecting uppercase letters.
Quote...
           Select Case LCase(splt(0))
               Case "M"
...

Since that value was just lowercased, it can't possibly be "M".
- Stealth
Author of StealthBot

Gangz

Wow, that was confusing as hell. From what you said I gathered that is not comparing correctly. I have tried matching many different ways and cannot get them to work. This is just was i have found to by mose effiecent and it seems as it wont work.