marty000123 Posted October 12, 2014 Share Posted October 12, 2014 Hi I suggested this more times before but it never worked. I'm trying something else now. I'm looking for a staffchat. If you press M you will talk in staffchat. Only players in the ACL group ''Staff'' will be able to use the Staffchat (M button). If someone enters a message and sends it, only ppl in the ''Staff'' ACL group will be able to hear it. Thanks in advance Marty (So if Staff's from ACL group ''Staff'' press M, they can talk in Staffchat, no matter how, but make it work C: ) Link to comment
Anubhav Posted October 12, 2014 Share Posted October 12, 2014 addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do local acc = getAccountName(getPlayerAccount(player)) if ( isObjectInACLGroup( "user."..acc, aclGetGroup("Staff")) ) then bindKey(player, "m", "down", "chatbox", "sc") end end end) function getAdmins() local staffs = {} for k,v in ipairs(getElementsByType("player")) do local acc = getAccountName(getPlayerAccount(v)) if ( isObjectInACLGroup( "user."..acc, aclGetGroup("Staff")) ) then table.insert(staffs, v) end end return staffs end addEventHandler("onPlayerLogin", root, function() local acc = getAccountName(getPlayerAccount(source)) if ( isObjectInACLGroup( "user."..acc, aclGetGroup("Staff")) ) then bindKey(source, "m", "down", "chatbox", "sc") end end ) function staffChat(player, _, ...) local acc = getAccountName(getPlayerAccount(player)) if ( isObjectInACLGroup( "user."..acc, aclGetGroup("Staff")) ) then if #getAdmins() == 1 then return end local r, g, b = getPlayerNametagColor( player ) local msg = string.gsub(tostring(table.concat({...}, " ")), "#%x%x%x%x%x%x", "") for i, v in ipairs(getAdmins()) do outputChatBox("(ADMIN-CHAT)"..getPlayerName(player)..":#ffffff"..msg, v, r, g, b, true) end end end addCommandHandler("sc", staffChat) 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