ZH-CN/AclCreateGroup: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) No edit summary |
Qwe7769611 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
此函数用于在ACL中创建组。ACL组可以包含玩家和资源等对象.它们指定谁有权访问此组中的ACL | |||
== | ==语法== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
aclgroup aclCreateGroup ( string groupName ) | aclgroup aclCreateGroup ( string groupName ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | {{OOP_ZH-CN||[[aclgroup|ACLGroup]]||}} | ||
=== | ===必填参数=== | ||
*'''groupName:''' | *'''groupName:''' 要创建的组的名称 | ||
=== | ===返回值=== | ||
Returns the pointer to the created aclgroup if successful. Returns false if failed. | Returns the pointer to the created aclgroup if successful. Returns false if failed. | ||
== | ==示例== | ||
此示例添加了一个命令''addobjecttogroup'',使用该命令可以轻松地将新对象添加到指定的访问控制列表组中. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function addACLGroupObject ( thePlayer, commandName, groupName, objectName ) | function addACLGroupObject ( thePlayer, commandName, groupName, objectName ) | ||
local ourGroup = aclGetGroup ( groupName ) | local ourGroup = aclGetGroup ( groupName ) | ||
-- | -- 如果以前没有使用此名称的组,则需要创建一个 | ||
if not ourGroup then | if not ourGroup then | ||
ourGroup = aclCreateGroup ( groupName ) | ourGroup = aclCreateGroup ( groupName ) | ||
end | end | ||
-- | -- 如果没有给出对象名 | ||
if not objectName then | if not objectName then | ||
-- | -- 将消息发送到聊天室 | ||
return outputChatBox ( "You need to specify the object!", thePlayer ) | return outputChatBox ( "You need to specify the object!", thePlayer ) | ||
end | end | ||
-- | -- 最后,让我们将对象添加到它的组中 | ||
aclGroupAddObject ( ourGroup, objectName ) | aclGroupAddObject ( ourGroup, objectName ) | ||
-- | -- 不要忘记在修改ACL后保存它 | ||
aclSave () | aclSave () | ||
end | end |
Revision as of 09:49, 5 February 2021
此函数用于在ACL中创建组。ACL组可以包含玩家和资源等对象.它们指定谁有权访问此组中的ACL
语法
aclgroup aclCreateGroup ( string groupName )
OOP 语法 什么是OOP?
- 方法: ACLGroup(...)
必填参数
- groupName: 要创建的组的名称
返回值
Returns the pointer to the created aclgroup if successful. Returns false if failed.
示例
此示例添加了一个命令addobjecttogroup,使用该命令可以轻松地将新对象添加到指定的访问控制列表组中.
function addACLGroupObject ( thePlayer, commandName, groupName, objectName ) local ourGroup = aclGetGroup ( groupName ) -- 如果以前没有使用此名称的组,则需要创建一个 if not ourGroup then ourGroup = aclCreateGroup ( groupName ) end -- 如果没有给出对象名 if not objectName then -- 将消息发送到聊天室 return outputChatBox ( "You need to specify the object!", thePlayer ) end -- 最后,让我们将对象添加到它的组中 aclGroupAddObject ( ourGroup, objectName ) -- 不要忘记在修改ACL后保存它 aclSave () end addCommandHandler ( "addobjecttogroup", addACLGroupObject )
See Also
- aclCreate
- aclCreateGroup
- aclDestroy
- aclDestroyGroup
- aclGet
- aclGetGroup
- aclGetName
- aclGetRight
- aclGroupAddACL
- aclGroupAddObject
- aclGroupGetName
- aclGroupList
- aclGroupListACL
- aclGroupListObjects
- aclGroupRemoveACL
- aclGroupRemoveObject
- aclList
- aclListRights
- aclReload
- aclRemoveRight
- aclSave
- aclSetRight
- hasObjectPermissionTo
- isObjectInACLGroup