Jump to content

Help with nodes


Recommended Posts

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 :S

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...") 
addCommandHandler ("bank", createBankAccount ) 

Please help

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...