marty000123 Posted September 7, 2014 Posted September 7, 2014 Hey guys I'm looking for a chat where only people from the ACL group ''Staff'' can talk in. They can only use the chat, and they can only read the chat. I'd like to get the command /s (staffchat). The reason is that it's annoying to start up the staff panel and press Admin Chat to talk with staff only. That's why I'm requesting this chat command. Thanks in advance! Marty (Please tell me if it's client sided or server! )
tosfera Posted September 7, 2014 Posted September 7, 2014 First of all; it's a server sided script. No need to do this client sided, there's actually no easy way to do this. You'll have to set data if someone is staff or not and all that crap. To make it easy, just create a loop trough all the players and see if they are in the ACL group "staff", then output the message. To use the command, they should also be in the group. A small example; addCommandHandler ( "staffchat", fuction ( thePlayer, _, ... ) if ( isObjectInACLGroup ( thePlayer, "staff" ) ) then for i, p in ipairs ( getElementsByType ( "player" ) ) do if ( isObjectInACLGroup ( p, "staff" ) ) then outputChatBox ( "[staff] ".. getPlayerName ( p ) ..": ".. table.concat({...}, " "), p, 0, 0, 120 ) end end end end )
Anubhav Posted September 7, 2014 Posted September 7, 2014 addCommandHandler ( "staffchat", fuction ( thePlayer, _, ... ) if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), "staff" ) ) then for i, p in ipairs ( getElementsByType ( "player" ) ) do if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(p)) "staff" ) ) then outputChatBox ( "[staff] ".. getPlayerName ( p ) ..": ".. table.concat({...}, " "), p, 0, 0, 120 ) end end end end ) If your nick wouldn't be acc could create problems.
(s)ection Posted September 7, 2014 Posted September 7, 2014 addCommandHandler ( "staffchat", fuction ( thePlayer, _, ... ) if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), "staff" ) ) then for i, p in ipairs ( getElementsByType ( "player" ) ) do if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(p)) "staff" ) ) then outputChatBox ( "[staff] ".. getPlayerName ( p ) ..": ".. table.concat({...}, " "), p, 0, 0, 120 ) end end end end ) If your nick wouldn't be acc could create problems. why "getPlayerName(p)" this will write the name of admin players its "getPlayerName (thePlayer)" ? function not fuction addCommandHandler ( "staffchat", function ( thePlayer, _, ... ) if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), "staff" ) ) then for i, p in ipairs ( getElementsByType ( "player" ) ) do if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(p)) "staff" ) ) then outputChatBox ( "[staff] ".. getPlayerName ( thePlayer ) ..": ".. table.concat({...}, " "), p, 0, 0, 120 ) end end end end ) ??? ( dont know if its correct )
marty000123 Posted September 7, 2014 Author Posted September 7, 2014 addCommandHandler ( "s", function ( thePlayer, _, ... ) if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(thePlayer)), "Staff" ) ) then for i, p in ipairs ( getElementsByType ( "player" ) ) do if ( isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(p)) "Staff" ) ) then outputChatBox ( "[staff] ".. getPlayerName ( p ) ..": ".. table.concat({...}, " "), p, 0, 0, 120 ) end end end end ) I tested it and put it in my server.lua, uploaded it, did /s blahblah and it didnt work, nothing happened. Any idea's?
The Killer Posted September 7, 2014 Posted September 7, 2014 check if there any group named 'Staff' in ACL
tosfera Posted September 7, 2014 Posted September 7, 2014 People are right, the getPlayerName ( p ) should be getPlayerName ( thePlayer ). Another thing, make sure the player is logged in. Else it'll just not work. Sorry for the typo's with function and the p, lmao.
joaosilva099 Posted September 7, 2014 Posted September 7, 2014 It dont work bcs you have.to change " Staff" acl name to aclGetGroup("Staff")
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