Volltron Posted February 19, 2017 Share Posted February 19, 2017 I wanted to make a script so that admins can chat between them function adminMessage(thePlayer, cmd, ...) local message = table.concat ( { ... }, " " ); local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local tableadmin = { } if (isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) )) then table.insert(tableadmin,thePlayer) for i,admins in ipairs(tableadmin) do outputChatBox("#04B486[ADMIN-CHAT]"..name..": #FFFFFF"..message, admins, 255, 255, 255, true) end end end addCommandHandler("adminchat", adminMessage) I would really apreciate it if someone could help me Link to comment
pa3ck Posted February 19, 2017 Share Posted February 19, 2017 (edited) You are on the right track, except that you never actually loop through the admins, you just loop through a table that has only 1 element in it, the user that executed the command. function adminMessage(thePlayer, cmd, ...) local message = table.concat ( { ... }, " " ); local name = getPlayerName(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) for k, adm in ipairs(getElementsByType("player")) do local acc = getAccountName ( getPlayerAccount ( adm ) ) if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then outputChatBox("#04B486[ADMIN-CHAT]"..name..": #FFFFFF"..message, adm, 255, 255, 255, true) end end end addCommandHandler("adminchat", adminMessage) (not tested) Edited February 19, 2017 by pa3ck Link to comment
' A F . Posted February 19, 2017 Share Posted February 19, 2017 use isGuestAccount to avoid bugs Link to comment
Volltron Posted February 19, 2017 Author Share Posted February 19, 2017 Thanks, it works. The only problem is that anyone can write but only the admin sees what you write Link to comment
pa3ck Posted February 19, 2017 Share Posted February 19, 2017 Add this after accName = ... if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then return 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