ZH-CN/AclDestroyGroup: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
Line 48: Line 48:
<!-- 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:aclDestroyGroup]]
[[en:AclDestroyGroup]]
[[en:AclDestroyGroup]]
[[zh-cn:AclDestroyGroup]]

Latest revision as of 18:17, 21 February 2021

此函数将销毁给定的ACL组.销毁的ACL组将不再有效.

语法

bool aclDestroyGroup ( aclgroup aclGroup )

OOP 语法 什么是OOP?

方法: aclgroup:destroy(...)

必填参数

  • aclGroup: 要销毁的ACL组元素

返回值

如果ACL组已成功删除,则返回“true”;如果由于某种原因(即无效参数)无法删除,则返回“false”.

示例

此示例允许管理员删除他们指定的ACL组.

function removeACLGroup ( source, command, groupName )
-- 检查他们是不是管理员...
	if ( isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "Admin" ) ) ) then
		if ( groupName ) then -- 检查他们是否指定了组名
			local group = aclGetGroup ( groupName ) -- 返回与名称匹配的任何组
				if ( group ) then -- If any were returned then...
					aclDestroyGroup ( group ) -- 删除这个组
				else
					-- 告诉他们是否找不到具有该名称的组...
					outputChatBox ( "No group with that name was found.", source, 255, 0, 0 )
				end
	
		else -- 如果他们没有指定组
			outputChatBox ( "Please specify the group name.", source, 255, 0, 0 ) -- Tell them that they must
		end
	else -- 如果他们不是管理员....
		outputChatBox ( "You must be an admin to use this command", source, 255, 0, 0 ) -- Tell them it's restricted
	end
end
addCommandHandler ( "removeACL", removeACLGroup ) -- 当玩家输入 "/removeACL"时触发的事件

See Also