diff --git a/__resource.lua b/__resource.lua index 479a2226..543ec253 100644 --- a/__resource.lua +++ b/__resource.lua @@ -4,9 +4,17 @@ description 'ESX Billing' server_scripts { '@mysql-async/lib/MySQL.lua', + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', 'server/main.lua' } client_scripts { + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', 'client/main.lua' } diff --git a/config.lua b/config.lua new file mode 100644 index 00000000..56a8b5e9 --- /dev/null +++ b/config.lua @@ -0,0 +1,2 @@ +Config = {} +Config.Locale = 'fr' diff --git a/locales/en.lua b/locales/en.lua new file mode 100644 index 00000000..5271005b --- /dev/null +++ b/locales/en.lua @@ -0,0 +1,9 @@ +Locales['en'] = { + + ['invoices'] = 'invoices', + ['received_invoice'] = 'you ~r~received~s~ an invoice', + ['paid_invoice'] = 'you ~g~paid~s~ an invoice of ~r~$', + ['received_payment'] = 'you ~g~received~s~ a payment of ~r~$', + ['player_not_logged'] = 'the player is not logged in', + +} diff --git a/locales/fr.lua b/locales/fr.lua new file mode 100644 index 00000000..46f14598 --- /dev/null +++ b/locales/fr.lua @@ -0,0 +1,9 @@ +Locales['fr'] = { + + ['invoices'] = 'factures', + ['received_invoice'] = 'vous avez ~r~reçu~s~ une facture', + ['paid_invoice'] = 'vous avez ~g~payé~s~ une facture de ~r~$', + ['received_payment'] = 'vous avez ~g~reçu~s~ un paiement de ~g~$', + ['player_not_logged'] = 'le joueur n\'est pas connecté', + +} diff --git a/server/main.lua b/server/main.lua index 75c5a788..213da1e7 100644 --- a/server/main.lua +++ b/server/main.lua @@ -26,7 +26,7 @@ AddEventHandler('esx_billing:sendBill', function(playerId, sharedAccountName, la ['@amount'] = amount }, function(rowsChanged) - TriggerClientEvent('esx:showNotification', v.source, 'Vous avez ~r~reçu~s~ une facture') + TriggerClientEvent('esx:showNotification', v.source, _U('received_invoice')) end ) @@ -51,7 +51,7 @@ AddEventHandler('esx_billing:sendBill', function(playerId, sharedAccountName, la ['@amount'] = amount }, function(rowsChanged) - TriggerClientEvent('esx:showNotification', v.source, 'Vous avez ~r~reçu~s~ une facture') + TriggerClientEvent('esx:showNotification', v.source, _U('received_invoice')) end ) @@ -114,7 +114,7 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id) local target = result[1].target local amount = result[1].amount local xPlayers = ESX.GetPlayers() - local foundPlayer = nil + local foundPlayer = nil for k,v in pairs(xPlayers) do if v.identifier == sender then @@ -126,7 +126,7 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id) if targetType == 'player' then if foundPlayer ~= nil then - + if xPlayer.get('money') >= amount then MySQL.Async.execute( @@ -139,8 +139,8 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id) xPlayer.removeMoney(amount) foundPlayer.addMoney(amount) - TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez ~g~payé~s~ une facture de ~r~$' .. amount) - TriggerClientEvent('esx:showNotification', foundPlayer.source, 'Vous avez ~g~reçu~s~ un paiement de ~g~$' .. amount) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_invoice') .. amount) + TriggerClientEvent('esx:showNotification', foundPlayer.source, _U('received_payment') .. amount) cb() @@ -148,7 +148,7 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id) ) else - TriggerClientEvent('esx:showNotification', _source, 'Le joueur n\'est pas connecté') + TriggerClientEvent('esx:showNotification', _source, _U('player_not_logged')) cb() end @@ -168,17 +168,17 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id) xPlayer.removeMoney(amount) account.addMoney(amount) - TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez ~g~payé~s~ une facture de ~r~$' .. amount) - + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_invoice') .. amount) + if foundPlayer ~= nil then - TriggerClientEvent('esx:showNotification', foundPlayer.source, 'Vous avez ~g~reçu~s~ un paiement de ~g~$' .. amount) + TriggerClientEvent('esx:showNotification', foundPlayer.source, _U('received_payment') .. amount) end cb() end ) - + end) end @@ -186,4 +186,4 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, id) end ) -end) \ No newline at end of file +end)