qalle-git / esx-qalle-sellvehicles

This gives you the opportunity to sell cars to eachother.
25 stars 35 forks source link

Offline Player does not receive money (FIX) #30

Open tupixx opened 3 years ago

tupixx commented 3 years ago

function UpdateCash(identifier, cash) local xPlayer = ESX.GetPlayerFromIdentifier(identifier)

if xPlayer ~= nil then
    xPlayer.addAccountMoney("bank", cash)

    TriggerClientEvent("esx:showNotification", xPlayer.source, "Someone bought your vehicle and transferred $" .. cash)
else
    MySQL.Async.fetchAll('SELECT accounts FROM users WHERE identifier = @identifier', { ["@identifier"] = identifier }, function(result)
        if result[1] ~= nil then
    local accs = json.decode(result[1].accounts)

accs.bank = accs.bank + cash MySQL.Async.execute("UPDATE users SET account = @newBank WHERE identifier = @identifier", { ["@identifier"] = identifier, ["@newBank"] = json.encode(accs) } ) end end) end end

xNEORAI commented 3 years ago

This is the fix code for offline player recive the money?

ShxwZ commented 3 years ago

This is the fix code for offline player recive the money?

y

ElChapo64 commented 2 years ago

Someone can help me, i use "Discord" for replace "Identifier" in DATABASE, I can't adapt the script so that it is correctly linked to the database. Thank you for your help