Nissandrifter Posted August 21, 2008 Share Posted August 21, 2008 Well me and another scripter have been trying to make a different account system as the standard MTA one is bugged. We made it all and it worked fine to begin with but now it just gives lots of the same error on the same line. We can't work out what is wrong. _getClientAccount = getClientAccount function getClientAccount(source) if xml then local count = 0 local account = xmlFindSubNode(xml,"account",count) local name = getClientName(source) while (xmlNodeGetAttribute(account,"name") ~= name or false) do count = count + 1 account = xmlFindSubNode(xml,"account",count) end if xmlNodeGetAttribute(account,"name") == name then return account end end return false end The line with the error on: while (xmlNodeGetAttribute(account,"name") ~= name or false) do with this error Bad argument @ 'xmlNodeGetAttribute' Link to comment
Gamesnert Posted August 21, 2008 Share Posted August 21, 2008 I'm pretty sure I know why: It loops, but does not detect when to stop except if the node is found it needs. If it doesn't find the correct node, it'll give an error. EDIT: Hmmm... Didn't read well... Gotta read a bit better... =/ EDIT2: I see it! (I think =/) It's in these lines: local count = 0 local account = xmlFindSubNode(xml,"account",count) local name = getClientName(source) 3 lines, entirely different. Except for 1 point: A word you should avoid using if you want it to work with loops: ... The only word all 3 lines have! Link to comment
[UVA]Bart Posted August 21, 2008 Share Posted August 21, 2008 i have used xml to make a account system, really i think you shoudl learn sql or make a sql account system, i have moved on to sql for my fuel script and its faster, only problem you cannot add new columbs to the table well when i tried it wouldnt let me and with sql u dont have to loop ither Link to comment
Nissandrifter Posted August 21, 2008 Author Share Posted August 21, 2008 I tried sql and it just totally messed up and the inability of adding new columns to the table makes it less practical for my server. Link to comment
[UVA]Bart Posted August 21, 2008 Share Posted August 21, 2008 use a sql data browser to see whats in the table and add columns if your just using it for your server, google sql data browser then open the registry.db which can be found in the mta folder thats if you want another bash at it, when i was learning it i gave up then churchill gave me the data browser link and its soo much easier lol Link to comment
Nissandrifter Posted August 22, 2008 Author Share Posted August 22, 2008 Yeah I use the sql browser thing. Because my vehicles use the database. I might try again after I done some more important things for the server. Link to comment
churchill Posted August 22, 2008 Share Posted August 22, 2008 I don't know if it's of any use but you could have a look at the code in this resource which is a replacement for the accountData system, with storage switchable between SQL and XML. The XML portion will obviously be of most interest to you. https://community.multitheftauto.com/index.html?p ... ils&id=203 Link to comment
Gamesnert Posted August 22, 2008 Share Posted August 22, 2008 XML works fine and lagless for me! (it only reads & writes at the start & end, the rest is just tablework. And it's easy to edit ^^) Link to comment
Nissandrifter Posted August 22, 2008 Author Share Posted August 22, 2008 I did have a look at that before I tried to make an sql account system but I dont like how it can only be one name and one value instead of one name with all the data. Link to comment
[UVA]Bart Posted August 22, 2008 Share Posted August 22, 2008 XML works fine and lagless for me! (it only reads & writes at the start & end, the rest is just tablework. And it's easy to edit ^^) do you store in a table them write the table to sql ? before the server shutsdown and load it in to a table when the server starts? Link to comment
Gamesnert Posted August 22, 2008 Share Posted August 22, 2008 XML works fine and lagless for me! (it only reads & writes at the start & end, the rest is just tablework. And it's easy to edit ^^) do you store in a table them write the table to sql ? before the server shutsdown and load it in to a table when the server starts? No SQL, only XML. I just use my own save/load engine. It only costs 0.5 secs at start and 0.5 secs at stop. Then you have lag-free limitless editable XML saving! ^^ 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