Open RuisSoftware opened 4 years ago
not gonna be supporting new esx versions anytime soon, sorry
:(
Maybe someone else?
Can't you open it for a bit longer time ?
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)
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)
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.