AclObjectGetGroups

From Multi Theft Auto: Wiki
Revision as of 12:17, 18 October 2023 by Tracer (talk | contribs) (Created page with "__NOTOC__ {{Server function}} This function returns a table of all groups the object is in. ==Syntax== <syntaxhighlight lang="lua"> table aclObjectGetGroups ( string object ) </syntaxhighlight> ===Required Arguments=== * '''object:''' The name of the ACL entry to get groups of ===Returns=== Returns a table of all groups the object is in on success, false if something went wrong. ==Examples== This example outputs a list of all groups of the calling user <section...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function returns a table of all groups the object is in.

Syntax

table aclObjectGetGroups ( string object )

Required Arguments

  • object: The name of the ACL entry to get groups of

Returns

Returns a table of all groups the object is in on success, false if something went wrong.

Examples

This example outputs a list of all groups of the calling user

Click to collapse [-]
addCommandHandler("listGroups",function(player)
	local account = getPlayerAccount(player)
	if not account or isGuestAccount(account) then return end

	outputChatBox('Groups:', player)

	for _,v in ipairs(aclObjectGetGroups('user.'..getAccountName(account)) do
		outputChatBox('* '..aclGroupGetName(v))
	end
end)


See Also