AclGroupListObjects: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 20: Line 20:


==Example==  
==Example==  
This example outputs a list of Objects if the ACL Group is given.
This example outputs a list of Objects if the ACL Group is given. (TESTED!)
<syntaxhighlight lang="lua">addCommandHandler("aclObjectList",function(player,command,aclGroup)
<syntaxhighlight lang="lua">addCommandHandler("aclObjectList",function(player,command,aclGroup)
if(aclGroup~="")then
if(aclGroup~="")then
table = aclGroupListObjects(aclGetGroup(tostring(aclGroup)))
table = aclGroupListObjects(aclGetGroup(aclGroup))
count = 0
count = 0
for objects,name in ipairs(#table)do
for objects,name in pairs(table)do
outputChatBox("ACL LIST: "..aclGroup.."Line: "..tostring(count).." Object: "..name..".",player)
outputChatBox("ACL LIST: "..aclGroup.." #"..tostring(count).." Object: "..name..".",player)
count = count + 1
count = count + 1
end
end

Revision as of 21:04, 27 April 2012

This function returns a table over all the objects that exist in a given ACL group. These are objects like players and resources.

Syntax

table of string aclGroupListObjects ( aclgroup theGroup )

Required Arguments

  • theGroup: The ACL group to get the objects from

Returns

Returns a table over the objects in the given ACL group. This table might be empty. Returns false or nil if theGroup is invalid or it fails for some other reason.

Example

This example outputs a list of Objects if the ACL Group is given. (TESTED!)

addCommandHandler("aclObjectList",function(player,command,aclGroup)
	if(aclGroup~="")then
		table = aclGroupListObjects(aclGetGroup(aclGroup))
		count = 0
		for objects,name in pairs(table)do
			outputChatBox("ACL LIST: "..aclGroup.." #"..tostring(count).." Object: "..name..".",player)
			count = count + 1
		end
	else
		outputChatBox("Please add the aclGroup you want the list of.",player)
		outputChatBox("Syntax: /aclObjectList aclGroup",player)
	end
end)

See Also