ZH-CN/AclDestroy: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) (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 destroys the ACL passed....") |
mNo edit summary |
||
(4 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 --> | ||
此函数将销毁传递的ACL.销毁的ACL将不再有效. | |||
== | ==语法== | ||
<!-- 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"> | ||
Line 10: | Line 10: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[acl]]:destroy||}} | {{OOP||[[acl]]:destroy||}} | ||
=== | ===必填参数=== | ||
<!-- 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 --> | ||
*'''theACL:''' | *'''theACL:''' 要销毁的ACL | ||
=== | ===返回值=== | ||
<!-- 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 --> | ||
如果成功销毁,则返回“true”;如果无法删除,则返回“false”(意思就是它是一个空值). | |||
== | ==示例== | ||
<!-- Explain what the example is in a single sentance --> | <!-- Explain what the example is in a single sentance --> | ||
此示例显示了删除ACL的命令: | |||
<!-- 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 --> | <!-- 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 --> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function deleteSomeACL ( thePlayer, cmdname, theACL ) | function deleteSomeACL ( thePlayer, cmdname, theACL ) | ||
if aclGet ( theACL ) then -- | if aclGet ( theACL ) then --检查指定的ACL是否存在 | ||
--If it does | --If it does | ||
local deleted = aclDestroy ( theACL ) -- | local deleted = aclDestroy ( theACL ) --尝试删除ACL | ||
if deleted then -- | if deleted then --如果ACL已被删除 | ||
-- | --我们会发送给玩家一个成功删除的消息 | ||
outputChatBox ( "ACL " ..theACL.. " Succesfully removed!", thePlayer ) | outputChatBox ( "ACL " ..theACL.. " Succesfully removed!", thePlayer ) | ||
else -- | else --如果删除时出错 | ||
-- | --我们向玩家发送一条错误消息 | ||
outputChatBox ( "Error while removing ACL " ..theACL.. "!", thePlayer ) | outputChatBox ( "Error while removing ACL " ..theACL.. "!", thePlayer ) | ||
end | end | ||
else -- | else --如果ACL不存在 | ||
outputChatBox ( "Error: Invalid ACL Name specified, or the ACL doesn't exist.", thePlayer ) | outputChatBox ( "Error: Invalid ACL Name specified, or the ACL doesn't exist.", thePlayer ) | ||
end | end | ||
end | end | ||
addCommandHandler ( "deleteACL", deleteSomeACL ) -- | addCommandHandler ( "deleteACL", deleteSomeACL ) --添加命令处理程序 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 44: | Line 44: | ||
<!-- 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:aclDestroy]] | |||
[[en:AclDestroy]] | |||
[[zh-cn:AclDestroy]] | [[zh-cn:AclDestroy]] |
Latest revision as of 18:15, 21 February 2021
此函数将销毁传递的ACL.销毁的ACL将不再有效.
语法
bool aclDestroy ( acl theACL )
OOP Syntax Help! I don't understand this!
- Method: acl:destroy(...)
必填参数
- theACL: 要销毁的ACL
返回值
如果成功销毁,则返回“true”;如果无法删除,则返回“false”(意思就是它是一个空值).
示例
此示例显示了删除ACL的命令:
function deleteSomeACL ( thePlayer, cmdname, theACL ) if aclGet ( theACL ) then --检查指定的ACL是否存在 --If it does local deleted = aclDestroy ( theACL ) --尝试删除ACL if deleted then --如果ACL已被删除 --我们会发送给玩家一个成功删除的消息 outputChatBox ( "ACL " ..theACL.. " Succesfully removed!", thePlayer ) else --如果删除时出错 --我们向玩家发送一条错误消息 outputChatBox ( "Error while removing ACL " ..theACL.. "!", thePlayer ) end else --如果ACL不存在 outputChatBox ( "Error: Invalid ACL Name specified, or the ACL doesn't exist.", thePlayer ) end end addCommandHandler ( "deleteACL", deleteSomeACL ) --添加命令处理程序
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