ZH-CN/AclDestroy: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 12: Line 12:
===必填参数===  
===必填参数===  
<!-- 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:''' The ACL to destroy
*'''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 -->
Returns ''true'' if successfully destroyed and ''false'' if it could not be deleted (ie. it's not valid).
如果成功销毁,则返回“true”;如果无法删除,则返回“false”(意思就是它是一个空值).


==示例==  
==示例==  
<!-- Explain what the example is in a single sentance -->
<!-- Explain what the example is in a single sentance -->
This example shows you a command to delete an ACL:
此示例显示了删除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 --Check if the specified ACL exists
     if aclGet ( theACL ) then --检查指定的ACL是否存在
         --If it does
         --If it does
         local deleted = aclDestroy ( theACL ) --Try to delete the ACL
         local deleted = aclDestroy ( theACL ) --尝试删除ACL
         if deleted then --If the ACL has been deleted
         if deleted then --如果ACL已被删除
             --We will give the player a succes-message
             --我们会发送给玩家一个成功删除的消息
             outputChatBox ( "ACL " ..theACL.. " Succesfully removed!", thePlayer )
             outputChatBox ( "ACL " ..theACL.. " Succesfully removed!", thePlayer )
         else --If there was something wrong while deleting
         else --如果删除时出错
             --We send the player an error message
             --我们向玩家发送一条错误消息
             outputChatBox ( "Error while removing ACL " ..theACL.. "!", thePlayer )
             outputChatBox ( "Error while removing ACL " ..theACL.. "!", thePlayer )
         end
         end
     else --If the ACL doesn't exists
     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 ) --Add the commandhandler
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]]
[[en: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