Renamed files

This commit is contained in:
ElPumpo
2018-06-09 11:40:15 +02:00
parent 4857ad6de7
commit cd9f08b729
3 changed files with 2 additions and 2 deletions
+35
View File
@@ -0,0 +1,35 @@
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('esx_atm:deposit')
AddEventHandler('esx_atm:deposit', function(amount)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
amount = tonumber(amount)
if amount == nil or amount <= 0 or amount > xPlayer.getMoney() then
TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount'))
else
xPlayer.removeMoney(amount)
xPlayer.addAccountMoney('bank', amount)
TriggerClientEvent('esx:showNotification', _source, _U('deposit_money', amount))
TriggerClientEvent('esx_atm:closeATM', _source)
end
end)
RegisterServerEvent('esx_atm:withdraw')
AddEventHandler('esx_atm:withdraw', function(amount)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
amount = tonumber(amount)
local accountMoney = 0
accountMoney = xPlayer.getAccount('bank').money
if amount == nil or amount <= 0 or amount > accountMoney then
TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount'))
else
xPlayer.removeAccountMoney('bank', amount)
xPlayer.addMoney(amount)
TriggerClientEvent('esx:showNotification', _source, _U('withdraw_money', amount))
TriggerClientEvent('esx_atm:closeATM', _source)
end
end)