ZH-CN/AclDestroy: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
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 destroys the ACL passed. The destroyed ACL will no longer be valid.
此函数将销毁传递的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">
Line 10: Line 10:
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[acl]]:destroy||}}
{{OOP||[[acl]]:destroy||}}
===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 -->
*'''theACL:''' The ACL to destroy
*'''theACL:''' The ACL to destroy


===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 successfully destroyed and ''false'' if it could not be deleted (ie. it's not valid).
Returns ''true'' if successfully destroyed and ''false'' if it could not be deleted (ie. it's not valid).


==Example==  
==示例==  
<!-- 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:
This example shows you a command to delete an ACL:

Revision as of 01:55, 6 February 2021

此函数将销毁传递的ACL。销毁的ACL将不再有效.

语法

bool aclDestroy ( acl theACL )

OOP Syntax Help! I don't understand this!

Method: acl:destroy(...)


必填参数

  • theACL: The ACL to destroy

返回值

Returns true if successfully destroyed and false if it could not be deleted (ie. it's not valid).

示例

This example shows you a command to delete an ACL:

function deleteSomeACL ( thePlayer, cmdname, theACL )
    if aclGet ( theACL ) then --Check if the specified ACL exists
        --If it does
        local deleted = aclDestroy ( theACL ) --Try to delete the ACL
        if deleted then --If the ACL has been deleted
            --We will give the player a succes-message
            outputChatBox ( "ACL " ..theACL.. " Succesfully removed!", thePlayer )
        else --If there was something wrong while deleting
            --We send the player an error message
            outputChatBox ( "Error while removing ACL " ..theACL.. "!", thePlayer )
        end
    else --If the ACL doesn't exists
        outputChatBox ( "Error: Invalid ACL Name specified, or the ACL doesn't exist.", thePlayer )
    end
end
addCommandHandler ( "deleteACL", deleteSomeACL ) --Add the commandhandler

See Also