Jump to content

toJSON being funky..


Forrest

Recommended Posts

Having a few problems with toJSON since MTA 1.4. I'm currently working on my handling system once again, and since 1.4 certain vehicles will not create the JSON string correctly.

For instance, if I save a Ranchers handling I will end up with:

[ [ 2500, 7604.2001953125, 2.5, [ 0, 0, -0.34999999403953552 ], 80, 0.69999998807907104, 0.85000002384185791, 0.54000002145767212, 5, 170, 8, 5, "rwd", "petrol", 7, 0.40000000596046448, false, 25, 0.34999999403953552, 0.079999998211860657, 0, 0.44999998807907104, 0.10000000149011612, 0.40000000596046448, 0.30000001192092896, 0.43999999761581421, 0.34999999403953552, 40000, 16416, 8455, "long", "small", 0 ] ]

This is good, this is what I want and need.

However if I save a Primo, I end up with:

[ { "1": 1600, "2": 3300, "3": 2.2000000476837158, "4": [ 0, 0, 0 ], "5": 70, "6": 0.69999998807907104, "7": 0.80000001192092896, "8": 0.54000002145767212, "9": 4, "10": 160, "11": 7.1999998092651367, "12": 7, "13": "fwd", "14": "petrol", "15": 5.4000000953674316, "16": 0.60000002384185791, "17": false, "18": 30, "19": 1.1000000238418579, "20": 0.14000000059604645, "21": 0, "22": 0.31999999284744263, "23": -0.10000000149011612, "24": 0.5, "25": 0, "26": 0.25999999046325684, "27": 0.54000002145767212, "28": 19000, "29": 0, "30": 0, "31": "long", "33": 0 } ]

Which for some reason is indexing everything. Anyone have any ideas what to do? Thanks.

Link to comment
You're missing an item - number 32 in the second list (which probably should be "small").

Haha, yeah. A buddy pointed it out a little while after posting this. Lord knows how I missed it, probably because I was tired. Thanks though pal, made a quick fix and voila, working perfect. :)

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...