GetBansXML: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
{{Server function}}
{{Server function}}
{{Deprecated}}
{{Deprecated}}
Please use [[getBans]]
This function retrieves the root [[xmlnode]] of the ban file (server/mods/deathmatch/banlist.xml).
This function retrieves the root [[xmlnode]] of the ban file (server/mods/deathmatch/banlist.xml).



Revision as of 21:17, 20 April 2011

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be a more generic way to perform what it does.


Please use getBans

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