el_business icon indicating copy to clipboard operation
el_business copied to clipboard

ER_BAD_FIELD_ERROR New ESX

Open RuisSoftware opened this issue 4 years ago • 5 comments

Can someone update this line to new ESX?

MySQL.Sync.execute('UPDATE users SET bank = bank + @bank WHERE identifier = @identifier',{['@bank'] = money, ['@identifier'] = identifier})

bank is not a bank column anymore. It's merged with money, black_money in the same column called accounts.

RuisSoftware avatar May 12 '20 13:05 RuisSoftware

not gonna be supporting new esx versions anytime soon, sorry

Elipse458 avatar May 12 '20 13:05 Elipse458

:(

RuisSoftware avatar May 12 '20 13:05 RuisSoftware

Maybe someone else?

Can't you open it for a bit longer time ?

RuisSoftware avatar May 12 '20 13:05 RuisSoftware

Is the script working otherwise? Is it just the database query that is the problem? If it is, it should be possible to concatenate the result into a json-encoded result in that exact field (accounts). Check how the othe esx_banking scripts are doing the transaction, and do the same with this script. :) Something like this? xPlayer.addAccountMoney('bank', tonumber(amount))

Ref: ESX-Banking

EDIT: It is es_extended that works with MySQL and database queries (Ref. https://github.com/ESX-Org/es_extended/blob/master/server/main.lua)

christerjohansson avatar May 13 '20 18:05 christerjohansson

MySQL.Async.fetchAll("SELECT accounts FROM users WHERE identifier = @identifier", {
    ["@identifier"] = identifier
}, function(result)
    if result[1].accounts and result[1].accounts ~= "" then
        local accounts = json.decode(result[1].accounts)
        accounts.bank = accounts.bank + money
        MySQL.Sync.execute("UPDATE users SET accounts = @accounts WHERE identifier = @identifier", {
            ["@accounts"] = json.encode(accounts),
            ["@identifier"] = identifier
        })
    end
end)

xqth avatar Jul 26 '20 08:07 xqth