• Welcome to Valhalla Legends Archive.
 

Custom Access Commands

Started by CrAz3D, February 10, 2005, 09:23 PM

Previous topic - Next topic

CrAz3D

[vb6]

I'm trying to make different user groups that will contain w/e command the user specifies.  What I've done SO FAR is allowed the user to create a custom group & add whichever commands to the group.  Now I'm trying to make it so whoever is part of that access group has access to those commands...not so sure how to go about this totally.
I am using a couple of array to accomplish this.

array A() = the user's db info (username, flags, created date, created by, modified date, modified by, grouplist

array B() = the grouplist info (groupname, commands(ex: CMD1, CMD2))

array C() = a Split(B).  C(0) = the group name & C(1) = the commands


No where I'm stuck @ is how would I compare A(6)[the user's group] & C(0)[the groupname] & C(1) so that I can have the user able to access the commands.  I will be splitting C(1) into another array, most likely D() that each item will be the command name.

I KNOW this is confusing, I'm not so sure I understand what I wrote, if you need more clarification say so & I'll try.


EDIT: I think this is something similar to what ZeroBot does?... I can't remember totally.



EDIT, again:

if a(6) = c(0) then
   if left(message,len) = d(INDEX)  then
     do stuff for this cmd
   end if
end if

Maybe something like that?
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

CrAz3D

Well, it seems what I have works, but I have a feeling that it is hugely inefficent.  Any suggestions on what I might want to do differently?


Public Sub CommandIT(ByVal Username As String, Message As String)
Dim a() As String
Dim b() As String
Dim c() As String
Dim d() As String
Dim pA() As String
ReDim c(0)
Dim i As Integer, X As Integer

If Not Left(Message, 1) = "!" Then Exit Sub
Message = Right(Message, Len(Message) - 1)
    pA = Split(Message, Space(1), 2)
   
a() = GetAccess(Username)
b() = ADO.getinfo("grouplist")

For i = 0 To UBound(b) - 1
    c() = Split(b(i), "|", 2)
    d = Split(c(1), ",")
    If LCase(a(6)) = LCase(c(0)) Then
        For X = 0 To UBound(d)
            If LCase(d(X)) = LCase(pA(0)) Then
            Select Case pA(0)
                Case "say"
                    QU.AddQueue pA(1)
                Case "ver"
                    QU.AddQueue "I am a FREAKIN' PIMP Xenogenic by CrAz3D[xL]"
            End Select
            End If
        Next X
    End If
Next i

End Sub
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Yegg

Why does that code look so much like the source from Flawed Bot? If I remember correctly, Flawed Bot contains pA(), not saying that you copied it, but it looks like it.

Warrior

Or did you ever think it was maybe Fleet- that uses Stolen code? IMHO people pick up other people's code habbits one way or another.
For example I use "Splt" often because I asked for help with a User DB from someone a while back and he used code with that in it and i've used it ever since.

Yegg, dont be an idiot.
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?

CrAz3D

Yegg, all of that looks like Flawed bot?  k, I've never used Flawed nor have I seen the source so....


That is just a bunch of random stuff I came up with that I'm not going to use anymore (LoRd[nK] explained a few flaws in my idea, so it ALL went bye bye).  But not I'm contemplating a new method which will be cool too, so, w/e
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

R.a.B.B.i.T

What I did (for FoFoBot) was to create a type that had RequiredAccess and RequiredFlags as its two parts.  I then had a public array (one for each command) which was filled at run-time by reading out of access.ini.  Then I just checked the user's access against the RequiredAccess (or Flags) instead of a hardcoded value.

Grok

Oh please let's not degrade this into stolen code discussion.  If you posted code here you have to expect people to use it.

I was the first person on these forums to use pA() so don't even go there and get off your high horse.

"pA()" is an obvious choice for a procedural-level array.  If we start looking at such details and saying "stolen code", we will look as bad as SCO.

CrAz3D

k, to the topic ... & away!

::)
:-*
Thanks for the help folks, decided it would be eaier just to have set flags & the user can add themself w/e flag.  Maybe I'll let them change what commands are associated with what flags, but not til later.
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Warrior

Exactly my point Grok, everyone adapts a coding style either by example or by leeching.
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?