ZH-CN/aclGroupAddACL: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} <!-- Describe in plain english what this function does. Don't go into details, just give an overview --> This function adds the given ACL to th...")
 
mNo edit summary
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:
{{Server function}}  
{{Server function}}  
<!-- 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 adds the given ACL to the given ACL group. This makes the resources and players in the given ACL group have access to what's specified in the given ACL. The rights for something in the different ACL's in a group are OR-ed together, which means if one ACL gives access to something, this ACL group will have access to that.
此函数用于将给定ACL添加到给定ACL组。这使得给定ACL组中的资源和玩家可以访问给定ACL中指定的内容.一个组中不同ACL中的某个内容的权限被合并在一起,这意味着如果一个ACL允许访问某个内容,那么这个ACL组将有权访问该内容.


==Syntax==  
==语法==  
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool aclGroupAddACL ( aclgroup theGroup, acl theACL )
bool aclGroupAddACL ( aclgroup theGroup, acl theACL )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[aclgroup]]:addACL||}}
{{OOP_ZH-CN||[[aclgroup]]:addACL||}}
===Required Arguments===  
===必填参数===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''theGroup:''' The group to add the ACL to
*'''theGroup:''' 要将ACL添加到的组
*'''theACL:''' The ACL to add to the group
*'''theACL:''' 要添加到组的ACL


===Returns===
===返回值===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns ''true'' if the ACL could be successfully added to the ACL group, ''false''/''nil'' if either of the elements are invalid, the ACL is already in that group or if something else goes wrong.
如果ACL可以成功添加到ACL组,则返回“true”;如果其中任何一个元素无效,则返回“false”/“nil”;如果ACL已在该组中,或出现其他错误,则返回“true”.


==Example==
==示例==
This example adds a command ''addAclGroup'' with which you can easily add new access control lists to specified acl Groups.
此示例添加了一个命令“addAclGroup”,使用该命令可以轻松地将新的访问控制列表添加到指定的acl组.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function addAclGroup ( thePlayer, commandName, aclName )
function addAclGroup ( thePlayer, commandName, aclName )
Line 29: Line 29:
end
end
aclGroup = aclGetGroup("Admin")
aclGroup = aclGetGroup("Admin")
aclGroupAddACL(aclGroup,acl) -- now all Admins have the rights of acl, too
aclGroupAddACL(aclGroup,acl) -- 现在所有的管理员都有acl的权限了
aclSave ()  
aclSave ()  
addCommandHandler ( "addAclGroup", addAclGroup)
addCommandHandler ( "addAclGroup", addAclGroup)
Line 37: Line 37:
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{ACL_functions}}
{{ACL_functions}}
[[ar:aclGroupAddACL]]
[[en:AclGroupAddACL]]
[[zh-cn:aclGroupAddACL]]
[[zh-cn:aclGroupAddACL]]

Latest revision as of 18:28, 21 February 2021

此函数用于将给定ACL添加到给定ACL组。这使得给定ACL组中的资源和玩家可以访问给定ACL中指定的内容.一个组中不同ACL中的某个内容的权限被合并在一起,这意味着如果一个ACL允许访问某个内容,那么这个ACL组将有权访问该内容.

语法

bool aclGroupAddACL ( aclgroup theGroup, acl theACL )

OOP 语法 什么是OOP?

方法: aclgroup:addACL(...)

必填参数

  • theGroup: 要将ACL添加到的组
  • theACL: 要添加到组的ACL

返回值

如果ACL可以成功添加到ACL组,则返回“true”;如果其中任何一个元素无效,则返回“false”/“nil”;如果ACL已在该组中,或出现其他错误,则返回“true”.

示例

此示例添加了一个命令“addAclGroup”,使用该命令可以轻松地将新的访问控制列表添加到指定的acl组.

function addAclGroup ( thePlayer, commandName, aclName )
if(aclName) then
    acl = aclCreate ( aclName )
else
    acl = aclCreate("myName")
end
aclGroup = aclGetGroup("Admin")
aclGroupAddACL(aclGroup,acl) -- 现在所有的管理员都有acl的权限了
aclSave () 
addCommandHandler ( "addAclGroup", addAclGroup)

See Also