ZH-CN/aclListRights: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
This function returns a table of all the rights that a given ACL has.
此函数返回给定ACL拥有的所有权限的表.


==Syntax==  
==语法==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table aclListRights ( acl theACL, string allowedType )
table aclListRights ( acl theACL, string allowedType )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[acl]]:listRights||}}
{{OOP_ZH-CN||[[acl]]:listRights||}}
===Required Arguments===  
===必填参数===  
*'''theACL:''' The ACL to get the rights from
*'''theACL:''' 要从中获取权限的ACL
*'''allowedType:''' The allowed right type. Possible values are ''general'', ''function'', ''resource'' and ''command''
*'''allowedType:''' 允许的正确类型.可能的值为 ''general'', ''function'', ''resource'' and ''command''


===Returns===
===返回值===
Returns a table over the rights as strings in the given ACL. This table might be empty. Returns ''false'' or ''nil'' if theACL is invalid or it fails for some other reason.
在给定ACL中以字符串形式返回权限上的表。这张表子可能是空的。如果acl无效或由于其他原因失败,则返回“false”或“nil”.


==Example==  
==示例==  
This example outputs the rights of the given acl. (TESTED!)
本例输出给定acl的权限.(已测试!)
<syntaxhighlight lang="lua">addCommandHandler("aclRights",function(player,command,theAcl)
<syntaxhighlight lang="lua">addCommandHandler("aclRights",function(player,command,theAcl)
if(theAcl~="")then
if(theAcl~="")then

Latest revision as of 07:05, 6 February 2021

此函数返回给定ACL拥有的所有权限的表.

语法

table aclListRights ( acl theACL, string allowedType )

OOP 语法 什么是OOP?

方法: acl:listRights(...)

必填参数

  • theACL: 要从中获取权限的ACL
  • allowedType: 允许的正确类型.可能的值为 general, function, resource and command

返回值

在给定ACL中以字符串形式返回权限上的表。这张表子可能是空的。如果acl无效或由于其他原因失败,则返回“false”或“nil”.

示例

本例输出给定acl的权限.(已测试!)

addCommandHandler("aclRights",function(player,command,theAcl)
	if(theAcl~="")then
		rights = aclListRights(aclGet(theAcl))
		count = 0
		for acl,list in pairs(rights)do
			outputChatBox("ACL List: "..theAcl.." #"..tostring(count).." Right: "..list..".",player)
			count = count + 1
		end
	else
		outputChatBox("Please type in a acl that you want to retrieve the rights from.",player)
		outputChatBox("Please use this Syntax: /aclRights theACL ",player)
	end
end)

See Also