@scolen
You can give this utility function a try (untested). It is important to know that you can only check this information serverside.
--[[
Check if the player is inside of an acl group with a specific name
Argument 1: player element
Argument 2: aclGroupName string
]]
function isPlayerInAclGroupWithName (player, aclGroupName)
-- Check if the player argument is filled in correctly
if not isElement(player) or getElementType(player) ~= "player" then
error("Expected player element at argument 1, got " .. inspect(player), 2)
end
-- Check if the aclGroupName is filled in correctly
if type(aclGroupName) ~= "string" then
error("Expected string at argument 2, got " .. inspect(aclGroupName), 2)
end
-- Get the player account and check if the player is logged in
local account = getPlayerAccount ( player )
if isGuestAccount(account) then return false end
-- Get the acl group
local aclGroup = aclGetGroup ( aclGroupName )
if not aclGroup then return false end
-- Check if the account name of the user is inside of the acl group
local accountName = getAccountName ( account )
return isObjectInACLGroup ("user." .. accountName, aclGroup)
end
Usage:
if isPlayerInAclGroupWithName(player, "police") then
outputChatBox("I am the police", player)
end