diff --git a/__resource.lua b/__resource.lua index 10f49234..024bfe07 100644 --- a/__resource.lua +++ b/__resource.lua @@ -1,18 +1,25 @@ -description 'ESX ATM' +server_script{ + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', + 'server/esx_atm_sv.lua' +} -server_script 'server/esx_atm_sv.lua' - -client_script { - 'config.lua', - 'client/esx_atm_cl.lua' +client_script{ + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', + 'client/esx_atm_cl.lua' } ui_page 'html/ui.html' -files { - 'html/ui.html', - 'html/pdown.ttf', - 'html/img/cursor.png', - 'html/css/app.css', - 'html/scripts/app.js' +files{ + 'html/ui.html', + 'html/pdown.ttf', + 'html/img/cursor.png', + 'html/css/app.css', + 'html/scripts/app.js' } \ No newline at end of file diff --git a/client/esx_atm_cl.lua b/client/esx_atm_cl.lua index b0fa1854..8b959333 100644 --- a/client/esx_atm_cl.lua +++ b/client/esx_atm_cl.lua @@ -74,7 +74,7 @@ Citizen.CreateThread(function() if(GetDistanceBetweenCoords(coords, Config.ATMS[i].x, Config.ATMS[i].y, Config.ATMS[i].z, true) < Config.ZoneSize.x / 2) then isInATMMarker = true SetTextComponentFormat('STRING') - AddTextComponentString('Appuyez sur ~INPUT_PICKUP~ pour déposer ou retirer du ~g~cash~s~.') + AddTextComponentString(_U('press_e_atm')) DisplayHelpTextFromStringLabel(0, 0, 1, -1) end end diff --git a/config.lua b/config.lua index a57596af..da5415ab 100644 --- a/config.lua +++ b/config.lua @@ -5,8 +5,9 @@ Config.ZoneSize = {x = 3.0, y = 3.0, z = 0.3} Config.MarkerColor = {r = 100, g = 100, b = 204} Config.ZDiff = 2.0 Config.BlipSprite = 431 +Config.Locale = 'fr' - Config.ATMS = { +Config.ATMS = { { ['x'] = -386.733, ['y'] = 6045.953, ['z'] = 31.501}, { ['x'] = -110.753, ['y'] = 6467.703, ['z'] = 31.784}, { ['x'] = 155.4300, ['y'] = 6641.991, ['z'] = 31.784}, diff --git a/locales/en.lua b/locales/en.lua new file mode 100644 index 00000000..4af17004 --- /dev/null +++ b/locales/en.lua @@ -0,0 +1,6 @@ +Locales['en'] = { + ['invalid_amount'] = '~r~invalid amount', + ['deposit_money'] = 'you have deposited ~g~$', + ['withdraw_money'] = 'you withdrawn ~g~$', + ['press_e_atm'] = 'press sure ~INPUT_PICKUP~ for deposit or withdraw from ~g~ATM~s~.', +} \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua new file mode 100644 index 00000000..5a7e81c2 --- /dev/null +++ b/locales/fr.lua @@ -0,0 +1,6 @@ +Locales['fr'] = { + ['invalid_amount'] = '~r~montant invalide', + ['deposit_money'] = 'vous avez déposé ~g~$', + ['withdraw_money'] = 'vous avez retiré ~g~$', + ['press_e_atm'] = 'appuyez sur ~INPUT_PICKUP~ pour déposer ou retirer du ~g~cash~s~.', +} \ No newline at end of file diff --git a/server/esx_atm_sv.lua b/server/esx_atm_sv.lua index ca05e499..341b7c1f 100644 --- a/server/esx_atm_sv.lua +++ b/server/esx_atm_sv.lua @@ -7,11 +7,11 @@ AddEventHandler('esx_atm:deposit', function(amount) local xPlayer = ESX.GetPlayerFromId(_source) amount = tonumber(amount) if amount == nil or amount <= 0 or amount > xPlayer.getMoney() then - TriggerClientEvent('esx:showNotification', _source, '~r~Montant invalide') + TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount')) else xPlayer.removeMoney(amount) xPlayer.addAccountMoney('bank', amount) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez déposé ~g~' .. amount .. '$~s~.') + TriggerClientEvent('esx:showNotification', _source, _U('deposit_money') .. amount .. '~s~.') TriggerClientEvent('esx_atm:closeATM', _source) end end) @@ -25,11 +25,11 @@ AddEventHandler('esx_atm:withdraw', function(amount) local accountMoney = 0 accountMoney = xPlayer.getAccount('bank').money if amount == nil or amount <= 0 or amount > accountMoney then - TriggerClientEvent('esx:showNotification', _source, '~r~Montant invalide') + TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount')) else xPlayer.removeAccountMoney('bank', amount) xPlayer.addMoney(amount) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez retiré ~g~' .. amount .. '$~s~.') + TriggerClientEvent('esx:showNotification', _source, _U('withdraw_money') .. amount .. '~s~.') TriggerClientEvent('esx_atm:closeATM', _source) end end) \ No newline at end of file