Multi-language support

This commit is contained in:
nearbyplayer
2017-08-16 21:44:39 -04:00
parent eb7bcf36eb
commit 61b65663a4
6 changed files with 90 additions and 35 deletions
+8 -2
View File
@@ -1,11 +1,17 @@
dependency 'essentialmode'
client_script {
client_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'config.lua',
'client/esx_holdup_cl.lua'
}
server_script {
server_scripts {
'@es_extended/locale.lua',
'locales/en.lua',
'locales/fr.lua',
'config.lua',
'server/esx_holdup_sv.lua'
}
+7 -7
View File
@@ -57,7 +57,7 @@ end)
RegisterNetEvent('esx_holdup:toofarlocal')
AddEventHandler('esx_holdup:toofarlocal', function(robb)
holdingup = false
ESX.ShowNotification('Le braquage vas être annulé, vous ne gagnerez rien!')
ESX.ShowNotification(_U('robbery_cancelled'))
robbingName = ""
secondsRemaining = 0
incircle = false
@@ -67,7 +67,7 @@ end)
RegisterNetEvent('esx_holdup:robberycomplete')
AddEventHandler('esx_holdup:robberycomplete', function(robb)
holdingup = false
ESX.ShowNotification('Braquage réussi vous avez gagné ~g~$' .. Stores[store].reward)
ESX.ShowNotification(_U('robbery_cancelled') .. Stores[store].reward)
store = ""
secondsRemaining = 0
incircle = false
@@ -94,7 +94,7 @@ Citizen.CreateThread(function()
SetBlipScale(blip, 0.8)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Braquage magasin")
AddTextComponentString(_U('shop_robbery'))
EndTextCommandSetBlipName(blip)
end
end)
@@ -110,10 +110,10 @@ Citizen.CreateThread(function()
if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 15.0)then
if not holdingup then
DrawMarker(1, v.position.x, v.position.y, v.position.z - 1, 0, 0, 0, 0, 0, 0, 1.0001, 1.0001, 1.5001, 1555, 0, 0,255, 0, 0, 0,0)
if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) < 1.0)then
if (incircle == false) then
DisplayHelpText("Appuyer sur ~INPUT_CONTEXT~ pour braquer ~b~" .. v.nameofstore)
DisplayHelpText(_U('press_to_rob') .. v.nameofstore)
end
incircle = true
if IsControlJustReleased(1, 51) then
@@ -128,8 +128,8 @@ Citizen.CreateThread(function()
if holdingup then
drawTxt(0.66, 1.44, 1.0,1.0,0.4, "Braquage de magasin: ~r~" .. secondsRemaining .. "~w~ secondes restantes", 255, 255, 255, 255)
drawTxt(0.66, 1.44, 1.0,1.0,0.4, _U('robbery_of') .. secondsRemaining .. _U('seconds_remaining'), 255, 255, 255, 255)
local pos2 = Stores[store].position
if(Vdist(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z) > 7.5)then
+3
View File
@@ -1,3 +1,6 @@
Config = {}
Config.Locale = 'fr'
Stores = {
--[["paleto_twentyfourseven"] = {
position = { ['x'] = 1736.32092285156, ['y'] = 6419.4970703125, ['z'] = 35.037223815918 },
+23
View File
@@ -0,0 +1,23 @@
Locales['en'] = {
['robbery_cancelled'] = 'the robbery will be cancelled, you will gain nothing!',
['robbery_successful'] = 'successful robbery you have gained ~g~$',
['shop_robbery'] = 'shop Robbery',
['press_to_rob'] = 'press ~INPUT_CONTEXT~ to rob ~b~',
['robbery_of'] = 'store robbery: ~r~',
['seconds_remaining'] = '~w~ seconds remaning',
['robbery_cancelled_at'] = '~r~ Robbery cancelled at: ~b~',
['robbery_has_cancelled'] = '~r~ robbery has been cancelled: ~b~',
['already_robbed'] = 'this store has already been robbed. Please wait: ',
['seconds'] = 'seconds.',
['rob_in_prog'] = '~r~ robbery in progress at: ~b~',
['started_to_rob'] = 'you started to rob ',
['do_not_move'] = ', do not move away!',
['alarm_triggered'] = 'the alarm has been triggered',
['hold_pos'] = 'hold for 5 minutes and the money is yours!',
['robbery_complete'] = '~r~ Robbery complete.~s~ ~h~ Run!',
['robbery_complete_at'] = '~r~ Robbery complete at: ~b~',
['min_two_police'] = 'there must be at least ~b~2 policemen~s~ in town to rob.',
['robbery_already'] = '~r~A robbery is already in progress.',
}
+23
View File
@@ -0,0 +1,23 @@
Locales['fr'] = {
['robbery_cancelled'] = 'le braquage vas être annulé, vous ne gagnerez rien!',
['robbery_successful'] = 'braquage réussi vous avez gagné ~g~$',
['shop_robbery'] = 'braquage magasin',
['press_to_rob'] = 'appuyer sur ~INPUT_CONTEXT~ pour braquer ~b~',
['robbery_of'] = 'braquage de magasin: ~r~',
['seconds_remaining'] = '~w~ secondes restantes',
['robbery_cancelled_at'] = '~r~ Braquage annulé à: ~b~',
['robbery_has_cancelled'] = '~r~ le braquage à été annulé: ~b~',
['already_robbed'] = 'ce magasin a déjà été braqué. Veuillez attendre: ',
['seconds'] = 'secondes.',
['rob_in_prog'] = '~r~ braquage en cours à: ~b~',
['started_to_rob'] = 'vous avez commencé à braquer ',
['do_not_move'] = ', ne vous éloignez pas!',
['alarm_triggered'] = 'l\'alarme à été déclenché',
['hold_pos'] = 'tenez la position pendant 5min et l\'argent est à vous!',
['robbery_complete'] = '~r~ Braquage terminé.~s~ ~h~ Fuie!',
['robbery_complete_at'] = '~r~ Braquage terminé à: ~b~'
['min_two_police'] = 'il faut minimum ~b~2 policiers~s~ en ville pour braquer.',
['robbery_already'] = '~r~Un braquage est déjà en cours.',
}
+26 -26
View File
@@ -15,36 +15,36 @@ AddEventHandler('esx_holdup:toofar', function(robb)
rob = false
for k, v in pairs(xPlayers) do
if v.job.name == 'police' then
TriggerClientEvent('esx:showNotification', k, '~r~ Braquage annulé à: ~b~' .. Stores[robb].nameofstore)
TriggerClientEvent('esx:showNotification', k, _U('robbery_cancelled_at') .. Stores[robb].nameofstore)
TriggerClientEvent('esx_holdup:killblip', k)
end
end
if(robbers[source])then
TriggerClientEvent('esx_holdup:toofarlocal', source)
robbers[source] = nil
TriggerClientEvent('esx:showNotification', source, '~r~ Le braquage à été annulé: ~b~' .. Stores[robb].nameofstore)
TriggerClientEvent('esx:showNotification', source, _U('robbery_has_cancelled') .. Stores[robb].nameofstore)
end
end)
RegisterServerEvent('esx_holdup:rob')
AddEventHandler('esx_holdup:rob', function(robb)
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
local xPlayers = ESX.GetPlayers()
if Stores[robb] then
local store = Stores[robb]
if (os.time() - store.lastrobbed) < 600 and store.lastrobbed ~= 0 then
TriggerClientEvent('esx:showNotification', source, 'Ce magasin a déjà été braqué. Veuillez attendre: ' .. (1800 - (os.time() - store.lastrobbed)) .. "secondes.")
TriggerClientEvent('esx:showNotification', source, _U('already_robbed') .. (1800 - (os.time() - store.lastrobbed)) .. _U('seconds'))
return
end
local cops = 0
for k, v in pairs(xPlayers) do
if v.job.name == 'police' then
@@ -52,51 +52,51 @@ AddEventHandler('esx_holdup:rob', function(robb)
end
end
if rob == false then
if(cops > 1)then
rob = true
for k, v in pairs(xPlayers) do
if v.job.name == 'police' then
TriggerClientEvent('esx:showNotification', k, '~r~ Braquage en cours à: ~b~' .. store.nameofstore)
TriggerClientEvent('esx:showNotification', k, _U('rob_in_prog') .. store.nameofstore)
TriggerClientEvent('esx_holdup:setblip', k, Stores[robb].position)
end
end
TriggerClientEvent('esx:showNotification', source, 'Vous avez commencé à braquer ' .. store.nameofstore .. ', ne vous éloignez pas!')
TriggerClientEvent('esx:showNotification', source, 'L\'alarme à été déclenché ')
TriggerClientEvent('esx:showNotification', source, 'Tenez la position pendant 5min et l\'argent est à vous! ')
end
TriggerClientEvent('esx:showNotification', source, _U('started_to_rob') .. store.nameofstore .. _U('do_not_move'))
TriggerClientEvent('esx:showNotification', source, _U('alarm_triggered'))
TriggerClientEvent('esx:showNotification', source, _U('hold_pos'))
TriggerClientEvent('esx_holdup:currentlyrobbing', source, robb)
Stores[robb].lastrobbed = os.time()
robbers[source] = robb
local savedSource = source
SetTimeout(300000, function()
if(robbers[savedSource])then
rob = false
TriggerClientEvent('esx_holdup:robberycomplete', savedSource, job)
if(xPlayer)then
if(xPlayer)then
xPlayer.addAccountMoney('black_money', store.reward)
TriggerClientEvent('esx:showNotification', source, '~r~ Braquage terminé.~s~ ~h~ Fuie!')
TriggerClientEvent('esx:showNotification', source, _U('robbery_complete'))
for k, v in pairs(xPlayers) do
if v.job.name == 'police' then
TriggerClientEvent('esx:showNotification', k, '~r~ Braquage terminé à: ~b~' .. store.nameofstore)
TriggerClientEvent('esx:showNotification', k, _U('robbery_complete_at') .. store.nameofstore)
TriggerClientEvent('esx_holdup:killblip', k)
end
end
end
end
end)
else
TriggerClientEvent('esx:showNotification', source, 'Il faut minimum ~b~2 policiers~s~ en ville pour braquer.')
TriggerClientEvent('esx:showNotification', source, _U('min_two_police'))
end
else
TriggerClientEvent('esx:showNotification', source, '~r~Un braquage est déjà en cours.')
TriggerClientEvent('esx:showNotification', source, _U('robbery_already'))
end
end
end)