diff --git a/client/main.lua b/client/main.lua index f5153f44..9461339e 100644 --- a/client/main.lua +++ b/client/main.lua @@ -132,4 +132,13 @@ Citizen.CreateThread(function() end end end +end) + +-- close the menu when script is restarting to avoid being stuck in NUI focus +AddEventHandler('onResourceStop', function(resource) + if resource == GetCurrentResourceName() then + if menuIsShowed then + TriggerEvent('esx_atm:closeATM') + end + end end) \ No newline at end of file diff --git a/html/scripts/app.js b/html/scripts/app.js index f05256bb..3a643a28 100644 --- a/html/scripts/app.js +++ b/html/scripts/app.js @@ -34,10 +34,29 @@ $(window).ready(function () { $('#deposit_amount').val(0); }) + $('#deposit_amount').on("keyup", function(e) { + if (e.keyCode == 13) { + $.post('http://esx_atm/deposit', JSON.stringify({ + amount: $('#deposit_amount').val() + })); + $('#deposit_amount').val(0); + } + }); + $('#withdraw_btn').on('click', function () { $.post('http://esx_atm/withdraw', JSON.stringify({ amount: $('#withdraw_amount').val() })); $('#withdraw_amount').val(0); }); + + $('#withdraw_amount').on("keyup", function(e) { + if (e.keyCode == 13) { + $.post('http://esx_atm/withdraw', JSON.stringify({ + amount: $('#withdraw_amount').val() + })); + $('#withdraw_amount').val(0); + } + }); + }); diff --git a/html/ui.html b/html/ui.html index fca7b0eb..a8e18bad 100644 --- a/html/ui.html +++ b/html/ui.html @@ -14,12 +14,12 @@
diff --git a/html/ui_de.html b/html/ui_de.html index ae941d43..5ae0905b 100644 --- a/html/ui_de.html +++ b/html/ui_de.html @@ -14,12 +14,12 @@ diff --git a/html/ui_en.html b/html/ui_en.html index 3b77bab8..3f95141c 100644 --- a/html/ui_en.html +++ b/html/ui_en.html @@ -14,12 +14,12 @@ diff --git a/server/main.lua b/server/main.lua index a9e8448e..704bb176 100644 --- a/server/main.lua +++ b/server/main.lua @@ -6,6 +6,8 @@ AddEventHandler('esx_atm:deposit', function(amount) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) amount = tonumber(amount) + + if not tonumber(amount) then return end amount = round(amount) if amount == nil or amount <= 0 or amount > xPlayer.getMoney() then TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount')) @@ -21,6 +23,8 @@ AddEventHandler('esx_atm:withdraw', function(amount) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) amount = tonumber(amount) + + if not tonumber(amount) then return end amount = round(amount) local accountMoney = 0 accountMoney = xPlayer.getAccount('bank').money