isObjectInACLGroup
Client-side
Server-side
Shared
This function is used to determine if an object is in a group.
If you want to restrict access to certain things, instead of limiting it to specific groups using this function, consider using hasObjectPermissionTo. That way, you can restrict access to features regardless of group membership.
OOP Syntax Help! I don't understand this!
- Method: aclgroup:doesContainObject(...)
Syntax
bool isObjectInACLGroup ( string theObject, aclgroup theGroup )
Required Arguments
- theObject: The name of the object to check. Examples: "resource.ctf", "user.Jim".
- theGroup: The ACL group pointer of the group from which the object should be found.
Returns
- bool: result
Returns true if the object is in the specified group, false otherwise.
Code Examples
server
This example adds a jetpack
command that is only available to admins. When entering the command, it will toggle the player's jetpack.
addCommandHandler("jetpack", function(thePlayer) if (doesPedHaveJetPack(thePlayer)) then -- If the player have a jetpack already, remove it removePedJetPack(thePlayer) -- Remove the jetpack return -- And stop the function here end
-- Otherwise, give him one if he has access
local accName = getAccountName(getPlayerAccount(thePlayer)) -- get his account name if (isObjectInACLGroup("user."..accName, aclGetGroup("Admin"))) then -- Does he have access to Admin functions? if (not doesPedHaveJetPack(thePlayer)) then -- If the player doesn't have a jetpack give it. givePedJetPack(thePlayer) -- Give the jetpack end endend)
See Also
ACL Functions
- aclCreate
- aclCreateGroup
- aclDestroy
- aclDestroyGroup
- aclGet
- aclGetName
- aclGetRight
- aclGetGroup
- aclGroupAddACL
- aclGroupAddObject
- aclGroupGetName
- aclGroupList
- aclGroupListObjects
- aclGroupListACL
- aclGroupRemoveACL
- aclGroupRemoveObject
- aclList
- aclListRights
- aclObjectGetGroups
- aclReload
- aclRemoveRight
- aclSave
- aclSetRight
- hasObjectPermissionTo
- isObjectInACLGroup