Furious^ONE! Posted March 25, 2014 Share Posted March 25, 2014 Hi Please help me, I'd like my script is restricted to admins when you make a command (/ op / pf) Help me please. local gate = createObject(10828, -1570.5, 1117.5, 16.10000038147, 0, 0, 91.988525390625) function open() moveObject(gate, 3000, -1570.5, 1117.5, 30.2, 0, 0, 0 ) end addCommandHandler("op", open) function close() moveObject(gate, 3000, -1570.5, 1117.5, 16.10000038147, 0, 0, 0 ) end addCommandHandler("fp", close) Link to comment
Castillo Posted March 25, 2014 Share Posted March 25, 2014 You must use the following functions: getPlayerAccount -- Gets the account element of a player. getAccountName -- Gets the name of an account element. aclGetGroup -- Gets the ACL group from it's name. isObjectInACLGroup -- Checks if an object is in the ACL group. Link to comment
cheez3d Posted March 25, 2014 Share Posted March 25, 2014 (edited) local gate = createObject(10828, -1570.5, 1117.5, 16.10000038147, 0, 0, 91.988525390625) addCommandHandler("gate",function(player) if getPlayerAccount(player) and isObjectInACLGroup(string.format("user.%s",getAccountName(getPlayerAccount(player))),aclGetGroup("Admin")) then setElementData(gate,"opened",not getElementData(gate,"opened")) if getElementData(gate,"opened") then moveObject(gate,3000,-1570.5,1117.5,30.2,0,0,0) else moveObject(gate,3000,-1570.5,1117.5,16.10000038147,0,0,0) end end end) Edited March 25, 2014 by Guest Link to comment
Furious^ONE! Posted March 25, 2014 Author Share Posted March 25, 2014 thank you , but the object which is moved does not appear. Link to comment
Castillo Posted March 25, 2014 Share Posted March 25, 2014 local gate = createObject(10828, -1570.5, 1117.5, 16.10000038147, 0, 0, 91.988525390625) addCommandHandler("gate",function(player) if getPlayerAccount(player) and isObjectInACLGroup(string.format("user.%s",getAccountName(getPlayerAccount(player))),aclGetGroup("Admin")) then setElementData(gate,"opened",not getElementData(gate,"opened")) if getElementData(gate,"opened") then moveObject(gate,3000,-1570.5,1117.5,30.2,0,0,0) else moveObject(gate,3000,-1570.5,1117.5,16.10000038147,0,0,0) end end end) What's the point on using string.format? you can simply do: "user.".. getAccountName ( getPlayerAccount ( player ) ) @RoRo76: Try this: local gate = createObject ( 10828, -1570.5, 1117.5, 16.10000038147, 0, 0, 91.988525390625 ) local state = false addCommandHandler ( "gate", function ( thePlayer ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then if ( not state ) then moveObject ( gate, 3000, -1570.5, 1117.5, 30.2, 0, 0, 0 ) else moveObject ( gate, 3000, -1570.5, 1117.5, 16.10000038147, 0, 0, 0 ) end state = ( not state ) end end ) Link to comment
Furious^ONE! Posted March 25, 2014 Author Share Posted March 25, 2014 His works thank you very much for your help! 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