ZH-CN/aclSave

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

每当修改ACL时,ACL XML文件都会自动保存,但出于性能原因,自动保存最多可延迟10秒。调用此函数将强制立即保存.

语法

bool aclSave ()

OOP 语法 什么是OOP?

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

返回值

如果ACL已成功更改,则返回“true”;如果由于某种原因(如文件正在使用)无法保存,则返回“false”或“nil”.

示例

此示例在有人键入“/save ACL”时保存ACL.

function saveACL ( thePlayer, command ) -- 函数标题.也是定义图层的地方
	local saved = aclSave() -- 保存ACL
		if ( saved ) then -- 如果成功保存,则...
			outputChatBox ( "ACL was successfully saved.", thePlayer, 255, 0, 0 ) -- 输出已保存
		else -- If it wasn't saved for whatever reason then...
			outputChatBox ( "An unexpected error occured.", thePlayer, 255, 0, 0 ) -- 输出它没有保存输出
		end
end
addCommandHandler ( "save-acl", saveACL ) -- 使其触发“/save-acl”

See Also