..:D&G:.. Posted October 19, 2014 Share Posted October 19, 2014 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
..:D&G:.. Posted October 19, 2014 Author Share Posted October 19, 2014 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
Anubhav Posted October 19, 2014 Share Posted October 19, 2014 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
..:D&G:.. Posted October 19, 2014 Author Share Posted October 19, 2014 Can you tell me what was wrong and how you fixed it please? Link to comment
Anubhav Posted October 19, 2014 Share Posted October 19, 2014 [quote name=..&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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now