Hi, i was expirimenting with nodes with this /bank command. i want it to save the amount of money to a node with xmlNodeSetAttribute but cant seem to get it working
to look like this in the playname.xml
function createBankAccount ( player, commandName )
cash = getPlayerMoney ( player )
--
playname = xmlLoadFile("playname.xml")
info = xmlCreateFile ( "playname.xml", "info" ) -- create the file "playname.xml" which looks like "<info/>"
xmlCreateSubNode ( info, "user" ) -- add a subnode <bank>, now we got "<info><user/></info>"
local banknode = xmlFindSubNode(playname, "user", 0)
xmlNodeSetAttribute(banknode, "bank", tostring(cash))
--xmlNodeSetValue ( bank, tostring( cash ) ) -- change the value, "<info><bank>0</bank></info>" --do not use
xmlSaveFile ( info ) -- save the file
xmlUnloadFile( info ) -- unload it after use
outputChatBox ("Banking...")
end
addCommandHandler ("bank", createBankAccount )
Please help