Merge pull request #1 from CaliforniaRP/master

Multi-language support
This commit is contained in:
Jérémie N'gadi
2017-08-16 00:32:19 +02:00
committed by GitHub
9 changed files with 37 additions and 10 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ FXServer ESX Weapon Shops
1) CD in your resources/[esx] folder
2) Clone the repository
```
git clone https://github.com/FXServer-ESX/fxserver-esx_weashops.git esx_weashops
```
3) Import esx_weashops.sql in your database
4) Add this in your server.cfg :
@@ -1,11 +1,17 @@
description 'ESX Mecano Job'
client_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'config.lua',
'client/main.lua'
}
server_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'@mysql-async/lib/MySQL.lua',
'config.lua',
'server/main.lua'
@@ -45,7 +45,7 @@ function OpenShopMenu(zone)
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'shop',
{
title = 'Magasin',
title = _U('shop'),
elements = elements
},
function(data, menu)
@@ -56,7 +56,7 @@ function OpenShopMenu(zone)
menu.close()
CurrentAction = 'shop_menu'
CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au magasin.'
CurrentActionMsg = _U('shop_menu')
CurrentActionData = {zone = zone}
end
)
@@ -65,7 +65,7 @@ end
AddEventHandler('esx_weashop:hasEnteredMarker', function(zone)
CurrentAction = 'shop_menu'
CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au magasin.'
CurrentActionMsg = _U('shop_menu')
CurrentActionData = {zone = zone}
end)
@@ -89,7 +89,7 @@ Citizen.CreateThread(function()
SetBlipColour (blip, 2)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("GunShop")
AddTextComponentString(_U('map_blip'))
EndTextCommandSetBlipName(blip)
end
end
+1
View File
@@ -4,6 +4,7 @@ Config.DrawDistance = 100
Config.Size = {x = 1.5, y = 1.5, z = 1.5}
Config.Color = {r = 0, g = 128, b = 255}
Config.Type = 1
Config.Locale = 'en'
Config.Zones = {
+10
View File
@@ -0,0 +1,10 @@
Locales ['en'] = {
['buy'] = 'you bought',
['not_enough_black'] = 'you do not have enough dirty money',
['not_enough'] = 'you do not have enough money',
['shop'] = 'shop',
['shop_menu'] = 'Press ~INPUT_CONTENT~ to access the shop.',
['map_blip'] = 'gun shop',
}
+10
View File
@@ -0,0 +1,10 @@
Locales ['fr'] = {
['buy'] = 'vous avez acheté ~b~1x ',
['not_enough_black'] = 'Vous n\'avez ~r~pas assez~s~ d\'argent sale',
['not_enough'] = 'vous n\'avez ~r~pas assez~s~ d\'argent',
['shop'] = 'magasin',
['shop_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au magasin.',
['map_blip'] = 'armurerie',
}
@@ -50,7 +50,7 @@ ESX.RegisterServerCallback('esx_weashop:requestDBItems', function(source, cb)
end)
RegisterServerEvent('esx_weashop:buyItem')
AddEventHandler('esx_weashop:buyItem', function(itemName, price,zone)
AddEventHandler('esx_weashop:buyItem', function(itemName, price, zone)
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
@@ -61,10 +61,10 @@ AddEventHandler('esx_weashop:buyItem', function(itemName, price,zone)
xPlayer.removeAccountMoney('black_money', price)
xPlayer.addWeapon(itemName, 42)
TriggerClientEvent('esx:showNotification', _source, 'Vous avez acheté ~b~1x ' .. ItemsLabels[itemName])
TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ItemsLabels[itemName])
else
TriggerClientEvent('esx:showNotification', _source, 'Vous n\'avez ~r~pas assez~s~ d\'argent sale')
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_black'))
end
else if xPlayer.get('money') >= price then
@@ -72,10 +72,10 @@ AddEventHandler('esx_weashop:buyItem', function(itemName, price,zone)
xPlayer.removeMoney(price)
xPlayer.addWeapon(itemName, 42)
TriggerClientEvent('esx:showNotification', _source, 'Vous avez acheté ~b~1x ' .. ItemsLabels[itemName])
TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ItemsLabels[itemName])
else
TriggerClientEvent('esx:showNotification', _source, 'Vous n\'avez ~r~pas assez~s~ d\'argent.')
TriggerClientEvent('esx:showNotification', _source, _U('not_enough'))
end
end