• Welcome to Valhalla Legends Archive.
 

Access / Command trouble

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

Previous topic - Next topic

Spilled

Sure bro, ok in your parsep under Packet &HF this is where all your chat events happen, there should be a line of code that creates the ping from the packet it recieves (&HF) and that is what the ping of the person who joins or w/e chat event is happening... so simply under &HF on &H2 (user joins) put listbox.additem username & " " & ping and under &HF on &H3 (user leaves) write a function to remove that user from the listbox your using to store the pings and under &HF on &H1 (users here) put the same thing you put when they join ( listbox.additem username & " " & ping)

The remove Function would look something like this:

Public Function PingRemove(username as string)
With YOURLISTBOX
Dim splt() As String
For i = 0 to .listcount
splt = split(.list(i), " ", 2)
If lcase(splt(0)) = Lcase(username) Then
.removeitem (i)
end if
next i
end with
end function


Hope this Helps! gl bro, school just got out so ill check back later tonight when i get off work, feel free to post w/e questions you may have :D

^

Yeah, but what do i put for Ping


Ping = ??


Hmm, im struggling :'(

Warrior

Haha, I was at school and didn't read your post I was just trying to see if that is what you meant :P
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

^

#18
Oh no, im stuck!

I have an error in my code

If splt(0) = LCase(username) Then

With an error message: "Subscript out of range"
How can i fix this?

Edit:

Was writing something else:

Would this work?

Public Sub recacc()
Dim strCompare As String
Open (App.Path & "\users.txt") For Input As #1
recacc = Right(strCompare, 3)
msgbox recacc

End Sub
?

Edit #2: I tried it and recacc came out as "" but it should of came out as " 1 " Ideas? Also please answer my first question please!  :P   ::)

Edit #3: Ok after some work, ive made it so ANYBODY can do the commands. Now how do i make it so only the certain access can? I have this


getaccess = access

Function GetAccess()
'Dim GetAccess As Integer
Dim 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 Function

Public Sub PrepareCheck(ByRef tocheck As String)
    tocheck = Replace(tocheck, "[", "a")
    tocheck = Replace(tocheck, "]", "x")
    tocheck = Replace(tocheck, "#", "y")
    tocheck = Replace(tocheck, "-", "z")
    tocheck = Replace(tocheck, "&", "b")
End Sub



And one example of something


            ElseIf access >= 10 And LCase(Mid(strText, 1, 6)) = frmConfig.trigger.Text & "join " Then


But anybody can do it?
If Somebody says "!join Op [vL]", i want my bot to check if they have 10 or 10+ access, and if they do, then do it, if they dont, dont do it. Help? :(

BaDDBLooD

just have your Function return there access as a byte, assuming your access will be 1-100
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

^

Return it as a byte, yeah i get that.

But im a bit of a 'newbie' for this kind of terms, could you explain and give a example code?

I think its

Dim username as Byte

Something like that?

Warrior

...Dude. Why would you return a Username as a byte
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

^

No no, i am not doing that, it was an example, im stuck!

My problem explainined a bit more:

Ok, all my commands WORK but anybody can do them.


Access = Getaccess


Function GetAccess()
'Dim GetAccess As Integer
Dim 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 Function

Public Sub PrepareCheck(ByRef tocheck As String)
    tocheck = Replace(tocheck, "[", "a")
    tocheck = Replace(tocheck, "]", "x")
    tocheck = Replace(tocheck, "#", "y")
    tocheck = Replace(tocheck, "-", "z")
    tocheck = Replace(tocheck, "&", "b")
End Sub



And one example of a command



            ElseIf access >= 20 And Mid(strText, 1, 8) = "+trigger" Then
           
             Packet.InsertNTString "Trigger is: " & frmConfig.trigger.Text
            Packet.SendPacket bnetsocket, &HE
             Packet.Clear
            'frmConfig.trigger.Text = Lcase(Mid(Strtext, 13))


Im thinking my Mid(strtext, 1, 8) is wrong


Omg, Helpp ahh  :o  :o  :o

Spilled

Why make everything so complicated? simply just load the Database.txt into a listbox and use a simple getaccess function like this:


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


Don't  make everything so complicated, you would simply use this function like this:

Access = getaccess("Spilled[DW]")

that line would get the access of Spilled[DW] and store that access in the variable Access....

Hope this helps, ill check back soon gl

^

Quote from: ^OwnaGe~ on February 15, 2005, 04:14 PM
Oh no, im stuck!

I have an error in my code

If splt(0) = LCase(username) Then

With an error message: "Subscript out of range"

I get that! argh.

Spilled

when you call the get access function are you passing the username as a string?

EX: VARIABLE = getaccess(USERNAME)

Post me some code and let me see -.-

Edit: Actually subscript out of range is a splitting error,  let me see the line where you split the .list of the listbox.

^

I have


Access = Getaccess


Should it be

Access = GetAccess(Username)

?

Spilled

#27
-.- yes you have to pass the username of the person you wanna get's access...

Edit: Paste me your get access function and yoru code where you call the function.

^

#28

Access = GetAccess(Username)

            ElseIf access >= 20 And Mid(strText, 1, 8) = "+trigger" Then
           
             Packet.InsertNTString "Trigger is: " & frmConfig.trigger.Text
            Packet.SendPacket bnetsocket, &HE
             Packet.Clear



Theres my trigger command, is that right or is there anything else i need to add?


Edit:


access = GetAccess(Username)


Error: "GetAccess" highlighted with error: "Expected: Array"
:-\  :-\   :-\
Edit: #2 Wait i just had wrong code, now rtesting sec




Spilled

paste me the getaccess function plz, thank you.

|