Kutlu35 Posted January 19, 2017 Share Posted January 19, 2017 Hello dear forum users, im newbie on scripting . now im doing a little help system. Player say /help to chat . like a "help me" text on chatbox but other players can't see "help me" text only admins can see it. which funcitions useless for this addCommandHandler outputChatbox( how i can write text to only admins see) Sorry for bad english my from Turkey Link to comment
JamieSA Posted January 19, 2017 Share Posted January 19, 2017 I have not tested this, but you should read about ACL Groups and ACL Lists In your case i think you might be looking for something along these lines... function helpMe() -- your code hre end addCommandHandler ( "help", helpMe) And then in: <acl name="Default"> <right name="command.start" access="false" /> <right name="command.stop" access="false" /> <right name="command.stopall" access="false" /> ...etc etc... </acl> Add: <right name="command.help" access="false" /> Might not be spot on... but along those lines 1 Link to comment
LoPollo Posted January 20, 2017 Share Posted January 20, 2017 (edited) Jamie, i think he's talking about text that only admins can see, not commands that only admins can use... So: outputChatBox's second parameter is what you are looking for. It's defaulted to root, so the text is visible to all children of root = all players. I guess in you server there's no dummy element parent of admins (it would be not a normal thing...), so i think you should get all the admins and repeat the outputChatBox for every admin* * To get the admins, you get all players. Then get their account and check if account is in "Admin" group with isObjectInACLGroup. If it is, output the text to that player: --example local players = getElementsByType( "player" ) --get ALL players local adminACL = aclGetGroup ( "Admin" ) --get the admin acl group for _,thePlayer in pairs(players) do --loop the players if isObjectInACLGroup( getPlayerAccount( thePlayer ), adminACL ) then --check if the account of that player is an admin outputChatBox( "Your text goes here", thePlayer ) --if it is, outputChatBox to him end end Edited January 20, 2017 by LoPollo 1 Link to comment
Kutlu35 Posted January 21, 2017 Author Share Posted January 21, 2017 Thanks so much guys i trying this. Link to comment
JamieSA Posted January 21, 2017 Share Posted January 21, 2017 Upon re-reading what he said, I agree that's what he probably wants, the user to be able to type /help "the message" and for it then to be delivered to admins only. 1 Link to comment
Kutlu35 Posted January 21, 2017 Author Share Posted January 21, 2017 2 hours ago, JamieSA said: Upon re-reading what he said, I agree that's what he probably wants, the user to be able to type /help "the message" and for it then to be delivered to admins Yes its. My english is not enough sorry for this 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