ZH-CN/aclRemoveRight: 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 removes the given right...")
 
No edit summary
 
(One intermediate revision by the same 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 removes the given right (string) from the given 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 aclRemoveRight ( acl theAcl, string rightName )  
bool aclRemoveRight ( acl theAcl, string rightName )  
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[acl]]:removeRight||}}
{{OOP_ZH-CN||[[acl]]:removeRight||}}
===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 remove the right from
*'''theAcl:''' 要从中移除右侧的ACL
*'''rightName:''' The ACL name to remove from the right from
*'''rightName:''' 要从右侧删除的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 given right was successfully removed from the given ACL, ''false'' or ''nil'' if it could not be removed for some reason, ie. it didn't exist in the ACL.
如果给定的权限已成功从给定的ACL中删除,则返回“true”;如果由于某种原因无法删除,即ACL中不存在该权限,则返回“false”或“nil”.


==Example==  
==示例==  
This example removes an acl right on resource start.
此示例在资源启动时删除acl权限.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler("onResourceStart",resourceRoot,function()
addEventHandler("onResourceStart",resourceRoot,function()
Line 30: Line 30:
<!-- 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}}
[[zh-cn:aclRemoveRight]]
[[en:aclRemoveRight]]

Latest revision as of 07:10, 6 February 2021

此函数用于从给定ACL中删除给定的权限(字符串).

语法

bool aclRemoveRight ( acl theAcl, string rightName ) 

OOP 语法 什么是OOP?

方法: acl:removeRight(...)

必填参数

  • theAcl: 要从中移除右侧的ACL
  • rightName: 要从右侧删除的ACL名称

返回值

如果给定的权限已成功从给定的ACL中删除,则返回“true”;如果由于某种原因无法删除,即ACL中不存在该权限,则返回“false”或“nil”.

示例

此示例在资源启动时删除acl权限.

addEventHandler("onResourceStart",resourceRoot,function()
   aclRemoveRight(aclGet("Admin"),"function.setServerPassword")
end)

See Also