dewu Posted October 26, 2014 Share Posted October 26, 2014 Hi guys. Im looking for a way to set some player access, to adding other players into his ACL Group. Example: Only Player1 can add other players to Group1, by use command /add OtherPlayer. I create own script, but don't know why it's not working ;/ function test1 (playerSource, commandName, accountName) if isObjectInACLGroup ("user.dewu", aclGetGroup ( "Group1" ) ) then if accountName then aclGroupAddObject (aclGetGroup("Group1"), "user."..accountName) outputChatBox ("Account '"..accountName.."' succesfully added to the group.", playerSource) else outputChatBox ("No account name specified.", playerSource) end end end addCommandHandler ("add", test1) Link to comment
dewu Posted October 26, 2014 Author Share Posted October 26, 2014 Okay, my false, it's working But i have next question: How to list by use command all users from Group1? Link to comment
Castillo Posted October 30, 2014 Share Posted October 30, 2014 https://wiki.multitheftauto.com/wiki/Ac ... istObjects Link to comment
dewu Posted October 31, 2014 Author Share Posted October 31, 2014 Thank you! It's working perfect, but i want more Is this way to remove "user" word when listed? Ex. when /aclObjectList i got: ACL List: Group1 #0 Object: user.dewu so i want this: ACL List: Group1 #0 Object: dewu Link to comment
Woovie Posted October 31, 2014 Share Posted October 31, 2014 local users = {} local aclObjects = aclGroupListObjects(aclGetGroup("admin")) for k,v in ipairs(aclObjects) do local table = string.split(v, ".") if table[1] == "user" then table.insert(users, table[2]) end end Table "users" will contain each username in a format like {"bobby","joe","EdibleSpoon44"} Which you can iterate through with an ipairs loop. Link to comment
Anubhav Posted October 31, 2014 Share Posted October 31, 2014 One more good way: local users = {} local aclObjects = aclGroupListObjects(aclGetGroup("admin")) for k,v in ipairs(aclObjects) do table.insert(users, string.gsub(v, "user.", "") end Link to comment
Woovie Posted November 1, 2014 Share Posted November 1, 2014 One more good way: local users = {} local aclObjects = aclGroupListObjects(aclGetGroup("admin")) for k,v in ipairs(aclObjects) do table.insert(users, string.gsub(v, "user.", "") end The only issue is that the table aclObjects will contain more than just players. Link to comment
dewu Posted February 3, 2015 Author Share Posted February 3, 2015 Guys, i need your help again. I've got two scripts: function test1 (playerSource, commandName, accountName) if isObjectInACLGroup ("user.dewu", aclGetGroup ( "Group1" ) ) then if accountName then aclGroupAddObject (aclGetGroup("Group1"), "user."..accountName) outputChatBox ("Account '"..accountName.."' succesfully added to the group.", playerSource) else outputChatBox ("No account name specified.", playerSource) end end end addCommandHandler ("add", test1) and function test2 (playerSource, commandName, accountName) if isObjectInACLGroup ("user.master", aclGetGroup ( "Group2" ) ) then if accountName then aclGroupAddObject (aclGetGroup("Group2"), "user."..accountName) outputChatBox ("Account '"..accountName.."' succesfully added to the group.", playerSource) else outputChatBox ("No account name specified.", playerSource) end end end addCommandHandler ("add", test2) When I try to add some user to Group1 logged as dewu then it'll add some user to both groups (Group1 and Group2). I want to set dewu permission to add only to Group1, and for master set permission to add only to Group2. How to do that? ;/ I've tried everything. Or maybe is other, simplier way to got that? 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