GhostXoP Posted December 3, 2012 Share Posted December 3, 2012 Up until i had added a weapon into the array, it appears this isn't being saved, in fact, it isnt keeping the user logged in like it has before. Before, i would set account data, but first get the account and it would appear as "logged in", but now, when i log out after account creation it says that the account wasn't logged in to begin with. I have a feeling i'm not getting the account / storing account data properly. function CreateClientAccount(Username, Password) if addAccount(Username,Password) == false then triggerClientEvent(source,"AccountCreationProgress", getRootElement(), false) return else --Set Player Stats local PlayerBriefCase = { Weapons = {}, Health = {}, Vehicles = {}, Buildings = {}, HealthStat = 100, MoneyStat = 25 } PlayerBriefCase.Weapons[22] = {ID = 22, Ammo = 5 } local account = getAccount(Username, Password) setAccountData(account, "Life.BriefCase", toJSON(PlayerBriefCase)) outputChatBox(account) --Number outputs, the player is usually considered logged in at this point, but for some reason it stopped doing this.. logOut(source) triggerClientEvent(source,"AccountCreationProgress", getRootElement(), true) return end end addEvent("AccountCreationAttempt", true) addEventHandler("AccountCreationAttempt", getRootElement(), CreateClientAccount) Is the function that deals with creation of default stats, then gives the user a pistol (My way) for when that user logs in again Link to comment
GhostXoP Posted December 3, 2012 Author Share Posted December 3, 2012 So i have figured out that the problem is when it gets to line 15. If i remove that, the data is saved, if i keep it the data is not. How is this happening, why is it not working? Edit: *Its when i add anything to the table after its been declared it doesn't get saved. Link to comment
Castillo Posted December 3, 2012 Share Posted December 3, 2012 Do you get errors in the debug? Link to comment
GhostXoP Posted December 3, 2012 Author Share Posted December 3, 2012 None, the array is sent if its just line 13. If i involve 14, it does not send. I know this because it will set the money to 25 without 14, but with 14 i get errors saying the array is nil (array wasnt sent) Ive tried sending as JSON strings, and regular arrays. Ive even sent and then used for and in pairs to merge all data. Its not getting stored Link to comment
GhostXoP Posted December 3, 2012 Author Share Posted December 3, 2012 They array being extracted from the account data, is nil with 14 without 14 the array is stored in the account data. Link to comment
Castillo Posted December 3, 2012 Share Posted December 3, 2012 Are you sure that isn't saving? maybe it is saving, but the JSON string is just too long for account data ( it has a limit ). Link to comment
GhostXoP Posted December 3, 2012 Author Share Posted December 3, 2012 A limit?..... Are you kidding me? Link to comment
GhostXoP Posted December 3, 2012 Author Share Posted December 3, 2012 What is the limit amount? Link to comment
Castillo Posted December 3, 2012 Share Posted December 3, 2012 No, I'm not kidding, it has a limit, I once tried to save all player weapons on JSON string with account data and it got cut at the end. I don't know the limit. Link to comment
GhostXoP Posted December 3, 2012 Author Share Posted December 3, 2012 Someone should figure this out and post it in the wiki Link to comment
50p Posted December 3, 2012 Share Posted December 3, 2012 If limit is SQLite limit then: http://sqlite.org/limits.html#max_length I don't think MTA has its own limit, if it does then it's unknown to me. Link to comment
Cadu12 Posted December 3, 2012 Share Posted December 3, 2012 MTA has own limit. Take a look: http://code.google.com/searchframe#KdIe ... q=&l=10494 Limit: 128 Link to comment
GhostXoP Posted December 3, 2012 Author Share Posted December 3, 2012 MTA has own limit. Take a look: Nice catch, il be sure to write a function that stores giant json strings but fragmenting them so others on here wont have this problem. Thanks for the find 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