• Welcome to Valhalla Legends Archive.
 

Access / Command trouble

Started by ^, February 15, 2005, 11:47 AM

Previous topic - Next topic

^

#30

Public Function GetAccess(username as string)
Dim Splt() As String
For i = 0 to frmConfig.List1.listcount
Splt = Split(frmConfig.List1.list(i), " ", 2)
If lcase(splt(0)) = lcase(username) then
getaccess = splt(1)
Exit function
end if
next i
end with
end function


Im using that for TESTS


I get the error: "Expected: Array" for Access = GetAccess(Username)

Spilled


Public Function GetAccess(username as string)
On error resume next
Dim Splt() As String
For i = 0 to frmConfig.List1.listcount
Splt = Split(frmConfig.List1.list(i), " ", 2)
If lcase(splt(0)) = lcase(username) then
getaccess = splt(1)
Exit function
end if
next i
end with
end function


Ok i believe whats its doign is it trying to split the .list(i) when its "" and erroring out so i added On error resume next try this and get back at me, Goodluck

PS: next time use [Code and /Code]

^


Public Function GetAccess()
Dim Username As String
On Error Resume Next

Dim splt() As String

    For i = 0 To frmConfig.List1.ListCount - 1
      splt = Split(frmConfig.List1.List(i), " ")
       If splt(0) = LCase(Username) Then
           GetAccess = splt(1)
       MsgBox GetAccess
       MsgBox splt(1)
    Else
         If splt(0) = UCase(Username) Then
           GetAccess = splt(1)
       MsgBox GetAccess
       MsgBox splt(1)
       End If
     End If
   Next i
'End With
End Function


Thats my code.

Still getting that "Expected Array" error for Access = GetAccess(Username) with GetAccess highlighted.

Spilled

Quote from: ^OwnaGe~ on February 16, 2005, 12:57 PM

Public Function GetAccess()
Dim Username As String
On Error Resume Next

Dim splt() As String

    For i = 0 To frmConfig.List1.ListCount - 1
      splt = Split(frmConfig.List1.List(i), " ")
       If splt(0) = LCase(Username) Then
           GetAccess = splt(1)
       MsgBox GetAccess
       MsgBox splt(1)
    Else
         If splt(0) = UCase(Username) Then
           GetAccess = splt(1)
       MsgBox GetAccess
       MsgBox splt(1)
       End If
     End If
   Next i
'End With
End Function


Thats my code.

Still getting that "Expected Array" error for Access = GetAccess(Username) with GetAccess highlighted.

its public Function getaccess(username as string) is the function heading and you call it by passing the username like this:

Access = getaccess("usernamehere")

^

Uhm. Can we make this easy? Have you got msn ? If you have, can i have ur email to add you?

It would be easier =[


Access = GetAccess("usernamehere")


That is not what i need. I dont want just one user to be able to do the commands.. or maybe im looking at it wrong? If i am, what would i put in "usernamhere" ..

Spilled

No, i use AIM and this is easy programming if you dont get this how did you write a connection? Anyways if you got AIM PM me for my sn cuz this is a waste of a topic =\

^

No, i am half on success to my access levels. I am just VERY confused. Anyway back on topic.


What should i put in ("usernamehere")
Wouldnt that mean only ONE user can do the commands.


Omfg i am Very confused. Explain more help plz  :'(

Spilled

... for username here you would pass the variable string that contains the users name whos access you seek... so on user talks under packet &HF username is sent within that packet data... so you would pass that variable that holds the user talkings name... and when you pass it into that function that function will return that persons access... wether it be "" or 100 or 40... doesnt matter it will search the access listbox and return the value...

Edit: and no that doenst mean only one user will be able to access.. it will search for anyones access in the listbox... just provide the username to search for

^


Access = GetAccess(username)


I had that, but now

Access = GetAccess("SpongeMan")


A old name i use to have, right?

Ok i start it up

"Expected: Array"

...

Spilled

-.- paste me the whole sub that contains the line of coding where you call the function up

^

Umm, its all in my Parse function, where i have literally everything..


But it was at the top, but now i just moved it under Case &HF

Edit: Can we meet on battle.net so we can do it better?  :-\


Spilled

#41
roflmao....wow... paste me case &HF then and ill show you what it should look like =\

Edit: yes uswest or useast and what channel -.-

Edit#2: ipb from east, go west same channel

^

#42
Um my Case &HF has nothing but commands, whisper, chat and stuff like that. Whats there to see?
Quote from: ^OwnaGe~ on February 16, 2005, 01:13 PM

Edit: Can we meet on battle.net so we can do it better? :-\




Go to USEAST, Channel: help1234  .... /me waits

^

Ok, after some work i finally have

            ElseIf access >= 10 And Mid(strText, 1, 7) = frmConfig.trigger.Text & "whois " Then
              If Right(strCompare, 3) = "" Then getaccess = 0
             Packet.InsertNTString Mid(strText, 8) & " has access of " & getaccess
            Packet.SendPacket bnetsocket, &HE
             Packet.Clear


And my getaccess function:


Sub getaccess(ByRef getaccess As Integer, ByVal Username As String)
            On Error Resume Next
            Dim strCompare As String
            Dim s As String
            s = Dir$(App.Path & "\users.txt")
            If s = "" Then
                GoTo theend
            End If
            Open (App.Path & "\users.txt") For Input As #1
            Do
                Input #1, strCompare
                Call PrepareCheck(strCompare)
                Call PrepareCheck(Username)
                If StrComp(LCase(Username), LCase(Left(strCompare, Len(Username))), vbTextCompare) = 0 Then
                    getaccess = Right(strCompare, 3)
                End If
            Loop Until EOF(1)
        Close #1
theend:
End Sub


My right(strCompare,1) = Name
Right(strCompare,2) = A space..
Right(strCompare,3) = their access

But its coming back as "" >_<

Ideas, help?  :P  ::)  ;D  :-\  :'(

Yegg

Looking at that code I think of Stealthbot source code release 1.1.4. Spilled, I do believe that you just wasted your life helping him.

|