Jump to content

Search the Community

Showing results for tags 'tojson'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 1 result

  1. Miika

    toJSON bug?

    Hello there, I've almost finished my vehicle shop / saving / control system but i got this error when i log out or reconnect: ERROR: wangcars/shop_server.lua:16: Couldn't convert userdata argument to JSON, only valid resources can be included for this function. I've tested and the result is table but toJSON says that it is userdata. It still saves it to accountdata in toJSON and i can unpack it with fromJSON. So is this mta bug or what? Saving function: addEventHandler("onPlayerLogout", root, function(account) local data = getElementData(source, "wangcars.data") if data then if account and not isGuestAccount(account) then if isElement(wangvehicle[source]) then local id = getElementData(wangvehicle[source], "wangcars.id") local x, y, z = getElementPosition(wangvehicle[source]) local rx, ry, rz = getElementRotation(wangvehicle[source]) data[id][6] = x..", "..y..", "..z..", "..rx..", "..ry..", "..rz data[id][8] = getElementHealth(wangvehicle[source]) setElementData(source, "wangcars.data", data) destroyElement(wangvehicle[source]) wangvehicle[source] = nil end setAccountData(account, "wangcars.data", toJSON(getElementData(source, "wangcars.data"))) -- error there, but it still saves it setElementData(source, "wangcars.data", false) triggerClientEvent(source, "wangcars.refreshgrid", source) end end end ) I have almost same function when player quit but no need to post it. I could just ignore this, but it's anoying because it always outputs error in debugscript when somebody disconnects and i'm trying to keep debug clean as possible.
×
×
  • Create New...