0

I have an object called result, which after being applied JSON.stringify returns in the console:

[{"x":-257,"y":6618,"z":7}]

I'm trying to get all of the above values by using result.x, result.y and result.z, but they're all returning undefined. What am I doing wrong?

Here's a part of the code for context:

async function verifyUser(license, playerName, player) {
    global.exports["mysql-async"].mysql_fetch_all(
        'SELECT * FROM users WHERE license = @license', 
        { 'license': license }, (result) => {
            playerInfo = result
            if (!playerInfo) {
                //do this
            }
            else {
                global.exports["mysql-async"].mysql_fetch_all(
                    'SELECT x, y, z FROM users WHERE license = @license', 
                    { 'license': license }, (result) => {
                        print(result)
                        print(JSON.stringify(result))
                        resultString = (JSON.stringify(result))
                        print(JSON.stringify(result.x))
                        print(result.y)
                        print(result.z)
                        SetEntityCoords(player, result.x, result.y, result.z, true, false, false, false)
                    })
                print('^5' + playerName + '^7 entrou no servidor.')
            }
        })
}

0 Answers0