Brolis Posted November 10, 2013 Share Posted November 10, 2013 Please help me: Is that possible to make a script which looks if that player is one of the 3 or more ACLS: It only works for Owner, because he is the first of the other groups - why? If I will change the places of Owner and Admin then it only will work for Admin. if I will change the places of Owner and Vip then it only will work for Vip... Or with Admin and Vip - it will work only for Owner, but no difference... Closed_Gates_1 = createObject ( 986, 123.599998474120, 1931.800048828100, 15.500000000000, 0, 0, 270 ) addCommandHandler ( "OG1", function ( Open_Gates_1 ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( Open_Gates_1 ) ), aclGetGroup ( "Owner" ) or aclGetGroup ( "Admin" ) or aclGetGroup ( "Vip" ) ) then setTimer(function() moveObject (Closed_Gates_1, 5000, 123.59999847412, 1931.800048828100, 10.500000000000 ) end, 1000, 1) else Err_Msg("[iNFO]: You have no acces to that command.", Open_Gates_1 ) end end ) addCommandHandler ( "CG1", function ( Close_Gates_1 ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( Close_Gates_1 ) ), aclGetGroup ( "Owner" ) or aclGetGroup ( "Admin" ) or aclGetGroup ( "Vip" ) ) then setTimer(function() moveObject (Closed_Gates_1, 5000, 123.59999847412, 1931.800048828100, 15.500000000000 ) end, 1000, 1) else Err_Msg("[iNFO]: You have no acces to that command.", Close_Gates_1 ) end end ) I tried to make it by myself, but I don't know why there are some ERRORS and other problems like with Err_Msg. If I am not in any of these groups or I am not an Admin, Vip - I don't see an Err_Msg, why? ---Plan, how it should be working. 1) /OG1 - Command. a) Searching if player is one of the ACLS. b) if player is in one of the ACL, then the function is working and gates are opened. c) If not, then the function is not working, gates are not opened and error message comes. 2) /CG1 same as /OG1... a) Searching... b) If... gates are closed. c) If not... gates are not closed... Link to comment
Castillo Posted November 10, 2013 Share Posted November 10, 2013 You can't do it that way, you can use this function I just cooked up for you though: function isAccountInGroup ( groups, account ) local theGroup = false for _, group in ipairs ( groups ) do if isObjectInACLGroup ( "user.".. account, aclGetGroup ( group ) ) then theGroup = group break end end return theGroup end Link to comment
Brolis Posted November 10, 2013 Author Share Posted November 10, 2013 Can you explain or write all script which I want. I don't know where and what I need to write, I tried, but nothing . Please, make a full script with my directed groups: Owners, Admins, Vips. Link to comment
Castillo Posted November 10, 2013 Share Posted November 10, 2013 Closed_Gates_1 = createObject ( 986, 123.599998474120, 1931.800048828100, 15.500000000000, 0, 0, 270 ) addCommandHandler ( "OG1", function ( Open_Gates_1 ) if isAccountInGroup ( { "Owner", "Admin", "Vip" }, getAccountName ( getPlayerAccount ( Open_Gates_1 ) ) ) then setTimer ( function ( ) moveObject ( Closed_Gates_1, 5000, 123.59999847412, 1931.800048828100, 10.500000000000 ) end , 1000, 1 ) else Err_Msg ( "[iNFO]: You have no acces to that command.", Open_Gates_1 ) end end ) addCommandHandler ( "CG1", function ( Close_Gates_1 ) if isAccountInGroup ( { "Owner", "Admin", "Vip" }, getAccountName ( getPlayerAccount ( Open_Gates_1 ) ) ) then setTimer ( function ( ) moveObject ( Closed_Gates_1, 5000, 123.59999847412, 1931.800048828100, 15.500000000000 ) end ,1000, 1 ) else Err_Msg ( "[iNFO]: You have no acces to that command.", Close_Gates_1 ) end end ) function isAccountInGroup ( groups, account ) local theGroup = false for _, group in ipairs ( groups ) do if isObjectInACLGroup ( "user.".. account, aclGetGroup ( group ) ) then theGroup = group break end end return theGroup end 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