Scripting Posted April 15, 2012 Share Posted April 15, 2012 Hi All, I want ask how i can use Xml Files for Load and Save text in it. exemple: text1 = guiGetText(edit) xmlLoadFile("xml1") how i can save the text1 in xml file 1 and Save it and thx . Link to comment
Castillo Posted April 15, 2012 Share Posted April 15, 2012 The function xmlLoadFile is used to load a XMlL file, then you have to write with other XML functions. Link to comment
Scripting Posted April 15, 2012 Author Share Posted April 15, 2012 (edited) ]I can use other code for Xml Files to save a text? if can tell me pls how! Contunie my exemple Edited April 15, 2012 by Guest Link to comment
Castillo Posted April 15, 2012 Share Posted April 15, 2012 Check the example here: https://wiki.multitheftauto.com/wiki/XmlNodeSetValue Link to comment
Scripting Posted April 15, 2012 Author Share Posted April 15, 2012 Man I m bad in Xml Files,Can give me a help, how i can in "xmlLoadFie" get a text Link to comment
Castillo Posted April 15, 2012 Share Posted April 15, 2012 As I said, read the example in that page. Link to comment
Scripting Posted April 15, 2012 Author Share Posted April 15, 2012 Ok my exemple that work?? the xml file: 60 60 tab 1 in client-side: function ClientResourceStart () text1 = guiGetText(edit1) xmlRootTree = xmlLoadFile ( "userSettings.xml" ) if xmlRootTree then xmlNodeSetValue (xmlCreateChild ( xmlHudBranch, "IconSizeX"), "" .. text1 .. "" ) end addEventHandler ( "onClientResourceStart", root, ClientResourceStart ) Link to comment
Smart. Posted April 15, 2012 Share Posted April 15, 2012 what the fuck? no, read the XML section at the wiki. Link to comment
Scripting Posted April 15, 2012 Author Share Posted April 15, 2012 Solidrsnake I have a exemple, if i want save the money of the players in a xml file, server-side: addEventHandler(onPlayerQuit,root, function () money = getPlayerMoney(source) how i can save the money in a one Child??! Link to comment
Castillo Posted April 15, 2012 Share Posted April 15, 2012 You should start with easier things, e.g, saving / loading simple texts and so on. Link to comment
Smart. Posted April 15, 2012 Share Posted April 15, 2012 We wont tell you how to do it, you will have to learn it yourself, if you come up with a somewhat code, we'll be able to help you. But, like solidsnake said, you should really try something easier. Link to comment
drk Posted April 15, 2012 Share Posted April 15, 2012 You can at least show an example, Solidsnaka: text = guiCreateEdit ( 500, 500, 100, 70, '', false ); button = guiCreateButton ( 650, 500, 80, 80, 'Get', false ); addEventHandler ( 'onClientGUIClick', root, function ( ) if ( source == button ) then local text1 = guiGetText ( text ); local fText = xmlCreateFile ( 'test.xml', 'root' ); local child = xmlCreateChild ( fText, 'myText' ); xmlNodeSetValue ( child, tostring ( text1 ) ); xmlSaveFile ( fText ); end end ) This will create a edit and a button, when you press the button, it will get edit text, create a xml file with a 'root' node and create a new child 'myText' and set his text to edit text then save the file and end. 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