Mittell Buurman Posted December 30, 2012 Share Posted December 30, 2012 I'm making a GUI where you can store radio frequencies, But where can I store the values Clientside? It sets the items into the gridlistn, but when I close the window and reopen it, everything is gone. Link to comment
Castillo Posted December 30, 2012 Share Posted December 30, 2012 You can store them on a lua table, then when re-open the GUI, loop the table and insert them into the grid list. Link to comment
callum123 Posted December 31, 2012 Share Posted December 31, 2012 I think he wants it so the people who use the GUI can go on it and store their own data. And then store that clientside and not in like an sql table. Link to comment
Mittell Buurman Posted December 31, 2012 Author Share Posted December 31, 2012 I want it to store clientside, like callum said. But how do you do that? Link to comment
Castillo Posted December 31, 2012 Share Posted December 31, 2012 You can use client side XML. https://wiki.multitheftauto.com/wiki/Cli ... _functions Link to comment
Mittell Buurman Posted January 1, 2013 Author Share Posted January 1, 2013 I got the XML file made, but now it doesn't read or misses the table, nor does it add rows/values into the gridlist. function setRadioChannel(button, state) local channel = xmlNodeGetChildren(xmlRootTree) if (source == bChanSet) then for k, v in ipairs(channel) do local channelFreq = guiGetText(eChanFreq) local channelDesc = guiGetText(eChanDesc) local row = guiGridListAddRow(gRadioGrid) if channelFreq then guiGridListSetItemText( gRadioGrid, row, colFreq, channelFreq, false, false) guiGridListSetItemData( gRadioGrid, row, colFreq, channelFreq) outputDebugString("channelFreq Read, value " .. tostring(channelFreq) "set to row " .. tostring(row)) end if channelDesc then guiGridListSetItemText( gRadioGrid, row, colDesc, channelDesc, false, false) guiGridListSetItemData( gRadioGrid, row, colDesc, channelDesc) outputDebugString("channelFreq Read, value " .. tostring(channelDesc) "set to row " .. tostring(row)) end end end end addEventHandler("onClientGUIClick", getRootElement(), setRadioChannel) Link to comment
Castillo Posted January 1, 2013 Share Posted January 1, 2013 Post the full code. P.S: Never name a function like a native MTA function ( setRadioChannel ), unless you want to replace it. Link to comment
Mittell Buurman Posted January 1, 2013 Author Share Posted January 1, 2013 Check your inbox. Link to comment
Castillo Posted January 1, 2013 Share Posted January 1, 2013 How you want to load something that doesn't exist? you aren't writting anything on the file, also, you should load them on start, not when you add it. Link to comment
Mittell Buurman Posted January 1, 2013 Author Share Posted January 1, 2013 (edited) They load from the start don't they? Im quite new to scripting / xml functions so I'm having some trouble with it. Edited January 1, 2013 by Guest 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