Jump to content

[HELP] isObjectInACLGroup error


..:D&G:..

Recommended Posts

Hey guys, I keep getting an error, from the isObjectInACLGroup and I don't know why..

The error is: Expected acl-group at argument 2, got boolean

Function:

function getGroups( player ) 
    local g = { } 
    if p[ player ] then 
        for key, value in ipairs( groups ) do 
            if isObjectInACLGroup( "user." .. p[ player ].username, aclGetGroup( value.aclGroup ) ) then 
                table.insert( g, value ) 
            end 
        end 
        table.sort( g, function( a, b ) return a.priority > b.priority end ) 
    end 
    return g 
end 

Now, I can't really understand these errors, they don't make sense to me (but they will once..), so if anyone knows why I keep getting the error, please let me know :)

Link to comment

Sure, here you go:

local groups = { 
    { groupName = "MTA Trial Moderators", groupID = false, aclGroup = "Trial", displayName = "Trial", nametagColor = { 255, 255, 191 }, priority = 3 }, 
    { groupName = "MTA Moderators", groupID = false, aclGroup = "Moderator", displayName = "Moderator", nametagColor = { 255, 255, 127 }, priority = 5 }, 
    { groupName = "MTA Administrators", groupID = false, aclGroup = "Admin", displayName = "Administrator", nametagColor = { 255, 255, 0 }, priority = 10, defaultForFirstUser = true }, 
    { groupName = "Developers", groupID = false, aclGroup = "Developer", displayName = "Developer", nametagColor = { 127, 255, 127 }, priority = 20, defaultForFirstUser = true }, 
} 

Link to comment
  
function getGroups( player ) 
    local g = { } 
    if p[ player ] then 
        for key, value in ipairs( groups ) do 
            if isObjectInACLGroup( "user." .. p[ player ].username, aclGetGroup( value[key].aclGroup ) ) then 
                table.insert( g, value ) 
            end 
        end 
        table.sort( g, function( a, b ) return a.priority > b.priority end ) 
    end 
    return g 
end 
  

Link to comment

[quote name=..:D&G:..]Can you tell me what was wrong and how you fixed it please?

You looped through a table which had tables inside it and no tag like aclGroup="hi'.

So what I did is, when you looped i just added [key]! So it detects the table and get the aclGroup tag value from it.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...