Woovie Posted February 2, 2008 Share Posted February 2, 2008 My code function createBankAccount ( player, commandName, playname ) cash = getPlayerMoney ( player ) xmlCreateFile ( playname.xml, info ) xmlCreateSubNode ( info, bank ) xmlSaveFile ( info ) outputChatBox ("BANK SOON ?") xmlNodeSetValue ( bank, 0 ) end addCommandHandler ("cba", createBankAccount ) I did "/cba woovie" as a command and received this. It does say "BANK SOON ?" though. Once it hits the XML stuff none of it works... [17:40:08] WARNING: bank.lua: Bad argument @ 'xmlCreateFile' - Line: 3 [17:40:08] WARNING: bank.lua: Bad argument @ 'xmlCreateSubNode' - Line: 4 [17:40:08] WARNING: bank.lua: Bad argument @ 'xmlSaveFile' - Line: 5 [17:40:08] WARNING: bank.lua: Bad argument @ 'xmlNodeSetValue' - Line: 7 Link to comment
mabako Posted February 2, 2008 Share Posted February 2, 2008 function createBankAccount ( player, commandName, playname ) cash = getPlayerMoney ( player ) -- info = xmlCreateFile ( "playname.xml", "info" ) -- create the file "playname.xml" which looks like "<info/>" xmlCreateSubNode ( info, "bank" ) -- add a subnode <bank>, now we got "<info><bank/></info>" xmlNodeSetValue ( bank, 0 ) -- change the value, "<info><bank>0</bank></info>" xmlSaveFile ( info ) -- save the file xmlUnloadFile( info ) -- unload it after use outputChatBox ("BANK SOON ?") end addCommandHandler ("cba", createBankAccount ) cba = can't be arsed :') I should have an idea what I'm doing with XML at least, my houseeditor for pen1:legends is based on XML, so are my accounts files... etc. Link to comment
Woovie Posted February 3, 2008 Author Share Posted February 3, 2008 MABAKO I LOVE YOU. Getting one issue. xmlNodeSetValue ( bank, 0 ) Bad argument ? I tried other values too and still no good... Link to comment
50p Posted February 3, 2008 Share Posted February 3, 2008 2nd argument must me a string! So try this: xmlNodeSetValue ( bank, "0" ) Link to comment
KillFrenzy Posted February 3, 2008 Share Posted February 3, 2008 function createBankAccount ( player, commandName, playname ) cash = getPlayerMoney ( player ) -- infofile = xmlCreateFile ( "playname.xml", "info" ) -- create the file "playname.xml" which looks like "" banknode = xmlCreateSubNode ( infofile, "bank" ) -- add a subnode , now we got "" xmlNodeSetValue ( banknode, 0 ) -- change the value, "0" xmlSaveFile ( infofile ) -- save the file xmlUnloadFile( infofile ) -- unload it after use outputChatBox ("BANK SOON ?") end addCommandHandler ("cba", createBankAccount ) Does the work? Link to comment
mabako Posted February 3, 2008 Share Posted February 3, 2008 ah I see change xmlCreateSubNode ( info, "bank" ) -- add a subnode <bank>, now we got "<info><bank/></info>" xmlNodeSetValue ( bank, 0 ) -- change the value, "<info><bank>0</bank></info>" to local subnode = xmlCreateSubNode ( info, "bank" ) -- add a subnode <bank>, now we got "<info><bank/></info>" xmlNodeSetValue ( subnode, 0 ) -- change the value, "<info><bank>0</bank></info>" Link to comment
Woovie Posted February 3, 2008 Author Share Posted February 3, 2008 Same error =S I PMed you all my code. My deposit nor withdrawal are working. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now