Jump to content

setAccountData Bug


myjobisgop

Recommended Posts

Hi!

I found a bag of function setAccountData

Let i have an array with a large number of keys (over 10 for example):

  
BigArray = { 
            Key1 = "Value 1", 
            Key2 = "Value 2", 
            Key3 = "Value 3", 
            Key4 = {"A", "ABC", "124"}, 
            Key5 = {{"C", "D", "1244"}, "F"}, 
            Key6 = {"value 6"} 
             
            ..... 
        } 
  

And next I want to save that array on a player account if a player leaves the game:

Note: I save that array only for registered players (not for guest)

  
addEventHandler ("onPlayerQuit", getRootElement(), 
    function(quitType, reason, responsibleElement) 
        local playerAccount = getPlayerAccount(source) 
         
        local BigArrayForSave = toJSON(BigArray) 
  
        if (isGuestAccount(playerAccount) == false) then 
                     setAccountData(playerAccount, "SaveBigArray", BigArrayForSave) 
        end 
         
        playerAccount = nil 
    end 
) 
  

And when a player enters in a game I want to get that array from his account:

  
addEventHandler("onPlayerLogin", getRootElement(), 
    function(thePreviousAccount, theCurrentAccount, autoLogin) 
         if (isGuestAccount(getPlayerAccount(source)) == false) then 
            local lastBigArray = getAccountData(theCurrentAccount, "SaveBigArray") 
        end 
    end 
) 
  

But now lastBigArray is shorter than the line length of BigArrayForSave:

  
string.len(BigArrayForSave) > string.len(lastBigArray) 
  

Am I doing something wrong or is that a bug of MTA?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...