AclGroupListObjects: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}<!-- Change this to "Client function" or "Server function" appropriately-->
{{Server function}}<!-- Change this to "Client function" or "Server function" appropriately-->
{{Needs Example}}
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
This function returns a table over all the objects that exist in a given ACL group. These are objects like players and resources.
This function returns a table over all the objects that exist in a given ACL group. These are objects like players and resources.
Line 20: Line 19:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example outputs a list of Objects if the ACL Group is given.
This example does...
<syntaxhighlight lang="lua">addCommandHandler("aclObjectList",function(player,command,aclGroup)
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
if(aclGroup~="")then
<syntaxhighlight lang="lua">
table = aclGroupListObjects(aclGetGroup(tostring(aclGroup)))
--TODO
count = 0
for objects,name in ipairs(#table)do
outputChatBox("ACL LIST: "..aclGroup.."Line: "..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)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 03:56, 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.

addCommandHandler("aclObjectList",function(player,command,aclGroup)
	if(aclGroup~="")then
		table = aclGroupListObjects(aclGetGroup(tostring(aclGroup)))
		count = 0
		for objects,name in ipairs(#table)do
			outputChatBox("ACL LIST: "..aclGroup.."Line: "..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