ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. xmlCreateFile

Function

xmlCreateFile

Server and clientXMLIdentical to MTA:SA

Creates a new XML document with a root node of the given name. The document is in memory; it reaches the disk only after xmlSaveFile. An existing file is overwritten on save.

Syntax

xmlnode xmlCreateFile(string filePath, string rootNodeName)

Arguments

filePathstring
File path in the resource folder.
rootNodeNamestring
Root node name (letters, digits, _, -, ., :).

Returns

The root node, or false.

Example

local root = xmlCreateFile("bans.xml", "bans")
local ban = xmlCreateChild(root, "ban")
xmlNodeSetAttribute(ban, "serial", "ABC123")
xmlNodeSetAttribute(ban, "reason", "Cheaty")
xmlSaveFile(root)
xmlUnloadFile(root)

See also