GetBansXML

From Multi Theft Auto: Wiki
Revision as of 12:18, 22 December 2008 by Awwu (talk | contribs) (New page: {{Server function}} __NOTOC__ This function retrieves the root xmlnode of the ban file (server/mods/deathmatch/banlist.xml). ==Syntax== <syntaxhighlight lang="lua"> xmlnode getBansXML () </syntaxhighlight> ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function retrieves the root xmlnode of the ban file (server/mods/deathmatch/banlist.xml).

Syntax

xmlnode getBansXML ()

Returns

Returns a xmlnode, false if something went wrong.

Example

This example prints the amount of bans in the banfile to the chat when player uses command banamount.

function tellPlayerBanAmount ( thePlayer )
    local bansNode = getBansXML () -- get the root node of ban file
    local children = xmlNodeGetChildren ( bansNode ) -- get the children (bans) of the root xml node
    outputChatBox ( "There are " .. #children .. " bans in the ban file.", thePlayer ) -- print the size of children table to the chat
end
addCommandHandler ( "banamount", tellPlayerBanAmount )

See Also