ZH-CN/aclReload

From Multi Theft Auto: Wiki
Revision as of 07:08, 6 February 2021 by Qwe7769611 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

此函数用于从ACL XML文件重新加载ACL和ACL组。所有ACL和ACL组元素在调用后都无效,不应再使用.

语法

bool aclReload ()

OOP 语法 什么是OOP?

提示: This function is a static function underneath the ACL class.
方法: ACL.reload(...)

返回值

如果XML已成功从文件中重新加载,则返回“true”;如果XML无效、不存在或由于其他原因无法加载,则返回“false”或“nil”.

示例

此示例允许管理员通过键入“/reloadACL”来重新加载ACL.

function reloadACL ( source, command )
-- 检查他们是不是管理员...
	if ( isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "Admin" ) ) ) then
		local reload = aclReload() -- 重新加载ACL
			if ( reload ) then -- 检查是否已成功重新加载
				outputChatBox ( "ACL was successfully reloaded.", source, 255, 0, 0 ) -- If so, output it
			else -- 如果没有,输出下面一行↓
				outputChatBox ( "An unknown error occured. Please check the ACL file exists.", source, 255, 0, 0 )
			end
	else -- 如果他们不是管理员,输出下面一行↓
		outputChatBox ( "You must be an admin to use this command!", source, 255, 0, 0 )
	end
end
addCommandHandler ( "reloadACL", reloadACL )

See Also